/* Variables de couleurs - Thème sombre (par défaut) */
:root,
body.theme-dark {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --accent: #4a9eff;
    --accent-hover: #5aaaff;
    --accent-light: #1a3a5a;
    --success: #4ade80;
    --success-light: #1a3a2a;
    --danger: #ff6b6b;
    --danger-light: #3a1a1a;
    --warning: #ffb84d;
    --border: #404040;
    --border-light: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-md: rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

/* Thème blanc */
body.theme-light {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #86868b;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-light: #e8f4fd;
    --success: #34c759;
    --success-light: #e8f9ed;
    --danger: #ff3b30;
    --danger-light: #ffebe9;
    --warning: #ff9500;
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    --shadow: rgba(0, 0, 0, 0.04);
    --shadow-md: rgba(0, 0, 0, 0.08);
}

/* Thème orange et noir */
body.theme-orange {
    --bg-primary: #000000;
    --bg-secondary: #1a0f00;
    --bg-tertiary: #2a1500;
    --text-primary: #ffffff;
    --text-secondary: #ff9933;
    --text-muted: #cc7700;
    --accent: #ff6600;
    --accent-hover: #ff7700;
    --accent-light: #3a1f00;
    --success: #ff8800;
    --success-light: #2a1500;
    --danger: #ff4400;
    --danger-light: #2a0f00;
    --warning: #ff7700;
    --border: #3a2500;
    --border-light: #2a1500;
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-md: rgba(0, 0, 0, 0.7);
}

/* Thème bleu et rose */
body.theme-blue-pink {
    --bg-primary: #8dd9ff;
    --bg-secondary: #cc6ab8;
    --bg-tertiary: #bb5aaf;
    --text-primary: #1a0f1e;
    --text-secondary: #4a2a4e;
    --text-muted: #6a4a6e;
    --accent: #aa489e;
    --accent-hover: #bb5aaf;
    --accent-light: #dd7bc8;
    --success: #6dd3fe;
    --success-light: #9de0ff;
    --danger: #ff6b6b;
    --danger-light: #ff8b8b;
    --warning: #ffaa6b;
    --border: #bb5aaf;
    --border-light: #cc6ab8;
    --shadow: rgba(109, 211, 254, 0.25);
    --shadow-md: rgba(170, 72, 158, 0.35);
    background: linear-gradient(135deg, #6dd3fe 0%, #7dd4fe 30%, #8dd9ff 50%, #9de0ff 70%, #aa489e 100%);
    background-attachment: fixed;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-light);
    color: var(--accent);
}

/* Theme Selector */
.theme-selector {
    position: relative;
}

.theme-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 1.125rem;
    position: relative;
}

.theme-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.theme-btn:active {
    transform: scale(0.95);
}

.theme-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px var(--shadow-md);
    padding: 0.5rem;
    min-width: 200px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
}

.theme-option-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-option::after {
    content: '✓';
    position: absolute;
    right: 0.75rem;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition);
    color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
}

.theme-option:hover {
    background: var(--bg-tertiary);
    transform: translateX(2px);
}

.theme-option.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.theme-option.active::after {
    opacity: 1;
    transform: scale(1);
}

/* Main Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px var(--shadow);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

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

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

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

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

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Lists */
.list {
    list-style: none;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-primary);
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-primary);
}

.list-item-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.list-item-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
}

.list-section-header {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.list-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.breadcrumb-link {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* Quiz Components */
.quiz-header {
    text-align: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.quiz-progress {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.quiz-timer {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.quiz-question {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: var(--text-primary);
}

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

.choice-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    text-align: left;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
}

.choice-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

.choice-btn.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.choice-btn.correct {
    border-color: var(--success);
    background: var(--success-light);
}

.choice-btn.incorrect {
    border-color: var(--danger);
    background: var(--danger-light);
}

.choice-btn:disabled {
    cursor: default;
}

.choice-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.choice-btn.selected .choice-indicator {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.choice-btn.correct .choice-indicator {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.choice-btn.incorrect .choice-indicator {
    border-color: var(--danger);
    background: var(--danger);
    color: white;
}

/* Results */
.result-score {
    text-align: center;
    padding: 2rem 0;
}

.score-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.score-time {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Leaderboard */
.leaderboard {
    width: 100%;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 50px 1fr 80px 80px;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 80px;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row.highlight {
    background: var(--accent-light);
}

.leaderboard-rank {
    font-weight: 600;
    color: var(--text-secondary);
}

.leaderboard-rank.top {
    color: var(--warning);
}

.leaderboard-name {
    font-weight: 500;
    color: var(--text-primary);
}

.leaderboard-score {
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.leaderboard-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: right;
}

/* Flashcard */
.flashcard {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--shadow-md);
    text-align: center;
}

.flashcard:hover {
    box-shadow: 0 4px 16px var(--shadow-md);
}

.flashcard-question {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-primary);
}

.flashcard-answer {
    font-size: 1.125rem;
    color: var(--success);
    font-weight: 500;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    width: 100%;
}

.flashcard-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Auth Forms */
.auth-form {
    max-width: 360px;
    margin: 0 auto;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--transition);
    font-family: inherit;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-quiz {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-flash {
    background: #fff3e0;
    color: #f57c00;
}

/* Messages */
.message {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.message-error {
    background: var(--danger-light);
    color: var(--danger);
}

.message-success {
    background: var(--success-light);
    color: var(--success);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Prompt Box */
.prompt-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
}

.prompt-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    
    .theme-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: var(--radius);
    }
    
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 40px 1fr 60px 60px;
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .quiz-timer {
        font-size: 1.25rem;
    }
    
    .score-display {
        font-size: 2.5rem;
    }
}
#nav-user{
    display:flex;
    align-items: center;
}