/* ============================================
   app.css — MagikVid Pixel/Tetris Theme
   Thème arcade coloré, inspiré Tetris
   ============================================ */

/* --- Variables CSS --- */
:root {
    /* Couleurs Tetris (pièces) */
    --pixel-cyan:    #00E5FF;
    --pixel-magenta: #E040FB;
    --pixel-yellow:  #FFEA00;
    --pixel-green:   #00E676;
    --pixel-orange:  #FF9100;
    --pixel-blue:    #448AFF;
    --pixel-red:     #FF1744;

    /* Primary (magenta/violet) */
    --primary-50:  #FDE4FF;
    --primary-100: #F8B4FE;
    --primary-300: #E040FB;
    --primary-500: #D500F9;
    --primary-700: #AA00C7;
    --primary-900: #7B0091;

    /* Accent (cyan) */
    --accent-300: #4DD0E1;
    --accent-500: #00E5FF;
    --accent-700: #00B8D4;

    /* Surfaces (dark mode) */
    --bg-page:      #08080F;
    --bg-surface-1: #0E0E1A;
    --bg-surface-2: #151526;
    --bg-surface-3: #1C1C32;
    --text-primary:   #EEEEF2;
    --text-secondary: #9E9EB8;
    --text-muted:     #5E5E78;

    /* Sémantiques */
    --success: #00E676;
    --error:   #FF1744;
    --warning: #FFEA00;
    --info:    #448AFF;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light:  rgba(255, 255, 255, 0.10);
    --border-pixel:  rgba(224, 64, 251, 0.3);

    /* Layout */
    --sidebar-width: 220px;
    --nav-height: 60px;
    --max-width: 1280px;
    --gutter: 24px;
    --mobile-padding: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;

    /* Radius pixel (coins coupés, style bloc) */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

/* --- Light mode --- */
body.light-mode {
    --bg-page:      #F5F3FF;
    --bg-surface-1: #FFFFFF;
    --bg-surface-2: #F0ECFF;
    --bg-surface-3: #E8E2FF;
    --text-primary:   #1A1A2E;
    --text-secondary: #4A4A6A;
    --text-muted:     #8888A0;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-light:  rgba(0, 0, 0, 0.10);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    min-height: 100vh;
    /* Grille pixel subtile en fond */
    background-image:
        linear-gradient(rgba(224, 64, 251, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(224, 64, 251, 0.015) 1px, transparent 1px);
    background-size: 24px 24px;
}

a {
    color: var(--pixel-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--pixel-magenta);
    text-decoration: none;
}

img { max-width: 100%; height: auto; }

/* ============================================
   Typographie
   ============================================ */

h1, h2, h3, h4 {
    font-family: 'Chakra Petch', 'DM Sans', system-ui, sans-serif;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h1 { font-size: 36px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; font-weight: 600; }

.text-small { font-size: 13px; }
.text-micro { font-size: 11px; }
.text-mono  { font-family: 'Space Mono', 'JetBrains Mono', monospace; }
.text-pixel { font-family: 'Silkscreen', monospace; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* Gradient tetris sur texte */
.text-gradient {
    background: linear-gradient(90deg, var(--pixel-cyan), var(--pixel-magenta), var(--pixel-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Boutons (style pixel avec ombre décalée)
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Chakra Petch', 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 24px;
    height: 44px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pixel-magenta), var(--primary-500));
    color: #fff;
    box-shadow: 3px 3px 0 rgba(213, 0, 249, 0.3);
}
.btn-primary:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(213, 0, 249, 0.4);
    text-decoration: none;
    color: #fff;
}
.btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(213, 0, 249, 0.2);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--pixel-cyan);
    color: var(--pixel-cyan);
    box-shadow: 3px 3px 0 rgba(0, 229, 255, 0.15);
}
.btn-secondary:hover {
    background: rgba(0, 229, 255, 0.08);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(0, 229, 255, 0.2);
    text-decoration: none;
    color: var(--pixel-cyan);
}
.btn-secondary:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(0, 229, 255, 0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-danger {
    background: var(--pixel-red);
    color: #fff;
    box-shadow: 3px 3px 0 rgba(255, 23, 68, 0.3);
}
.btn-danger:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(255, 23, 68, 0.4);
    text-decoration: none;
    color: #fff;
}

.btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: 12px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   Cards (bordure latérale colorée)
   ============================================ */

.card {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
}

.card-hover:hover {
    border-color: var(--pixel-magenta);
    box-shadow: 0 0 20px rgba(224, 64, 251, 0.08);
    transition: all var(--transition-base);
}

/* Card avec accent coloré à gauche */
.card-accent-cyan    { border-left: 3px solid var(--pixel-cyan); }
.card-accent-magenta { border-left: 3px solid var(--pixel-magenta); }
.card-accent-yellow  { border-left: 3px solid var(--pixel-yellow); }
.card-accent-green   { border-left: 3px solid var(--pixel-green); }
.card-accent-orange  { border-left: 3px solid var(--pixel-orange); }
.card-accent-blue    { border-left: 3px solid var(--pixel-blue); }
.card-accent-red     { border-left: 3px solid var(--pixel-red); }

/* ============================================
   Inputs
   ============================================ */

.input {
    background: var(--bg-surface-2);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    height: 44px;
    padding: 0 16px;
    width: 100%;
    color: var(--text-primary);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.input:focus {
    border-color: var(--pixel-cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}
.input::placeholder {
    color: var(--text-muted);
}

textarea.input {
    height: auto;
    padding: 12px 16px;
    resize: vertical;
    line-height: 1.6;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239E9EB8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ============================================
   Badges (style bloc coloré)
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(224, 64, 251, 0.15);
    color: var(--pixel-magenta);
    border: 1px solid rgba(224, 64, 251, 0.3);
}
.badge-success {
    background: rgba(0, 230, 118, 0.12);
    color: var(--pixel-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.badge-error {
    background: rgba(255, 23, 68, 0.12);
    color: var(--pixel-red);
    border: 1px solid rgba(255, 23, 68, 0.3);
}
.badge-warning {
    background: rgba(255, 234, 0, 0.10);
    color: var(--pixel-yellow);
    border: 1px solid rgba(255, 234, 0, 0.25);
}
.badge-info {
    background: rgba(68, 138, 255, 0.12);
    color: var(--pixel-blue);
    border: 1px solid rgba(68, 138, 255, 0.3);
}
.badge-muted {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}
.badge-cyan {
    background: rgba(0, 229, 255, 0.12);
    color: var(--pixel-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
}
.badge-orange {
    background: rgba(255, 145, 0, 0.12);
    color: var(--pixel-orange);
    border: 1px solid rgba(255, 145, 0, 0.3);
}

/* ============================================
   Zone de drop (upload image)
   ============================================ */

.drop-zone {
    border: 2px dashed var(--pixel-cyan);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
    background: rgba(0, 229, 255, 0.02);
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--pixel-magenta);
    background: rgba(224, 64, 251, 0.04);
    box-shadow: 0 0 30px rgba(224, 64, 251, 0.08);
}

/* ============================================
   Barre de progression (blocs segmentés Tetris)
   ============================================ */

.progress-track {
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    height: 10px;
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--border-subtle);
}

.progress-fill {
    background: linear-gradient(90deg,
        var(--pixel-cyan) 0%,
        var(--pixel-blue) 25%,
        var(--pixel-magenta) 50%,
        var(--pixel-orange) 75%,
        var(--pixel-yellow) 100%
    );
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    height: 100%;
    transition: width 0.3s ease;
    animation: progressShift 3s linear infinite;
}
@keyframes progressShift {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ============================================
   Spinner de génération
   ============================================ */

.generation-spinner {
    animation: spin-slow 1.5s linear infinite;
}
@keyframes spin-slow {
    to { transform: rotate(360deg); }
}

/* ============================================
   Tables
   ============================================ */

.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th {
    text-align: left;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: var(--pixel-cyan);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-subtle);
}

table.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

table.data-table tr:hover td {
    background: rgba(224, 64, 251, 0.02);
}

/* ============================================
   Messages flash / alertes
   ============================================ */

.alert {
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 3px solid;
}
.alert-error {
    background: rgba(255, 23, 68, 0.08);
    border-left-color: var(--pixel-red);
    color: var(--pixel-red);
}
.alert-success {
    background: rgba(0, 230, 118, 0.08);
    border-left-color: var(--pixel-green);
    color: var(--pixel-green);
}
.alert-warning {
    background: rgba(255, 234, 0, 0.06);
    border-left-color: var(--pixel-yellow);
    color: var(--pixel-yellow);
}

/* ============================================
   Metric cards
   ============================================ */

.metric-card {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.metric-card .metric-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}
.metric-card .metric-label {
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Navigation (landing)
   ============================================ */

.nav-landing {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 var(--gutter);
    z-index: 100;
    background: transparent;
    transition: background var(--transition-base), border-color var(--transition-base);
}
.nav-landing.scrolled {
    background: rgba(8, 8, 15, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
}
body.light-mode .nav-landing.scrolled {
    background: rgba(245, 243, 255, 0.92);
}

.nav-logo {
    font-family: 'Silkscreen', monospace;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 2px;
}
.nav-logo .logo-magik { color: var(--pixel-magenta); }
.nav-logo .logo-vid { color: var(--pixel-cyan); }
.nav-logo:hover { text-decoration: none; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}
.nav-links a {
    color: var(--text-secondary);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-fast);
}
.nav-links a:hover {
    color: var(--pixel-cyan);
    text-decoration: none;
}

/* ============================================
   Navigation (app / dashboard)
   ============================================ */

.nav-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-surface-1);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 var(--gutter);
    z-index: 100;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface-1);
    border-right: 1px solid var(--border-subtle);
    padding: 16px 0;
    overflow-y: auto;
    z-index: 90;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 8px;
    color: var(--text-secondary);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sidebar-link:hover {
    background: rgba(0, 229, 255, 0.06);
    color: var(--pixel-cyan);
    text-decoration: none;
}
.sidebar-link.active {
    background: rgba(224, 64, 251, 0.10);
    color: var(--pixel-magenta);
    font-weight: 700;
    border-left: 3px solid var(--pixel-magenta);
    margin-left: 5px;
    padding-left: 13px;
}
.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}
.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-section {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 24px 16px 8px;
}

/* ============================================
   Layout principal (app)
   ============================================ */

.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--nav-height);
    padding: var(--gutter);
    min-height: calc(100vh - var(--nav-height));
}

