/* ===================================================================
   SCANLIX — DESIGN SYSTEM v2
   5 thèmes : nova (dark/cyber) · cinema (dark/premium) · void (dark/glass)
              porcelain (light/tech-store) · sakura (light/pastel)
   Chaque thème transforme layout, typographie, fonds et animations.
   =================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,500;0,700;0,900;1,500&family=Outfit:wght@300;400;500;600;700&family=Quicksand:wght@400;500;600;700&family=Cormorant+Garamond:wght@500;600&display=swap');

/* ===================================================================
   1. CONTRAT DE VARIABLES — THÈME PAR DÉFAUT : NOVA (dark cyber)
   =================================================================== */
:root, :root.theme-nova {
    --bg:        #07070f;
    --bg2:       #0b0b18;
    --surface:   #10101e;
    --surface2:  #181830;
    --glass:     rgba(22, 22, 40, .55);
    --border:    rgba(139, 92, 246, .16);
    --border2:   rgba(139, 92, 246, .32);
    --text:      #eceaf6;
    --muted:     #8d8aa5;
    --primary:   #8b5cf6;
    --primary-rgb: 139, 92, 246;
    --accent:    #22d3ee;
    --accent-rgb: 34, 211, 238;
    --pink:      #ec4899;
    --pink-rgb:  236, 72, 153;
    --green:     #34d399;
    --red:       #fb7185;
    --blue:      #60a5fa;
    --gold:      #fbbf24;
    --grad:      linear-gradient(135deg, #8b5cf6, #ec4899 60%, #22d3ee);
    --font-body: 'Inter', system-ui, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --r-sm: 8px; --r-md: 14px; --r-lg: 18px; --r-xl: 26px;
    --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
    --shadow-md: 0 12px 30px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
    --glow:      0 0 24px rgba(var(--primary-rgb), .45);
    --nav-bg:    rgba(10, 10, 22, .72);
    --input-bg:  rgba(0, 0, 0, .35);
    --smooth: cubic-bezier(.25,.8,.25,1);
    --spring: cubic-bezier(.34,1.56,.64,1);
    /* Aliases héritées de l'ancien code */
    --bg-color: var(--bg); --card-bg: var(--surface); --text-light: var(--text);
    --text-muted: var(--muted); --secondary: var(--pink); --success: var(--green);
    --danger: var(--red); --primary-light: #c4b5fd;
}

/* ----------------------------- CINEMA (dark premium) ------------- */
:root.theme-cinema {
    --bg: #0a0908; --bg2: #100e0c; --surface: #15120e; --surface2: #1e1a14;
    --glass: rgba(20, 17, 12, .6);
    --border: rgba(212, 175, 55, .18); --border2: rgba(212, 175, 55, .38);
    --text: #f0e9dd; --muted: #9a8f7d;
    --primary: #d4af37; --primary-rgb: 212, 175, 55;
    --accent: #e8c66a; --accent-rgb: 232, 198, 106;
    --pink: #c0833c; --pink-rgb: 192, 131, 60;
    --green: #9bbf7a; --red: #d96c5f; --blue: #7fa6c9; --gold: #e8c66a;
    --grad: linear-gradient(135deg, #d4af37, #f5e0a3 50%, #b8860b);
    --font-body: 'Outfit', system-ui, sans-serif;
    --font-display: 'Playfair Display', serif;
    --r-sm: 2px; --r-md: 4px; --r-lg: 6px; --r-xl: 8px;
    --shadow-sm: 0 2px 12px rgba(0,0,0,.5); --shadow-md: 0 16px 40px rgba(0,0,0,.6);
    --shadow-lg: 0 30px 80px rgba(0,0,0,.7);
    --glow: 0 0 30px rgba(212, 175, 55, .25);
    --nav-bg: linear-gradient(180deg, rgba(8,7,5,.92), rgba(8,7,5,0));
    --input-bg: rgba(255, 255, 255, .04);
    --primary-light: #f5e0a3;
}

/* ----------------------------- VOID (dark glass) ------------------ */
:root.theme-void {
    --bg: #05060e; --bg2: #090b18; --surface: rgba(255,255,255,.045);
    --surface2: rgba(255,255,255,.08); --glass: rgba(16, 18, 38, .42);
    --border: rgba(255,255,255,.1); --border2: rgba(255,255,255,.22);
    --text: #e8ecff; --muted: #8e96b8;
    --primary: #6d8dff; --primary-rgb: 109, 141, 255;
    --accent: #4ee6c1; --accent-rgb: 78, 230, 193;
    --pink: #b78aff; --pink-rgb: 183, 138, 255;
    --green: #4ee6c1; --red: #ff7d9c; --blue: #6d8dff; --gold: #ffd479;
    --grad: linear-gradient(135deg, #6d8dff, #b78aff 55%, #4ee6c1);
    --font-body: 'Outfit', system-ui, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --r-sm: 12px; --r-md: 18px; --r-lg: 24px; --r-xl: 32px;
    --shadow-sm: 0 4px 16px rgba(2,4,16,.4); --shadow-md: 0 16px 40px rgba(2,4,16,.5);
    --shadow-lg: 0 30px 90px rgba(2,4,16,.65);
    --glow: 0 0 32px rgba(109, 141, 255, .35);
    --nav-bg: rgba(13, 15, 32, .55);
    --input-bg: rgba(255,255,255,.05);
    --primary-light: #aebfff;
}

/* ----------------------------- PORCELAIN (light tech) ------------- */
:root.theme-porcelain {
    --bg: #f5f5f7; --bg2: #ffffff; --surface: #ffffff; --surface2: #fbfbfd;
    --glass: rgba(255,255,255,.72);
    --border: rgba(0,0,0,.08); --border2: rgba(0,0,0,.16);
    --text: #1d1d1f; --muted: #6e6e73;
    --primary: #0071e3; --primary-rgb: 0, 113, 227;
    --accent: #5e5ce6; --accent-rgb: 94, 92, 230;
    --pink: #5e5ce6; --pink-rgb: 94, 92, 230;
    --green: #1d9d5f; --red: #d92d20; --blue: #0071e3; --gold: #b8860b;
    --grad: linear-gradient(135deg, #0071e3, #5e5ce6);
    --font-body: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    --r-sm: 10px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.06); --shadow-md: 0 10px 30px rgba(0,0,0,.08);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.12);
    --glow: 0 8px 24px rgba(0, 113, 227, .25);
    --nav-bg: rgba(251, 251, 253, .78);
    --input-bg: rgba(0,0,0,.04);
    --primary-light: #4196ec;
}

/* ----------------------------- SAKURA (light pastel) -------------- */
:root.theme-sakura {
    --bg: #faf6f2; --bg2: #fdf9f6; --surface: #fffdfb; --surface2: #f8f1ec;
    --glass: rgba(255,253,251,.7);
    --border: rgba(208, 134, 158, .22); --border2: rgba(208, 134, 158, .42);
    --text: #4a3f48; --muted: #97848f;
    --primary: #d8678f; --primary-rgb: 216, 103, 143;
    --accent: #9d8bdb; --accent-rgb: 157, 139, 219;
    --pink: #e8a0b8; --pink-rgb: 232, 160, 184;
    --green: #7cb893; --red: #e0707c; --blue: #82a8d8; --gold: #d9a854;
    --grad: linear-gradient(135deg, #e8a0b8, #9d8bdb 60%, #8fc8c0);
    --font-body: 'Quicksand', system-ui, sans-serif;
    --font-display: 'Quicksand', sans-serif;
    --r-sm: 14px; --r-md: 20px; --r-lg: 26px; --r-xl: 34px;
    --shadow-sm: 0 2px 10px rgba(180, 120, 140, .08);
    --shadow-md: 0 14px 34px rgba(180, 120, 140, .14);
    --shadow-lg: 0 24px 60px rgba(180, 120, 140, .2);
    --glow: 0 10px 28px rgba(216, 103, 143, .28);
    --nav-bg: rgba(255, 252, 250, .8);
    --input-bg: rgba(216, 103, 143, .05);
    --primary-light: #e58fae;
}
:root.theme-porcelain, :root.theme-sakura { color-scheme: light; }
:root.theme-nova, :root.theme-cinema, :root.theme-void { color-scheme: dark; }
:root.theme-porcelain { --bg-color: var(--bg); --card-bg: var(--surface); --text-light: var(--text); --text-muted: var(--muted); --secondary: var(--pink); --success: var(--green); --danger: var(--red); }
:root.theme-cinema, :root.theme-void, :root.theme-sakura { --bg-color: var(--bg); --card-bg: var(--surface); --text-light: var(--text); --text-muted: var(--muted); --secondary: var(--pink); --success: var(--green); --danger: var(--red); }

/* ===================================================================
   2. RESET & BASE
   =================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color .6s var(--smooth), color .6s var(--smooth);
}
input, button, select, textarea { font-family: var(--font-body); }
h1, h2, h3, h4 { font-family: var(--font-display); }
a { text-decoration: none; color: inherit; }
img { display: block; }
button { cursor: pointer; }

/* Transition douce lors du switch de thème */
html.theme-switching * { transition: background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .5s ease !important; }

/* ---- Fonds de scène par thème (immersifs, fixes) ------------------ */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    transition: opacity .8s ease;
}
/* NOVA : grille techno + halos néon */
:root.theme-nova body::before, :root:not([class*="theme-"]) body::before {
    background:
        radial-gradient(ellipse 70% 45% at 80% -5%, rgba(139,92,246,.22), transparent 60%),
        radial-gradient(ellipse 55% 40% at 5% 105%, rgba(34,211,238,.13), transparent 60%),
        linear-gradient(rgba(139,92,246,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,92,246,.05) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 56px 56px, 56px 56px;
    mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, black 30%, rgba(0,0,0,.4) 100%);
}
/* CINEMA : vignette + faisceau projecteur */
:root.theme-cinema body::before {
    background:
        radial-gradient(ellipse 60% 50% at 50% -10%, rgba(212,175,55,.1), transparent 65%),
        radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%);
}
/* Grain de pellicule animé */
:root.theme-cinema body::after {
    content: ''; position: fixed; inset: -100px; z-index: 99998; pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 7s steps(10) infinite;
}
@keyframes grain { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-40px,30px)} 40%{transform:translate(30px,-50px)} 60%{transform:translate(-50px,-20px)} 80%{transform:translate(40px,40px)} }
/* VOID : orbes aurora flottants, parallaxe pilotée par --mx/--my (JS) */
:root.theme-void body::before {
    background:
        radial-gradient(circle 480px at calc(18% + var(--mx, 0px)) calc(22% + var(--my, 0px)), rgba(109,141,255,.22), transparent 70%),
        radial-gradient(circle 420px at calc(82% - var(--mx, 0px)) calc(65% - var(--my, 0px)), rgba(183,138,255,.16), transparent 70%),
        radial-gradient(circle 380px at calc(45% + var(--mx, 0px)) calc(95% + var(--my, 0px)), rgba(78,230,193,.12), transparent 70%);
    filter: blur(8px);
    animation: voidDrift 24s ease-in-out infinite alternate;
}
@keyframes voidDrift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(2%, -2%, 0) scale(1.06); } }
/* PORCELAIN : dégradé épuré quasi imperceptible */
:root.theme-porcelain body::before {
    background:
        radial-gradient(ellipse 80% 50% at 50% -15%, rgba(0,113,227,.06), transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 110%, rgba(94,92,230,.05), transparent 60%);
}
/* SAKURA : mesh pastel animé réagissant à la souris */
:root.theme-sakura body::before {
    background:
        radial-gradient(circle 520px at calc(20% + var(--mx, 0px)) calc(15% + var(--my, 0px)), rgba(232,160,184,.22), transparent 70%),
        radial-gradient(circle 480px at calc(85% - var(--mx, 0px)) calc(40% - var(--my, 0px)), rgba(157,139,219,.16), transparent 70%),
        radial-gradient(circle 460px at calc(50% + var(--mx, 0px)) calc(100% + var(--my, 0px)), rgba(143,200,192,.18), transparent 70%);
    animation: voidDrift 20s ease-in-out infinite alternate;
}

