/* ============================================
   Variables et reset
   ============================================ */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #059669;
    --color-error: #dc2626;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Lora', Georgia, serif;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Écrans
   ============================================ */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
}

/* La classe .hidden ne doit pas bloquer .screen.active */
.screen.hidden.active {
    display: flex !important;
}

/* ============================================
   Page de connexion
   ============================================ */
#loginScreen {
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
}

.input-group input,
.input-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.login-info p {
    margin-bottom: 0.5rem;
}

.error-message {
    padding: 0.75rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 0.875rem;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   Contenu principal
   ============================================ */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* ============================================
   Sélection des profils
   ============================================ */
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-description {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.profile-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-card:not(.disabled):hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.profile-card.disabled {
    opacity: 0.6;
}

.profile-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.profile-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.profile-age {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.profile-situation {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    min-height: 3rem;
}

/* ============================================
   Histoire
   ============================================ */
.story-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn-back {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

#storyTitle {
    flex: 1;
    margin-bottom: 0;
}

.story-content {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.story-text {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    white-space: pre-wrap;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    text-align: left;
    background-color: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.choice-btn:hover {
    background-color: #eff6ff;
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.progress-indicator {
    margin-top: 1rem;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* ============================================
   Administration
   ============================================ */
.admin-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stories-list {
    display: grid;
    gap: 1rem;
}

.story-item {
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.story-item-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.story-item-info p {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.editor-form {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ============================================
   Boutons
   ============================================ */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background-color: var(--color-bg);
}

.btn-disabled {
    background-color: var(--color-border);
    color: var(--color-text-light);
    cursor: not-allowed;
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 640px) {
    .login-container {
        padding: 1.5rem;
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    .profiles-grid {
        grid-template-columns: 1fr;
    }
    
    .story-content {
        padding: 1.25rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .admin-actions,
    .editor-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-section.active {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   Bouton discret d'accès à l'édition
   ============================================ */
.edit-access-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    z-index: 1000;
    opacity: 0.7;
}

.edit-access-btn:hover {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    .edit-access-btn {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
}