/* ===========================================
   Styles principaux - Vocabulaire (Lexique)
   Design system FLSco (chantier 005) :
   - Charge colors_and_type.css (typo Nunito/Quicksand, palette --ill-*, --fg-*, --bg)
   - Design system local : --primary, --text, --background, etc. alignés sur lego0
     (mêmes noms de variables, identité orange propre à Vocabulaire)
   - Identité orange Vocabulaire (--ill-orange), définie côté lego0/js/flsco/data.jsx
     comme couleur de l'app Vocabulaire dans la barre de nav inter-apps (ecosystem.js).
     Si lego0 change la teinte d'orange, lego3 suit automatiquement via var(--ill-orange).
   =========================================== */

@import url('flsco/colors_and_type.css');

/* Design system local lego3 (D3 — chantier 005 : conservé volontairement, pas un
   legacy temporaire). Niveau sémantique au-dessus de la palette FLSco :
   --primary = couleur principale de l'app (= --ill-orange pour Vocabulaire).
   Pattern identique à lego0/css/main.css (mêmes noms de variables). */
:root {
    --primary: var(--ill-orange);
    --primary-dark: color-mix(in oklab, var(--ill-orange), black 25%);
    --primary-light: color-mix(in oklab, var(--ill-orange) 25%, white);
    --secondary: var(--bg-sunken);
    --background: var(--bg);
    --text: var(--fg-1);
    --text-light: var(--fg-2);
    --white: #FFFFFF;
    --error: var(--danger);
    --error-bg: color-mix(in oklab, var(--danger) 15%, white);
    --success-bg: color-mix(in oklab, var(--success) 15%, white);
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-small: 8px;
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* font-family vient de colors_and_type.css (Nunito) */
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--text);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.header-nav a {
    text-decoration: none;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-small);
    transition: all 0.2s;
}

.header-nav a:hover {
    background: var(--primary);
    color: var(--white);
}