/* ---- Scrollbar & sélection --------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
::selection { background: rgba(var(--primary-rgb), .35); color: var(--text); }

/* ===================================================================
   3. LAYOUT / CONTAINER (varie selon thème)
   =================================================================== */
.container { max-width: 1240px; margin: 0 auto; padding: 24px 20px; }
:root.theme-cinema .container { max-width: 1380px; padding: 24px 36px; }
:root.theme-void .container { max-width: 1080px; }
:root.theme-porcelain .container { max-width: 1200px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* Révélation au scroll (JS ajoute .in-view) */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--smooth), transform .7s var(--smooth); }
.reveal.in-view { opacity: 1; transform: none; }
:root.theme-porcelain .reveal { transform: translateY(40px) scale(.98); }
:root.theme-cinema .reveal { transform: translateY(0) scale(.97); filter: blur(6px); transition: opacity .9s ease, transform .9s ease, filter .9s ease; }
:root.theme-cinema .reveal.in-view { filter: blur(0); }

/* ===================================================================
   4. NAVBAR — transformée par thème
   =================================================================== */
.nav {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 22px; margin-bottom: 34px;
    background: var(--nav-bg);
    backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    position: sticky; top: 12px; z-index: 500;
    animation: fadeUp .6s var(--smooth);
}
.nav h2 { font-size: 1.25em; letter-spacing: .02em; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), .5)); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3em; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-link { padding: 9px 16px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; font-size: .92em; display: flex; align-items: center; gap: 8px; transition: all .3s var(--smooth); position: relative; }
.nav-link:hover { color: var(--text); background: rgba(var(--primary-rgb), .1); transform: translateY(-1px); }
.nav-link.active { color: var(--text); background: rgba(var(--primary-rgb), .16); box-shadow: inset 0 0 0 1px var(--border2); }
.nav-right { display: flex; gap: 14px; align-items: center; }