/* ============================================
   Credits badge (nav) — style tetris bloc
   ============================================ */

.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 229, 255, 0.08);
    border: 2px solid rgba(0, 229, 255, 0.25);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--pixel-cyan);
    text-transform: uppercase;
}

/* ============================================
   Avatar dropdown
   ============================================ */

.avatar-dropdown {
    position: relative;
}

.avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.avatar-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.avatar-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-surface-3);
    border: 2px solid var(--pixel-magenta);
}

.avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--pixel-magenta), var(--pixel-cyan));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Silkscreen', monospace;
    font-size: 12px;
    font-weight: 400;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(224, 64, 251, 0.05);
    display: none;
    z-index: 200;
}
.dropdown-menu.open {
    display: block;
    animation: dropIn 0.15s ease;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.dropdown-item:hover {
    background: rgba(0, 229, 255, 0.06);
    color: var(--pixel-cyan);
    text-decoration: none;
}
.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

/* ============================================
   Theme toggle
   ============================================ */

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    background: rgba(255, 234, 0, 0.08);
    color: var(--pixel-yellow);
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background: var(--bg-surface-1);
    border-top: 1px solid var(--border-subtle);
    padding: 48px var(--gutter);
    position: relative;
}
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pixel-cyan), var(--pixel-magenta), var(--pixel-yellow), var(--pixel-green), var(--pixel-blue));
}