.header-nav a.active {
    background: var(--primary-dark);
    color: var(--white);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu span {
    color: var(--text);
    font-weight: 500;
}

.user-menu a,
.user-menu button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    text-decoration: none;
    color: var(--ill-orange, #E8703D);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-menu a svg,
.user-menu a i[data-lucide],
.user-menu button svg,
.user-menu button i[data-lucide] {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
}

.login-buttons {
    display: flex;
    gap: 0.5rem;
    position: relative;
    z-index: 10;
}

.login-buttons .btn {
    pointer-events: auto;
}

/* Boutons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    position: relative;
    z-index: 1;
    gap: 0.25rem;
}

a.btn:hover {
    text-decoration: none;
}

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

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

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

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

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

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

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #d97706;
    color: white;
}

.btn-warning:hover {
    background: #b45309;
}

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

/* Welcome section */
.welcome-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.welcome-card {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px var(--shadow);
    max-width: 500px;
    text-align: center;
}

.welcome-card h2 {
    color: var(--text);
    margin-bottom: 1rem;
}

.features-list {
    list-style: none;
    text-align: left;
    margin: 1.5rem 0;
}

.features-list li {
    padding: 0.5rem 0;
    color: var(--text);
}

.cta {
    color: var(--primary-dark);
    font-weight: 600;
    margin-top: 1rem;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.welcome-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

@media (min-width: 400px) {
    .welcome-actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* Dashboard */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Cartes dashboard — version minimale : icône outline + titre + description */
.card {
    position: relative;
    background: #fff;
    border: 1px solid var(--border, #e5e5e8);
    border-radius: 14px;
    padding: 24px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    text-align: left;
    transition: transform var(--dur-base, 0.2s) var(--ease-out, ease),
                box-shadow var(--dur-base, 0.2s) var(--ease-out, ease),
                background-color var(--dur-base, 0.2s) var(--ease-out, ease),
                border-color var(--dur-base, 0.2s) var(--ease-out, ease),
                color var(--dur-base, 0.2s) var(--ease-out, ease);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
    background: var(--ill-orange, #E8703D);
    border-color: var(--ill-orange, #E8703D);
    color: #fff;
    text-decoration: none;
}

.card:hover h3,
.card:hover p,
.card:hover .card-icon {
    color: #fff;
}

.card:active { transform: translateY(-1px); }

/* Icône outline orange (pas de cube, pas de fond) */
.card-icon {
    color: var(--ill-orange, #E8703D);
    line-height: 1;
    display: flex;
    align-items: center;
    margin-bottom: 0;
    min-height: auto;
    font-size: 0;
}

.card-icon svg,
.card-icon i[data-lucide] {
    width: 40px;
    height: 40px;
    stroke-width: 1.5;
    color: currentColor;
}

/* CTA flèche masquée dans cette variante */
.card-cta { display: none; }

.card h3 {
    font-family: var(--font-display, "Quicksand", sans-serif);
    font-weight: 700;
    font-size: 19px;
    color: var(--ink-900, var(--text));
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1.2;
}

.card p {
    font-family: var(--font-body, "Nunito", sans-serif);
    font-size: 13px;
    color: var(--fg-2, var(--text-light));
    line-height: 1.35;
    margin: 0;
}

/* Variantes de cartes : sangle haut unifiée gérée par .card::before
   (les anciens border-top colorés par carte ont été retirés — chantier home FLSco) */

/* Footer */
.footer {
    background: var(--white);
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-light);
}

.footer a {
    color: var(--primary-dark);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Messages */
.message {
    padding: 12px 15px;
    border-radius: var(--radius-small);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.message.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error);
}

.message.success {
    background: var(--success-bg);
    color: #2E7D32;
    border: 1px solid var(--success);
}

.message.hidden {
    display: none;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-right {
        order: 2;
        width: 100%;
        justify-content: center;
    }

    .login-buttons {
        justify-content: center;
        width: 100%;
    }

    .login-buttons .btn {
        min-height: 44px;
        min-width: 120px;
        padding: 0.75rem 1.5rem;
    }

    .user-menu {
        justify-content: center;
        width: 100%;
    }

    .user-menu a,
    .user-menu button {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .welcome-card {
        padding: 2rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   Navigation principale (nav.js)
   =========================================== */

/* Navigation desktop */
.nav-desktop {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-small);
    transition: all 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

/* Navigation mobile */
.nav-mobile {
    display: none;
}

.nav-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-mobile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    box-shadow: 0 4px 12px var(--shadow);
    border-radius: var(--radius);
    padding: 0.5rem;
    min-width: 200px;
    z-index: 1000;
}

.nav-mobile-link {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius-small);
    transition: background 0.2s;
}

.nav-mobile-link:hover {
    background: var(--primary-light);
}

.nav-mobile-link.active {
    background: var(--primary);
    color: var(--white);
}

/* Responsive - Basculer vers menu mobile */
@media (max-width: 900px) {
    .nav-desktop {
        display: none;
    }

    .nav-mobile {
        display: block;
        position: relative;
    }

    .nav-label {
        display: inline;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header h1 {
        font-size: 1.1rem;
    }
}

/* ========================================
   Boutons modération admin
   Bloc séparé en bas des cartes partagées
   ======================================== */

.admin-moderation {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-strong, #CFCFD3);
}

.btn-mod {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--white, #fff);
    border: 1px solid var(--border, #e5e5e8);
    border-radius: var(--r-md, 6px);
    cursor: pointer;
    font-size: 1.05rem;
    color: var(--danger, #C8553D);
    transition: background var(--dur-fast, 0.12s) var(--ease-out, ease),
                border-color var(--dur-fast, 0.12s) var(--ease-out, ease),
                color var(--dur-fast, 0.12s) var(--ease-out, ease);
    flex: 0 0 auto;
    position: relative;
}

.btn-mod svg,
.btn-mod i[data-lucide] {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
    color: currentColor;
}

.btn-mod:hover {
    background: color-mix(in oklab, var(--danger, #C8553D) 12%, white);
    border-color: var(--danger, #C8553D);
}

.btn-mod::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: var(--ink-800, #2A2A2A);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: var(--r-sm, 5px);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-fast, 0.12s) var(--ease-out, ease),
                transform var(--dur-fast, 0.12s) var(--ease-out, ease);
    z-index: 10;
}

.btn-mod:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ========================================
   Phase B2 — Overrides FLSco (chantier 005)
   Placés en fin de fichier pour gagner la cascade contre les règles précédentes
   ======================================== */

/* Suppression de l'underline au survol sur les éléments fonctionnels.
   Hérité de colors_and_type.css qui définit a:hover { text-decoration: underline }.
   Tous les a[class*="card"] ou [class*="row"] sont des "tiles" fonctionnels. */
a[class*="card"]:hover,
a[class*="row"]:hover,
.nav-link:hover,
.nav-mobile-link:hover,
.header-nav a:hover,
.user-menu a:hover,
.footer a:hover,
.help-button:hover { text-decoration: none; }

/* Sangle haut de carte dashboard : gérée par .card::before (refonte FLSco) */

/* Navigation : icônes Lucide orange par défaut, blanches sur fond orange (hover/active) */
.nav-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.nav-link svg { color: var(--ill-orange); flex-shrink: 0; transition: color 0.15s; }
.nav-link:hover, .nav-link.active { background: var(--ill-orange); color: white; }
.nav-link:hover svg, .nav-link.active svg { color: white; }

.nav-mobile-link { display: flex; align-items: center; gap: 0.5rem; }
.nav-mobile-link svg { color: var(--ill-orange); flex-shrink: 0; }
.nav-mobile-link:hover, .nav-mobile-link.active { background: var(--ill-orange); color: white; }
.nav-mobile-link:hover svg, .nav-mobile-link.active svg { color: white; }

/* Bouton Retour (chevron gauche) injecté dans .header-left par nav.js */
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-light);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    flex-shrink: 0;
}
.back-button:hover {
    background: rgba(232, 112, 61, 0.12);
    color: var(--ill-orange);
    text-decoration: none;
}
.back-button svg { color: inherit; }

/* Mascotte FLSco injectée dans .header-left par nav.js */
.brand-mascot {
    height: 40px;
    width: auto;
    flex-shrink: 0;
}

/* Sous-bandeau titre — sur les 11 pages hub, nav.js déplace .header-left ici */
.page-title-bar {
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.page-title-bar h1 {
    font-size: 1.5rem;
    color: var(--ill-orange);
    margin: 0;
}
@media (max-width: 768px) {
    .page-title-bar {
        padding: 0.75rem 1rem;
    }
}

/* Bouton Guide (icône d'aide) injecté dans .header-right par nav.js */
.help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-light);
    transition: background 0.15s, color 0.15s;
}
.help-button:hover {
    background: rgba(232, 112, 61, 0.12);
    color: var(--ill-orange);
    text-decoration: none;
}
.help-button svg { color: inherit; }

/* Icônes Lucide de fin de partie : le SVG reprend le font-size du conteneur
   (les emojis d'origine étaient dimensionnés en font-size, pas le SVG). */
.result-icon svg,
.result-emoji svg,
.victory-icon svg {
    width: 1em;
    height: 1em;
    stroke-width: 1.5;
    vertical-align: middle;
}