/* NOVA : barre néon avec liseré dégradé */
:root.theme-nova .nav { border-image: linear-gradient(90deg, rgba(139,92,246,.5), rgba(236,72,153,.3), rgba(34,211,238,.5)) 1; border-radius: 0; border-width: 0 0 1px 0; background: linear-gradient(180deg, rgba(10,10,22,.92), rgba(10,10,22,.65)); top: 0; padding: 16px 26px; }
:root.theme-nova .nav-link.active::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 2px; height: 2px; background: var(--grad); border-radius: 2px; box-shadow: 0 0 10px rgba(var(--primary-rgb), .8); }
/* CINEMA : barre transparente fondue, typographie espacée */
:root.theme-cinema .nav { border: none; border-radius: 0; background: var(--nav-bg); backdrop-filter: none; top: 0; padding: 22px 30px 30px; margin-bottom: 26px; }
:root.theme-cinema .nav-link { text-transform: uppercase; letter-spacing: .18em; font-size: .78em; }
:root.theme-cinema .nav-link.active { background: none; box-shadow: none; color: var(--primary); }
:root.theme-cinema .nav-link.active::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: var(--primary); }
:root.theme-cinema .brand-name { letter-spacing: .3em; text-transform: uppercase; font-size: 1.15em; }
/* VOID : dock capsule flottant centré */
:root.theme-void .nav { border-radius: 999px; padding: 10px 18px; max-width: 920px; margin-left: auto; margin-right: auto; box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.08); }
:root.theme-void .nav-link { border-radius: 999px; }
:root.theme-void .nav-link.active { background: rgba(var(--primary-rgb), .22); box-shadow: 0 0 18px rgba(var(--primary-rgb), .25); }
/* PORCELAIN : barre givrée pleine largeur */
:root.theme-porcelain .nav { border-radius: 0; border-width: 0 0 1px 0; top: 0; margin: 0 -20px 34px; padding: 12px max(20px, calc((100vw - 1200px) / 2)); backdrop-filter: blur(20px) saturate(180%); }
:root.theme-porcelain .nav-link { font-weight: 500; }
:root.theme-porcelain .nav-link.active { background: rgba(0,0,0,.06); box-shadow: none; }
/* SAKURA : pilule arrondie douce */
:root.theme-sakura .nav { border-radius: 999px; box-shadow: var(--shadow-md); border: 2px solid var(--border); }
:root.theme-sakura .nav-link { border-radius: 999px; font-weight: 700; }

.nav-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; cursor: pointer; border: 2px solid var(--border2); transition: all .35s var(--spring); }
.nav-avatar:hover { transform: scale(1.1) rotate(3deg); border-color: var(--primary); box-shadow: var(--glow); }
.nav-profile-container { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -6px; background: var(--red); color: #fff; font-size: .68em; font-weight: 800; min-width: 19px; height: 19px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px; box-shadow: 0 0 0 2px var(--bg), 0 0 12px rgba(251,113,133,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.profile-dropdown { position: absolute; right: 0; top: calc(100% + 12px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.96); transition: all .3s var(--spring); z-index: 600; backdrop-filter: blur(20px); }
:root.theme-void .profile-dropdown, :root.theme-cinema .profile-dropdown { background: var(--glass); }
.profile-dropdown.show { opacity: 1; visibility: visible; transform: none; }
.profile-dropdown a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm); color: var(--text); font-weight: 600; font-size: .92em; transition: all .25s; }
.profile-dropdown a:hover { background: rgba(var(--primary-rgb), .12); transform: translateX(4px); }
.profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ===================================================================
   5. BOUTONS
   =================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 700; font-size: .92em; color: var(--text); background: var(--surface2); transition: all .3s var(--spring); position: relative; overflow: hidden; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 4px 18px rgba(var(--primary-rgb), .35); }
.btn-primary:hover { box-shadow: 0 8px 28px rgba(var(--primary-rgb), .5); filter: brightness(1.1); }
.btn-outline { background: transparent; border-color: var(--border2); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(var(--primary-rgb), .08); }
.btn-danger { background: rgba(251, 113, 133, .12); border-color: rgba(251, 113, 133, .35); color: var(--red); }
.btn-danger:hover { background: rgba(251, 113, 133, .25); }
.btn-success { background: rgba(52, 211, 153, .14); border-color: rgba(52, 211, 153, .4); color: var(--green); }
.btn-success:hover { background: rgba(52, 211, 153, .28); }
/* Effet "shine" au survol des boutons primaires */
.btn-primary::after { content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); transition: left .6s ease; }
.btn-primary:hover::after { left: 130%; }
:root.theme-cinema .btn { border-radius: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .8em; padding: 12px 26px; }
:root.theme-cinema .btn-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); box-shadow: none; }
:root.theme-cinema .btn-primary:hover { background: var(--primary); color: #0a0908; box-shadow: var(--glow); }
:root.theme-porcelain .btn, :root.theme-sakura .btn, :root.theme-void .btn { border-radius: 999px; }
:root.theme-porcelain .btn-primary { background: var(--primary); }
:root.theme-sakura .btn-primary { box-shadow: var(--glow); }

/* ===================================================================
   6. FORMULAIRES & INPUTS
   =================================================================== */
input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
    width: 100%; padding: 13px 16px; border-radius: var(--r-sm);
    background: var(--input-bg); border: 1px solid var(--border);
    color: var(--text); font-size: .95em; font-weight: 500;
    transition: all .3s var(--smooth); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
select { cursor: pointer; }
select option { background: var(--surface); color: var(--text); }
:root.theme-cinema input, :root.theme-cinema textarea, :root.theme-cinema select { border-radius: 0; border-width: 0 0 1px 0; background: transparent; padding-left: 4px; }
:root.theme-cinema input:focus, :root.theme-cinema textarea:focus { box-shadow: none; border-color: var(--primary); background: rgba(212,175,55,.04); }
:root.theme-porcelain input, :root.theme-porcelain textarea, :root.theme-porcelain select,
:root.theme-sakura input, :root.theme-sakura textarea, :root.theme-sakura select { border-radius: var(--r-md); }

.form-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 28px; overflow: hidden; transition: all .4s var(--smooth); box-shadow: var(--shadow-sm); }
:root.theme-void .form-box { background: var(--glass); backdrop-filter: blur(20px); }
.form-box-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; cursor: pointer; user-select: none; }
.form-box-header h3 { font-size: 1.05em; color: var(--primary); }
.form-box .toggle-icon { transition: transform .4s var(--spring); color: var(--muted); }
.form-box .form-body { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .5s var(--smooth), opacity .4s, padding .4s; padding: 0 24px; }
.form-box.open .form-body { max-height: 800px; opacity: 1; padding: 0 24px 24px; }
.form-box.open .toggle-icon { transform: rotate(180deg); }