.footer a {
    color: var(--text-muted);
    font-size: 13px;
}
.footer a:hover {
    color: var(--pixel-cyan);
}

/* ============================================
   Animations d'entrée
   ============================================ */

body {
    animation: pageIn 0.3s ease;
}
@keyframes pageIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade-in au scroll */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Blocs Tetris décoratifs (fond animé)
   ============================================ */

.tetris-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.tetris-block {
    position: absolute;
    border-radius: 3px;
    opacity: 0.06;
    animation: tetrisFall linear infinite;
}

@keyframes tetrisFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 0.06; }
    90% { opacity: 0.06; }
    100% {
        transform: translateY(calc(100vh + 100px)) rotate(180deg);
        opacity: 0;
    }
}

/* ============================================
   Glow effects
   ============================================ */

.glow-cyan {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15), 0 0 60px rgba(0, 229, 255, 0.05);
}
.glow-magenta {
    box-shadow: 0 0 20px rgba(224, 64, 251, 0.15), 0 0 60px rgba(224, 64, 251, 0.05);
}
.glow-yellow {
    box-shadow: 0 0 20px rgba(255, 234, 0, 0.12), 0 0 60px rgba(255, 234, 0, 0.04);
}

/* ============================================
   Drop zone animation
   ============================================ */

.drop-zone.drag-over svg {
    animation: dropBounce 0.4s ease;
}
@keyframes dropBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* ============================================
   Sidebar overlay (mobile)
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 85;
}
.sidebar-overlay.open {
    display: block;
}

/* ============================================
   Toast notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 12px);
    right: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    max-width: 360px;
    border-left: 3px solid;
}
.toast-success {
    background: var(--bg-surface-1);
    border-left-color: var(--pixel-green);
    color: var(--pixel-green);
}
.toast-error {
    background: var(--bg-surface-1);
    border-left-color: var(--pixel-red);
    color: var(--pixel-red);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   Slider de durée
   ============================================ */

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--pixel-cyan), var(--pixel-magenta));
    cursor: pointer;
    border: 2px solid var(--bg-page);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.3), 2px 2px 0 rgba(0,0,0,0.3);
    transition: box-shadow var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.2), 2px 2px 0 rgba(0,0,0,0.3);
}
input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--pixel-cyan), var(--pixel-magenta));
    cursor: pointer;
    border: 2px solid var(--bg-page);
}

