/* ===========================================
   Styles principaux — lego4 (Compréhension)
   Design system aligné sur FLSco (lego0)
   Pont de variables conservé volontairement :
   les noms locaux (--primary, --text, etc.) restent
   pour ne pas casser tous les composants existants,
   mais pointent désormais vers les jetons FLSco.
   =========================================== */

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

:root {
    --primary: var(--ill-leaf);
    --primary-dark: color-mix(in oklab, var(--ill-leaf), black 25%);
    --primary-light: color-mix(in oklab, var(--ill-leaf) 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);
    --warning-bg: color-mix(in oklab, var(--warning) 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: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    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;
}

.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;
}

.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;
}

/* Variante avec grille de cards en dessous (page d'accueil) */
.welcome-section.has-grid {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    gap: 2rem;
    padding: 1rem 0;
}
.welcome-section.has-grid .welcome-card {
    align-self: center;
    max-width: 720px;
    width: 100%;
}

.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 — pattern lego3 FLSco : icone outline + titre + description,
   hover -> remplissage leaf, sans border-top colore. */
.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 0.2s ease,
                box-shadow 0.2s ease,
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease;
}

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

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

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

/* Icone outline leaf (pas de cube, pas de fond) */
.card-icon {
    color: var(--ill-leaf, #7FB94A);
    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 fleche masquee 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;
}

/* 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.4rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 2px dashed #fca5a5;
}

.btn-mod {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    font-size: 1.2rem;
    min-height: 38px;
    transition: all 0.15s;
    flex: 0 0 auto;
    position: relative;
}

.btn-mod:hover {
    background: #fef2f2;
    border-color: #f87171;
}

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

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

@media (max-width: 768px) {
    .btn-mod {
        min-width: 36px;
        min-height: 36px;
        padding: 0.4rem;
    }
}

/* ===========================================
   Consommateurs de --primary (migré depuis themes.css)
   Chantier 001 Phase B — js/themes.js supprimé, plus de
   switcher de thème : --primary = var(--ill-leaf) en permanence.
   =========================================== */

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

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

.header h1,
.card h3,
.welcome-card h2,
.cta,
.footer a {
    color: var(--primary);
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 25%, transparent);
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-dark);
}

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

.progress-bar {
    background-color: var(--primary);
}

::selection {
    background-color: var(--primary-light);
    color: white;
}

/* Override soulignement (FLSco met a:hover { text-decoration: underline })
   Les <a> stylés en boutons/cartes ne se soulignent jamais. */
[class*="btn-"],
[class*="btn-"]:hover,
.card,
.card:hover,
.cta,
.cta:hover,
.header-nav a,
.header-nav a:hover,
.user-menu a,
.user-menu a:hover {
    text-decoration: none;
}

/* ===========================================
   Signature visuelle FLSco (Chantier 001 Phase C)
   - Mascotte injectée dans les pages hub (.brand-mascot)
   - Sizing standard des icônes Lucide selon le contexte
   =========================================== */

.brand-mascot {
    height: 40px;
    width: auto;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Icônes Lucide inline dans h1/h2/h3 — taille 20px */
h1 i[data-lucide], h1 svg,
h2 i[data-lucide], h2 svg,
h3 i[data-lucide], h3 svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
    vertical-align: -3px;
    margin-right: 0.3rem;
}

/* Icônes Lucide dans les boutons d'action — 16px */
.btn-action i[data-lucide],
.btn-action svg,
[class*="btn-"] i[data-lucide],
[class*="btn-"] svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
    vertical-align: -3px;
}

/* Empty-state — icône grande */
.empty-state-icon i[data-lucide],
.empty-state-icon svg {
    width: 56px;
    height: 56px;
    stroke-width: 1.5;
}