.glass-form { background: var(--glass); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 40px; box-shadow: var(--shadow-lg); animation: popIn .6s var(--spring); }

/* ===================================================================
   7. AUTH (login / register)
   =================================================================== */
.auth-wrapper { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 22px; }
.auth-card { width: min(430px, 92vw); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-logo .brand-logo { width: 64px; height: 64px; }
.auth-title { font-size: 2em; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: .04em; }
.auth-sub { color: var(--muted); font-size: .95em; text-align: center; }
.auth-links { text-align: center; margin-top: 18px; color: var(--muted); font-size: .9em; }
.auth-links a { color: var(--primary); font-weight: 700; }
.auth-links a:hover { text-decoration: underline; }
.field-group { position: relative; margin-bottom: 18px; }
.field-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color .3s; }
.field-group input { padding-left: 44px; }
.field-group input:focus + i, .field-group:focus-within i { color: var(--primary); }
:root.theme-cinema .auth-title { letter-spacing: .3em; text-transform: uppercase; }

/* ===================================================================
   8. CARDS — médiathèque (manga-card / film-card) transformées/thème
   =================================================================== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 24px; align-items: stretch; }

.manga-card, .film-card, .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    overflow: hidden; display: flex; flex-direction: column; position: relative;
    transition: transform .45s var(--smooth), box-shadow .45s var(--smooth), border-color .45s;
    transform-style: preserve-3d; will-change: transform;
    box-shadow: var(--shadow-sm);
}
.manga-card:hover, .film-card:hover, .card:hover { transform: translateY(-8px); border-color: var(--border2); box-shadow: var(--shadow-md), var(--glow); }
.manga-img-wrapper, .film-img-wrapper, .card-img-wrapper { position: relative; width: 100%; padding-top: 145%; background: var(--bg2); overflow: hidden; }
.manga-img-wrapper img, .film-img-wrapper img, .card-img-wrapper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--smooth), filter .7s; }
.manga-card:hover .manga-img-wrapper img, .film-card:hover .film-img-wrapper img { transform: scale(1.08); }
.manga-img-wrapper::after, .film-img-wrapper::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55)); opacity: 0; transition: opacity .5s; pointer-events: none; }
.manga-card:hover .manga-img-wrapper::after, .film-card:hover .film-img-wrapper::after { opacity: 1; }
.manga-body, .film-body, .card-body { padding: 16px; display: flex; flex-direction: column; flex-grow: 1; gap: 0; }
.manga-title, .film-title, .card-title { font-size: 1.06em; margin: 0 0 6px; color: var(--text); text-align: center; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; min-height: 2.6em; }
.manga-desc, .film-desc, .desc-text { font-size: .85em; color: var(--muted); margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex-grow: 1; line-height: 1.55; }
.card-date { margin-top: 10px; font-size: .75em; color: var(--muted); text-align: center; opacity: .75; }

.btn-read, .btn-play { background: rgba(var(--primary-rgb), .85); color: #fff; text-align: center; padding: 10px; border-radius: var(--r-sm); font-weight: 700; display: block; transition: all .3s var(--spring); margin-bottom: 10px; }
.btn-read:hover, .btn-play:hover { background: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(var(--primary-rgb), .45); }
:root.theme-porcelain .btn-read, :root.theme-porcelain .btn-play { background: var(--primary); }
:root.theme-cinema .btn-read, :root.theme-cinema .btn-play { background: transparent; border: 1px solid var(--primary); color: var(--primary); border-radius: 0; text-transform: uppercase; letter-spacing: .12em; font-size: .8em; }
:root.theme-cinema .btn-read:hover, :root.theme-cinema .btn-play:hover { background: var(--primary); color: #0a0908; }

/* --- NOVA : tilt 3D + glare (le JS pilote --rx/--ry/--gx/--gy) ----- */
:root.theme-nova .manga-card, :root.theme-nova .film-card, :root.theme-nova .menu-tile {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
    transition: transform .18s ease-out, box-shadow .45s, border-color .45s;
}
:root.theme-nova .manga-card:hover, :root.theme-nova .film-card:hover { border-color: var(--primary); box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 30px rgba(var(--primary-rgb), .3); }
:root.theme-nova .manga-card::before, :root.theme-nova .film-card::before, :root.theme-nova .menu-tile::before {
    content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: radial-gradient(circle 320px at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.14), transparent 65%);
}
:root.theme-nova .manga-card:hover::before, :root.theme-nova .film-card:hover::before, :root.theme-nova .menu-tile:hover::before { opacity: 1; }
:root.theme-nova .manga-card:hover .manga-img-wrapper img, :root.theme-nova .film-card:hover .film-img-wrapper img { filter: saturate(1.25); }

/* --- CINEMA : affiches plein cadre, infos en overlay ---------------- */
:root.theme-cinema .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 34px; }
:root.theme-cinema .manga-card, :root.theme-cinema .film-card { border-radius: var(--r-sm); border-color: rgba(212,175,55,.12); }
:root.theme-cinema .manga-card:hover, :root.theme-cinema .film-card:hover { transform: scale(1.025); box-shadow: 0 26px 70px rgba(0,0,0,.75), var(--glow); }
:root.theme-cinema .manga-title, :root.theme-cinema .film-title { font-family: var(--font-display); font-size: 1.25em; }
:root.theme-cinema .manga-img-wrapper::after, :root.theme-cinema .film-img-wrapper::after { opacity: .55; background: linear-gradient(180deg, transparent 40%, rgba(10,9,8,.92)); }
:root.theme-cinema .manga-card:hover .manga-img-wrapper img, :root.theme-cinema .film-card:hover .film-img-wrapper img { transform: scale(1.05); filter: brightness(1.08) contrast(1.05); }