/* ============================================
   Pricing toggle
   ============================================ */

.pricing-toggle {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s;
}
.pricing-toggle.active {
    background: linear-gradient(135deg, var(--pixel-magenta), var(--primary-500));
    color: #fff;
    box-shadow: 2px 2px 0 rgba(213, 0, 249, 0.3);
}

/* ============================================
   FAQ
   ============================================ */

.faq-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
.faq-trigger:hover {
    background: rgba(0, 229, 255, 0.03);
}
.faq-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--pixel-cyan);
}
.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 20px;
}
.faq-item.open .faq-content {
    max-height: 200px;
    padding: 0 20px 16px;
}
.faq-content p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   Shimmer effect
   ============================================ */

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   Video card overlay
   ============================================ */

.card-hover:hover .video-overlay {
    display: flex !important;
}

/* ============================================
   Section colorée (séparateur tetris)
   ============================================ */

.section-divider {
    height: 4px;
    background: linear-gradient(90deg,
        var(--pixel-cyan) 0%, var(--pixel-cyan) 14%,
        var(--pixel-blue) 14%, var(--pixel-blue) 28%,
        var(--pixel-magenta) 28%, var(--pixel-magenta) 42%,
        var(--pixel-red) 42%, var(--pixel-red) 56%,
        var(--pixel-orange) 56%, var(--pixel-orange) 70%,
        var(--pixel-yellow) 70%, var(--pixel-yellow) 84%,
        var(--pixel-green) 84%, var(--pixel-green) 100%
    );
}

/* ============================================
   Gallery / Showcase vidéo
   ============================================ */

.showcase-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
    cursor: pointer;
}
.showcase-card:hover {
    border-color: var(--pixel-magenta);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(224, 64, 251, 0.12);
}
.showcase-card .showcase-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.showcase-card .showcase-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 15, 0.4);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.showcase-card:hover .showcase-play {
    opacity: 1;
}
.showcase-card .showcase-info {
    padding: 12px 16px;
}

/* ============================================
   Responsive — Breakpoints complets
   ============================================ */

/* Desktop (<=1024px) */
@media (max-width: 1024px) {
    :root {
        --gutter: 20px;
    }
}

/* Tablet (<=768px) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 95;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
        padding: var(--mobile-padding);
    }
    .nav-links {
        display: none;
    }
    h1 { font-size: 28px; }
    h2 { font-size: 20px; }

    /* Generate page */
    #generate-layout {
        grid-template-columns: 1fr !important;
    }

    /* Pricing */
    #pricing-grid,
    #home-pricing-grid {
        grid-template-columns: 1fr !important;
    }

    /* Checkout */
    #checkout-grid {
        grid-template-columns: 1fr !important;
    }

    /* Billing metrics */
    #billing-metrics {
        grid-template-columns: 1fr !important;
    }

    /* Referral metrics */
    #referral-metrics {
        grid-template-columns: 1fr !important;
    }

    /* Admin metrics */
    #admin-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    #admin-tables {
        grid-template-columns: 1fr !important;
    }

    /* User detail grid */
    #user-detail-grid {
        grid-template-columns: 1fr !important;
    }

    /* Features */
    #features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Demo */
    #demo-grid {
        grid-template-columns: 1fr !important;
    }
    #demo-grid > div:nth-child(2) {
        transform: rotate(90deg);
    }

    /* Showcase */
    #showcase-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Tables: horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Credits badge: cache le texte */
    .credits-badge span:not(:first-child) {
        display: none;
    }

    /* Avatar: cache le nom */
    .avatar-btn > span {
        display: none;
    }

    /* Footer */
    .footer > div {
        flex-direction: column !important;
        text-align: center !important;
    }
}

/* Mobile (<=640px) */
@media (max-width: 640px) {
    :root {
        --mobile-padding: 12px;
        --nav-height: 56px;
    }

    h1 { font-size: 24px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }

    .btn { height: 40px; padding: 0 16px; font-size: 12px; }
    .btn-sm { height: 30px; padding: 0 12px; font-size: 11px; }

    .card { padding: 16px; }
    .metric-card { padding: 16px; }
    .metric-card .metric-value { font-size: 22px; }

    #admin-metrics {
        grid-template-columns: 1fr !important;
    }

    #showcase-grid {
        grid-template-columns: 1fr !important;
    }

    /* Pricing card featured: reset scale */
    .pricing-card-featured {
        transform: none !important;
    }

    /* Full-width modals on mobile */
    [id$="-modal"] > .card {
        margin: 16px;
        max-width: none !important;
    }

    /* Generate input cols */
    #generate-input-cols {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   Modal animation
   ============================================ */

[id$="-modal"] > .card,
[id$="-modal"] > div > .card {
    animation: modalIn 0.2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