/* --- VOID : rangées de verre horizontales ---------------------------- */
:root.theme-void .grid { grid-template-columns: 1fr; gap: 16px; }
:root.theme-void .manga-card, :root.theme-void .film-card { flex-direction: row; background: var(--glass); backdrop-filter: blur(18px) saturate(140%); border-radius: var(--r-lg); min-height: 220px; }
:root.theme-void .manga-img-wrapper, :root.theme-void .film-img-wrapper { width: 150px; min-width: 150px; padding-top: 0; align-self: stretch; }
:root.theme-void .manga-body, :root.theme-void .film-body { padding: 20px 24px; }
:root.theme-void .manga-title, :root.theme-void .film-title { text-align: left; min-height: 0; }
:root.theme-void .manga-card:hover, :root.theme-void .film-card:hover { transform: translateX(8px); border-color: var(--border2); }
:root.theme-void .manga-card::after, :root.theme-void .film-card::after { content: ''; position: absolute; left: 0; top: 15%; bottom: 15%; width: 3px; border-radius: 3px; background: var(--grad); opacity: 0; transition: opacity .4s; }
:root.theme-void .manga-card:hover::after, :root.theme-void .film-card:hover::after { opacity: 1; }

/* --- PORCELAIN : vitrine produit épurée ------------------------------ */
:root.theme-porcelain .manga-card, :root.theme-porcelain .film-card { border: none; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
:root.theme-porcelain .manga-card:hover, :root.theme-porcelain .film-card:hover { transform: translateY(-6px) scale(1.015); box-shadow: var(--shadow-lg); }
:root.theme-porcelain .manga-img-wrapper::after, :root.theme-porcelain .film-img-wrapper::after { display: none; }

/* --- SAKURA : cartes coussin arrondies ------------------------------- */
:root.theme-sakura .grid { gap: 28px; }
:root.theme-sakura .manga-card, :root.theme-sakura .film-card { border-radius: var(--r-xl); border-width: 2px; }
:root.theme-sakura .manga-card:hover, :root.theme-sakura .film-card:hover { transform: translateY(-8px) rotate(-.6deg); }
:root.theme-sakura .manga-img-wrapper, :root.theme-sakura .film-img-wrapper { border-radius: calc(var(--r-xl) - 8px); margin: 8px; padding-top: 138%; width: auto; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(var(--primary-rgb), .14); color: var(--primary-light); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; }
.badge-fin { position: absolute; top: 10px; left: 10px; z-index: 10; background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; font-weight: 800; font-size: .72em; padding: 4px 11px; border-radius: 999px; letter-spacing: .06em; box-shadow: 0 2px 10px rgba(34,197,94,.5); text-transform: uppercase; }
.btn-fin { background: rgba(52,211,153,.12); color: var(--green); border: 1px solid rgba(52,211,153,.35); padding: 8px 10px; border-radius: var(--r-sm); font-size: .85em; font-weight: 700; text-align: center; transition: all .3s; display: block; margin-top: 8px; }
.btn-fin:hover { background: rgba(52,211,153,.28); }
.btn-fin.is-termine { background: rgba(251,113,133,.1); color: var(--red); border-color: rgba(251,113,133,.3); }
.btn-fin.is-termine:hover { background: rgba(251,113,133,.2); }

/* Partage */
.share-form { flex: 100%; margin: 0; display: flex; align-items: center; gap: 6px; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding-left: 10px; transition: border-color .3s; }
.share-form:focus-within { border-color: var(--primary); }
.share-form > i { color: var(--muted); font-size: .85em; }
.select-share { padding: 8px 10px 8px 5px; font-size: .85em; font-weight: 600; margin: 0; border: none; background: transparent; color: var(--text); outline: none; cursor: pointer; flex: 1; width: auto; box-shadow: none !important; }

/* ===================================================================
   9. ACCUEIL — 3 structures (cards / slider / accordéon) par thème
   =================================================================== */
.home-hero { text-align: center; margin: 44px 0 50px; }
.home-hero h1 { font-size: clamp(2em, 5vw, 3.2em); margin-bottom: 12px; display: flex; justify-content: center; align-items: center; font-weight: 800; }
.home-hero p { font-size: 1.15em; color: var(--muted); font-weight: 600; }
#typing-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cursor { color: var(--primary); animation: blink .8s infinite; margin-left: 2px; -webkit-text-fill-color: var(--primary); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
:root.theme-porcelain .home-hero h1 { letter-spacing: -.035em; }
:root.theme-cinema .home-hero h1 { letter-spacing: .05em; font-weight: 700; }

/* Trois conteneurs : le thème actif choisit sa structure */
.home-cards { display: block; }
.home-slider, .home-accordion { display: none; }
:root.theme-cinema .home-cards, :root.theme-cinema .home-hero { display: none; }
:root.theme-cinema .home-slider { display: block; }
:root.theme-sakura .home-cards { display: none; }
:root.theme-sakura .home-accordion { display: block; }

/* --- Structure 1 : grandes tuiles interactives (nova/void/porcelain) */
/* 4 sections → 4 colonnes sur grand écran, 2×2 sur tablette, 1 sur mobile.
   Évite la « 4ᵉ carte toute seule » des grilles auto-fit. */
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
@media (max-width: 1024px) and (min-width: 561px) {
    .menu-grid, :root.theme-porcelain .menu-grid { grid-template-columns: repeat(2, 1fr); }
}
.menu-tile {
    position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    min-height: 220px; padding: 34px 24px; text-align: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    font-weight: 800; font-size: 1.18em; color: var(--text); font-family: var(--font-display);
    transition: transform .45s var(--smooth), box-shadow .45s, border-color .45s;
    box-shadow: var(--shadow-sm);
}
.menu-tile:hover { transform: translateY(-10px); border-color: var(--border2); box-shadow: var(--shadow-md), var(--glow); }
.tile-icon { width: 74px; height: 74px; border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 1.8em; color: #fff; background: var(--grad); box-shadow: 0 10px 26px rgba(var(--primary-rgb), .4); transition: transform .45s var(--spring); }
.menu-tile:hover .tile-icon { transform: scale(1.12) rotate(-6deg); }
.menu-tile .tile-sub { font-size: .62em; font-weight: 600; color: var(--muted); font-family: var(--font-body); }
.menu-tile::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle 260px at var(--gx, 50%) var(--gy, 50%), rgba(var(--primary-rgb), .12), transparent 70%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.menu-tile:hover::after { opacity: 1; }
:root.theme-void .menu-grid { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; }
:root.theme-void .menu-tile { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 0; padding: 24px 30px; background: var(--glass); backdrop-filter: blur(18px); border-radius: var(--r-xl); }
:root.theme-void .menu-tile:hover { transform: translateX(10px) scale(1.01); }
:root.theme-void .tile-icon { width: 60px; height: 60px; font-size: 1.4em; }
:root.theme-porcelain .menu-grid { grid-template-columns: repeat(4, 1fr); }
:root.theme-porcelain .menu-tile { background: var(--surface); border: none; min-height: 280px; }
:root.theme-porcelain .menu-tile:hover { box-shadow: var(--shadow-lg); }

/* --- Structure 2 : slider cinématique plein écran (cinema) ---------- */
.home-slider { position: relative; }
.cine-slides { height: calc(100vh - 130px); min-height: 540px; position: relative; overflow: hidden; border: 1px solid var(--border); }
.cine-slide { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 60px; opacity: 0; visibility: hidden; transition: opacity 1s ease, visibility 1s; }
.cine-slide.active { opacity: 1; visibility: visible; }
.cine-slide-bg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; transform: scale(1.12); transition: transform 6s ease; filter: brightness(.5) saturate(.85); }
.cine-slide.active .cine-slide-bg { transform: scale(1); }
.cine-slide-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,9,8,.35), rgba(10,9,8,.88) 85%); }
.cine-slide-content { position: relative; z-index: 2; max-width: 640px; transform: translateY(30px); opacity: 0; transition: all .9s ease .35s; }
.cine-slide.active .cine-slide-content { transform: none; opacity: 1; }
.cine-kicker { color: var(--primary); text-transform: uppercase; letter-spacing: .4em; font-size: .75em; font-weight: 600; margin-bottom: 14px; }
.cine-slide-content h2 { font-size: clamp(2.2em, 5vw, 3.8em); font-weight: 700; line-height: 1.05; margin-bottom: 16px; }
.cine-slide-content p { color: var(--muted); font-size: 1.05em; line-height: 1.6; margin-bottom: 26px; max-width: 480px; }
.cine-dots { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; z-index: 5; }
.cine-dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--primary); background: transparent; transition: all .4s; cursor: pointer; padding: 0; }
.cine-dot.active { background: var(--primary); box-shadow: 0 0 12px rgba(212,175,55,.7); transform: scale(1.3); }
.cine-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--primary); z-index: 6; width: 0; }
.cine-slide.active ~ .cine-progress { animation: cineProgress 7s linear; }
@keyframes cineProgress { from { width: 0; } to { width: 100%; } }

/* --- Structure 3 : accordéon zen (sakura) ---------------------------- */
/* NB : pas de display ici — la visibilité est gérée par les règles de thème plus haut */
.home-accordion { max-width: 880px; margin: 0 auto; flex-direction: column; gap: 18px; }
:root.theme-sakura .home-accordion { display: flex; }
.acc-item { background: var(--surface); border: 2px solid var(--border); border-radius: var(--r-xl); overflow: hidden; transition: all .5s var(--smooth); box-shadow: var(--shadow-sm); }
.acc-item:hover { border-color: var(--border2); box-shadow: var(--shadow-md); }
.acc-head { display: flex; align-items: center; gap: 20px; padding: 26px 32px; cursor: pointer; user-select: none; }
.acc-head .tile-icon { width: 56px; height: 56px; font-size: 1.3em; border-radius: 18px; flex-shrink: 0; }
.acc-head h3 { font-size: 1.3em; font-weight: 700; flex-grow: 1; }
.acc-chev { color: var(--muted); transition: transform .5s var(--spring); }
.acc-body { max-height: 0; opacity: 0; transition: max-height .6s var(--smooth), opacity .5s, padding .5s; padding: 0 32px; }
.acc-item.open .acc-body { max-height: 320px; opacity: 1; padding: 0 32px 28px; }
.acc-item.open .acc-chev { transform: rotate(180deg); }
.acc-item.open { background: linear-gradient(135deg, rgba(var(--primary-rgb), .06), rgba(var(--accent-rgb), .06)); border-color: var(--border2); }
.acc-body p { color: var(--muted); line-height: 1.65; margin-bottom: 18px; font-weight: 500; }

.admin-section { text-align: center; }
.btn-admin { padding: 13px 30px; font-size: 1em; }

/* ===================================================================
   10. TOOLBAR / FILTRES / RECHERCHE
   =================================================================== */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar-info { color: var(--muted); font-size: .92em; }
.toolbar-info strong { color: var(--primary); font-size: 1.15em; }
.toolbar-controls { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 8px; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
:root.theme-void .toolbar-controls { background: var(--glass); backdrop-filter: blur(16px); }
.search-field, .sort-field { display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.search-field i, .sort-field i { color: var(--muted); font-size: .85em; }
.search-field input, .sort-field select { border: none; background: transparent; padding: 9px 4px; width: 190px; box-shadow: none !important; font-weight: 600; font-size: .9em; }
.sort-field select { width: auto; }
.toolbar-sep { width: 1px; height: 22px; background: var(--border2); }
.filter-bar, .filter-fin-bar { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.filter-btn, .filter-fin-btn { padding: 8px 18px; border-radius: 999px; border: 1px solid var(--border); background: rgba(var(--primary-rgb), .07); color: var(--primary-light); font-weight: 600; font-size: .85em; transition: all .25s var(--spring); cursor: pointer; }
.filter-btn:hover, .filter-fin-btn:hover { transform: translateY(-2px); border-color: var(--primary); }
.filter-btn.active, .filter-fin-btn.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(var(--primary-rgb), .4); }
:root.theme-cinema .filter-fin-btn, :root.theme-cinema .filter-btn { border-radius: 0; text-transform: uppercase; letter-spacing: .1em; font-size: .75em; }

/* ===================================================================
   11. MODALES / DROPDOWNS / TOASTS
   =================================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 9000; animation: fadeIn .3s; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 30px; max-width: 520px; width: 92vw; box-shadow: var(--shadow-lg); animation: popIn .45s var(--spring); }
:root.theme-void .modal-box { background: var(--glass); backdrop-filter: blur(28px); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.modal-input { margin-bottom: 14px; }
.modal-btn { padding: 10px 22px; }
.modal-preview { max-width: 100%; border-radius: var(--r-sm); margin: 12px 0; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state i { font-size: 3em; margin-bottom: 16px; opacity: .4; display: block; }

/* ===================================================================
   12. MESSAGES / CHAT
   =================================================================== */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; height: calc(100vh - 180px); min-height: 480px; }
.chat-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow-y: auto; padding: 12px; }
:root.theme-void .chat-sidebar, :root.theme-void .chat-main { background: var(--glass); backdrop-filter: blur(18px); }
.contact-list { display: flex; flex-direction: column; gap: 6px; }
.contact-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); cursor: pointer; transition: all .25s; border: 1px solid transparent; }
.contact-item:hover { background: rgba(var(--primary-rgb), .08); transform: translateX(4px); }
.contact-item.active { background: rgba(var(--primary-rgb), .14); border-color: var(--border); }
.contact-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border2); }
.chat-main { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: rgba(var(--primary-rgb), .04); }
.chat-messages { flex-grow: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.msg-wrapper { display: flex; flex-direction: column; max-width: 72%; animation: fadeUp .35s var(--smooth); }
.msg-me { align-self: flex-end; align-items: flex-end; }
.msg-other { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 11px 16px; border-radius: var(--r-lg); line-height: 1.45; font-size: .94em; word-break: break-word; }
.msg-me .msg-bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.msg-other .msg-bubble { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-date { font-size: .7em; color: var(--muted); margin: 4px 6px; }
.chat-input-area { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); align-items: center; }
.chat-input-field { flex-grow: 1; border-radius: 999px !important; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-online { background: var(--green); box-shadow: 0 0 8px rgba(52,211,153,.8); }
.status-offline { background: var(--muted); }
.status-text { font-size: .8em; color: var(--muted); }

/* ===================================================================
   13. PROFIL
   =================================================================== */
.profile-header { display: flex; align-items: center; gap: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.profile-big-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); box-shadow: var(--glow); }
.theme-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 10px 0 22px; padding: 16px; background: var(--input-bg); border-radius: var(--r-md); border: 1px solid var(--border); }
.theme-option { cursor: pointer; text-align: center; transition: all .3s var(--spring); padding: 14px 10px; border-radius: var(--r-md); border: 2px solid transparent; }
.theme-option:hover { background: rgba(var(--primary-rgb), .07); transform: translateY(-3px); }
.theme-option.active { border-color: var(--primary); background: rgba(var(--primary-rgb), .12); box-shadow: 0 6px 18px rgba(var(--primary-rgb), .25); }
.theme-preview { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 10px; border: 2px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: 1.1em; }
.theme-option span { font-size: .72em; font-weight: 800; text-transform: uppercase; color: var(--text); letter-spacing: .05em; }
.theme-option small { display: block; color: var(--muted); font-size: .68em; margin-top: 3px; }

/* ===================================================================
   14. READER (lecture manhwa) — habillage par thème
   =================================================================== */
.manhwa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.manhwa-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; transition: all .4s var(--smooth); position: relative; display: flex; flex-direction: column; }
.manhwa-card:hover { transform: translateY(-6px); border-color: var(--border2); box-shadow: var(--shadow-md), var(--glow); }
.manhwa-cover { position: relative; padding-top: 140%; background: var(--bg2); overflow: hidden; }
.manhwa-cover img, .lazy-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--smooth); }
.manhwa-card:hover .manhwa-cover img { transform: scale(1.07); }
.manhwa-info { padding: 12px; flex-grow: 1; display: flex; flex-direction: column; }
.manhwa-title-card { font-size: .95em; font-weight: 700; line-height: 1.3; }
.manhwa-meta, .manhwa-stats { font-size: .78em; color: var(--muted); }
:root.theme-void .manhwa-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
:root.theme-cinema .manhwa-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 28px; }

.manga-header { display: flex; gap: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 26px; margin-bottom: 26px; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
:root.theme-void .manga-header { background: var(--glass); backdrop-filter: blur(18px); }
.manga-header-cover { width: 200px; flex-shrink: 0; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-md); }
.manga-header-cover img { width: 100%; height: auto; }
.manga-header-info { flex-grow: 1; min-width: 260px; }
.manga-header-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.chapters-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.chapters-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.chapter-list { max-height: 480px; overflow-y: auto; }
.chapter-item { display: flex; justify-content: space-between; align-items: center; padding: 13px 22px; border-bottom: 1px solid var(--border); transition: all .25s; }
.chapter-item:hover { background: rgba(var(--primary-rgb), .07); padding-left: 28px; }
.chap-num { font-weight: 700; color: var(--primary-light); }
.chap-date, .chap-info { font-size: .8em; color: var(--muted); }
.btn-chap { padding: 7px 16px; border-radius: var(--r-sm); background: rgba(var(--primary-rgb), .12); color: var(--primary-light); border: 1px solid var(--border); font-weight: 700; font-size: .85em; transition: all .25s; }
.btn-chap:hover { background: var(--primary); color: #fff; }
.read-tag { font-size: .7em; background: rgba(52,211,153,.15); color: var(--green); padding: 3px 9px; border-radius: 999px; font-weight: 700; }

.reader-nav { position: sticky; top: 0; z-index: 800; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; background: var(--nav-bg); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.reader-wrap { max-width: 860px; margin: 0 auto; }
.reader-wrap img { width: 100%; height: auto; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9em; margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary-light); font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

.btn-fav { background: none; border: none; font-size: 1.3em; cursor: pointer; transition: transform .3s var(--spring); }
.btn-fav:hover { transform: scale(1.25); }
.fav-badge { position: absolute; top: 8px; right: 8px; z-index: 5; font-size: 1.1em; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.btn-order, .btn-read-action { padding: 8px 14px; border-radius: var(--r-sm); background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .85em; transition: all .25s; }
.btn-order:hover, .btn-read-action:hover { border-color: var(--primary); color: var(--primary); }
.cover-edit-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .3s; }
.cover-edit-btn { background: var(--grad); color: #fff; border: none; padding: 10px 18px; border-radius: 999px; font-weight: 700; }
.manga-header-cover:hover .cover-edit-overlay { opacity: 1; }
.lazy-cover-anim { animation: coverPulse 1.6s ease-in-out infinite; background: var(--surface2); }
@keyframes coverPulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.search-bar { margin-bottom: 20px; }
.search-empty { text-align: center; color: var(--muted); padding: 50px 0; }
.catalogue-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }

/* ===================================================================
   15. ADMIN
   =================================================================== */
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; margin-bottom: 26px; }
.admin-section-title { font-size: 1.15em; color: var(--primary); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.admin-table th { text-align: left; padding: 12px 14px; color: var(--muted); font-size: .8em; text-transform: uppercase; letter-spacing: .08em; border-bottom: 2px solid var(--border2); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.admin-table tr { transition: background .25s; }
.admin-table tbody tr:hover { background: rgba(var(--primary-rgb), .06); }

/* ===================================================================
   16. SWITCHER DE THÈME FLOTTANT (global)
   =================================================================== */
.theme-fab { position: fixed; bottom: 26px; left: 26px; z-index: 9500; }
.theme-fab-btn {
    width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border2);
    background: var(--grad); color: #fff; font-size: 1.25em;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md), var(--glow); transition: all .4s var(--spring);
}
.theme-fab-btn:hover { transform: scale(1.1) rotate(20deg); }
.theme-fab.open .theme-fab-btn { transform: rotate(140deg); }
.theme-fab-panel {
    position: absolute; bottom: 70px; left: 0; width: 250px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg); padding: 12px;
    opacity: 0; visibility: hidden; transform: translateY(14px) scale(.94); transform-origin: bottom left;
    transition: all .35s var(--spring);
    backdrop-filter: blur(24px);
}
:root.theme-void .theme-fab-panel { background: var(--glass); }
.theme-fab.open .theme-fab-panel { opacity: 1; visibility: visible; transform: none; }
.theme-fab-panel h4 { font-size: .8em; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 4px 8px 10px; }
.theme-chip { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid transparent; background: none; color: var(--text); font-weight: 700; font-size: .88em; transition: all .25s; text-align: left; font-family: var(--font-body); }
.theme-chip:hover { background: rgba(var(--primary-rgb), .1); transform: translateX(4px); }
.theme-chip.active { border-color: var(--primary); background: rgba(var(--primary-rgb), .14); }
.theme-chip-dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; border: 2px solid rgba(255,255,255,.25); }
.theme-chip small { display: block; font-weight: 500; color: var(--muted); font-size: .82em; }
.dot-nova { background: linear-gradient(135deg, #8b5cf6, #ec4899, #22d3ee); }
.dot-cinema { background: linear-gradient(135deg, #d4af37, #4a3a16); }
.dot-void { background: radial-gradient(circle at 30% 30%, #6d8dff, #0a0c20); }
.dot-porcelain { background: linear-gradient(135deg, #ffffff, #d9d9e0); }
.dot-sakura { background: linear-gradient(135deg, #e8a0b8, #9d8bdb); }

/* ===================================================================
   17. VIEW FILM (lecteur vidéo)
   =================================================================== */
.player-container { width: 100%; aspect-ratio: 16/9; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 30px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); background: #000; }
:root.theme-cinema .player-container { border-radius: 0; border-color: var(--border2); box-shadow: 0 0 0 1px var(--border), 0 30px 80px rgba(0,0,0,.8), var(--glow); }
.player-container iframe { width: 100%; height: 100%; border: none; }
.film-info-card { background: var(--surface); border-radius: var(--r-lg); padding: 28px; border: 1px solid var(--border); display: flex; gap: 28px; box-shadow: var(--shadow-sm); }
:root.theme-void .film-info-card { background: var(--glass); backdrop-filter: blur(18px); }
.film-poster { width: 210px; border-radius: var(--r-md); box-shadow: var(--shadow-md); flex-shrink: 0; object-fit: cover; }
.disclaimer-content { background: var(--surface); padding: 40px; border-radius: var(--r-lg); max-width: 500px; text-align: center; border: 1px solid var(--border2); box-shadow: var(--shadow-lg); animation: popIn .5s var(--spring); }
.disclaimer-content h2 { color: var(--primary); margin-bottom: 14px; }
.disclaimer-content p { color: var(--muted); line-height: 1.6; }

/* ===================================================================
   18. UTILITAIRES & DIVERS
   =================================================================== */
.d-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.m-icon { font-size: 2em; margin-bottom: 10px; display: block; }
.text-grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stars { color: var(--gold); text-shadow: 0 0 8px rgba(251,191,36,.45); }
.stars-empty { color: var(--muted); font-size: .8em; font-style: italic; }

/* Stagger : les enfants des grilles apparaissent en cascade (JS .in-view) */
.stagger > * { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--smooth), transform .6s var(--smooth); }
.stagger.in-view > * { opacity: 1; transform: none; }
.stagger.in-view > *:nth-child(1) { transition-delay: .03s; } .stagger.in-view > *:nth-child(2) { transition-delay: .08s; }
.stagger.in-view > *:nth-child(3) { transition-delay: .13s; } .stagger.in-view > *:nth-child(4) { transition-delay: .18s; }
.stagger.in-view > *:nth-child(5) { transition-delay: .23s; } .stagger.in-view > *:nth-child(6) { transition-delay: .28s; }
.stagger.in-view > *:nth-child(7) { transition-delay: .33s; } .stagger.in-view > *:nth-child(8) { transition-delay: .38s; }
.stagger.in-view > *:nth-child(n+9) { transition-delay: .44s; }

/* ===================================================================
   19. RESPONSIVE
   =================================================================== */
@media (max-width: 900px) {
    .nav { flex-wrap: wrap; padding: 12px 16px; }
    .nav-links { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
    .chat-layout { grid-template-columns: 1fr; height: auto; }
    .chat-sidebar { max-height: 220px; }
    :root.theme-void .nav { border-radius: var(--r-lg); }
    :root.theme-porcelain .nav { margin: 0 0 24px; padding: 12px 16px; }
    .cine-slide { padding: 30px 24px 70px; }
    .cine-dots { right: 16px; }
    :root.theme-void .manga-img-wrapper, :root.theme-void .film-img-wrapper { width: 110px; min-width: 110px; }
    .film-info-card { flex-direction: column; align-items: center; text-align: center; }
    .manga-header { flex-direction: column; align-items: center; text-align: center; }
    /* Désactive le stagger sur mobile : cards visibles immédiatement + images lazy chargées */
    .reveal, .stagger > * { opacity: 1 !important; transform: none !important; transition: none !important; }
}
@media (max-width: 560px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .menu-grid, :root.theme-porcelain .menu-grid { grid-template-columns: 1fr; }
    .theme-fab { bottom: 16px; left: 16px; }
    .search-field input { width: 130px; }
}

/* ===================================================================
   20. ACCESSIBILITÉ — réduction de mouvement
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .reveal, .stagger > * { opacity: 1 !important; transform: none !important; }
}
