/* ===================================================
   SAFTI PRO - CSS V6.3 (THEME SAFTI CORRIGÉ)
=================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
    /* COULEURS SAFTI OFFICIELLES */
    --safti-orange: #FF6B35;
    --safti-blue: #00234B;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-input: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-hover: rgba(15, 23, 42, 0.05); /* Ajouté pour la compatibilité */
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-inverted: #ffffff;
    --text-light: #94a3b8; /* Ajouté */

    --border-color: #e2e8f0;
    
    /* Variables sémantiques */
    --primary: #0f172a;       /* Bleu nuit pour le texte fort */
    --primary-color: #0f172a; /* Alias de compatibilité */
    --accent: #FF6B35;        /* Orange SAFTI pour les actions */
    --accent-glow: rgba(255, 107, 53, 0.15);
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b; /* Ajouté */
    --info: #3b82f6; /* Ajouté */
    
    --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-ui: 'Inter', sans-serif;
    --font-display: 'Playfair Display', serif;
}

/* DARK MODE OPTIMISÉ */
body.dark-mode {
    --bg-body: #020617;
    --bg-card: #0f172a;      /* Carte fond bleu très sombre */
    --bg-sidebar: #000000;
    --bg-input: #1e293b;
    --bg-secondary: #1e293b;
    
    --text-main: #f1f5f9;    /* Texte blanc */
    --text-muted: #94a3b8;
    
    --border-color: #1e293b;
    
    --primary: #ffffff;      /* Le texte principal devient blanc */
    --primary-color: #ffffff; /* Alias de compatibilité */
    --accent: #FF6B35;       /* L'orange reste vibrant */
    --accent-glow: rgba(255, 107, 53, 0.2);
}

/* --- 2. RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 5px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* --- 3. ANIMATIONS --- */
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes safti-shimmer { 100% { transform: translateX(100%); } }

/* --- CORRECTIF FINAL ANTI-CASES BLANCHES --- */

/* 1. On définit la classe badge-secondary qui nous servira dans le JS */
.badge-secondary {
    background-color: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* 2. Override global pour intercepter les styles JS restants */
body.dark-mode [style*="background:#f1f5f9"], 
body.dark-mode [style*="background: #f1f5f9"],
body.dark-mode [style*="background: rgb(241, 245, 249)"],
body.dark-mode .card [style*="background:#ffffff"] {
    background-color: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

/* 3. Correction spécifique pour les conteneurs de boutons dans les dossiers */
body.dark-mode .btn-group, 
body.dark-mode [style*="background:#f8fafc"] {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
}

/* 4. Amélioration du contraste des textes dans les zones corrigées */
body.dark-mode .badge-secondary i,
body.dark-mode [style*="background:#f1f5f9"] i {
    color: var(--accent) !important;
}

/* --- 24. HEADER ELITE & ACTIONS (V4.2) --- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Boutons icônes ronds du header */
.btn-icon-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s var(--ease-bounce);
}

.btn-icon-header:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Point de notification rouge */
.notif-dot {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.relative { position: relative; }

/* Séparateur vertical */
.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 5px;
}

/* Pilule Profil Utilisateur */
.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-hover); /* Fond léger */
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.user-profile-pill:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #b45309 100%);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Menu Déroulant (Dropdown) */
.user-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none; /* Caché par défaut */
    flex-direction: column;
    gap: 5px;
    z-index: 1000;
    animation: slideInDown 0.2s ease-out;
}

.user-dropdown.show {
    display: flex;
}

.user-dropdown a {
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    cursor: pointer;
}

.user-dropdown a:hover {
    background: var(--bg-hover);
}

/* Ajustements Mobile */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .user-profile-pill { padding: 0; border: none; background: transparent; }
    .header-divider { display: none; }
    
    /* Correction de la corruption du code précédent */
    .user-dropdown { right: 10px; }
}

/* --- 25. THEME SWITCH ELITE (V4.3) --- */

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-right: 5px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Le fond du switch (Rail) */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; /* Gris clair par défaut (Jour) */
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    overflow: hidden;
}

/* Le rond qui bouge (Knob) */
.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Effet rebond */
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 2;
}

/* Icônes fixes dans le rail */
.icon-sun { color: #d97706; font-size: 14px; z-index: 1; transition: 0.3s; opacity: 1; }
.icon-moon { color: #94a3b8; font-size: 14px; z-index: 1; transition: 0.3s; opacity: 0.5; }

/* --- ÉTAT ACTIVÉ (DARK MODE) --- */
/* Fond bleu nuit quand actif */
input:checked + .slider {
    background-color: #0f172a;
    border-color: #334155;
}

/* Déplacement du rond vers la droite */
input:checked + .slider:before {
    transform: translateX(28px);
    background-color: var(--accent); /* Le rond devient Or */
}

/* Gestion de l'opacité des icônes */
input:checked + .slider .icon-sun { opacity: 0.5; color: #64748b; }
input:checked + .slider .icon-moon { opacity: 1; color: #f8fafc; }

/* Effet Hover */
.theme-switch:hover .slider:before {
    transform: scale(1.1);
}
input:checked + .slider:hover:before {
    transform: translateX(28px) scale(1.1);
}

/* Correction Input Range (Slider) qui était cassé */
input[type=range] {
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px; 
    box-shadow: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px; width: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Dark Mode ajustements pour les sliders */
body.dark-mode input[type=range]::-webkit-slider-runnable-track {
    background: #1e293b;
}

/* --- 26. MOBILE ULTIMATE & RESPONSIVE GRID (V4.4) --- */

/* Grilles Réactives (Manquantes pour les Skeletons) */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }

/* BOUTON FLOTTANT (+) CORRECTIF */
.fab-btn {
    position: fixed;
    bottom: 90px; /* Au-dessus du menu du bas */
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--safti-orange) 0%, #c2410c 100%);
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    display: flex; /* Force l'affichage */
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    z-index: 9990; /* Au-dessus de tout sauf modal */
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.fab-btn:active {
    transform: scale(0.95);
}

/* Sur PC, on le cache souvent, mais si tu le veux partout : */
@media (min-width: 769px) {
    .fab-btn { bottom: 30px; right: 30px; }
}

/* Ajustements Header Mobile */
@media (max-width: 768px) {
    .btn-icon-header { width: 35px; height: 35px; font-size: 1rem; }
    /* Ajustement Avatar */
    .avatar-circle { width: 28px; height: 28px; font-size: 0.8rem; }
    .user-profile-pill i { display: none; } /* Cache la flèche */
}

/* 3. OPTIMISATION STUDIO SOCIAL */
.studio-controls {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px;
    align-items: start;
}

@media (max-width: 768px) {
    .studio-controls { grid-template-columns: 1fr; gap: 10px; }
}

.control-box {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Respecter les préférences d'animation utilisateur */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- 4. ACCESSIBILITÉ --- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* --- 5. LAYOUT & SIDEBAR (Desktop) --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

@media (min-width: 769px) {
    .app-container {
        display: grid;
        grid-template-columns: 280px 1fr;
    }
    
    #sidebar {
        background: var(--bg-sidebar);
        padding: 2.5rem 1.5rem;
        display: flex;
        flex-direction: column;
        color: white;
        border-right: 1px solid var(--border-color);
        position: relative;
        overflow-y: auto;
    }

    .sidebar-header h3 {
        font-family: var(--font-display);
        font-size: 1.8rem;
        font-weight: 700;
        margin-bottom: 3rem;
        letter-spacing: 0.02em;
        background: linear-gradient(to right, #fff, #cbd5e1);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .nav-links {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        flex: 1;
    }
    
    .nav-link {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 12px 16px;
        color: #94a3b8;
        text-decoration: none;
        border-radius: var(--radius-md);
        font-weight: 500;
        transition: all var(--transition-fast);
        border: 1px solid transparent;
        cursor: pointer;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-inverted);
        transform: translateX(5px);
    }

    .nav-link.active {
        background: var(--accent-glow);
        color: var(--accent);
        border: 1px solid rgba(217, 119, 6, 0.3);
        box-shadow: inset 0 0 0 1px var(--accent);
    }

    .nav-link i {
        width: 24px;
        text-align: center;
        font-size: 1.2rem;
    }

    .mt-auto {
        margin-top: auto;
    }
}

/* --- 6. MAIN CONTENT --- */
#main-content {
    position: relative;
    height: 100vh;
    overflow-y: auto;
}

.top-header {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.2rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-main);
}

.content-wrapper {
    padding: 2rem;
    padding-bottom: 120px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper > * {
    animation: slideInUp 0.4s var(--ease-smooth) forwards;
}

/* --- 7. CARDS --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-float);
    border-color: var(--accent);
}

.card.elevated {
    box-shadow: var(--shadow-lg);
}

.card.outlined {
    box-shadow: none;
    border: 2px solid var(--border-color);
}

/* --- 8. TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 1rem;
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    color: var(--text-main);
    margin-bottom: 1rem;
}

.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-gold { color: var(--accent); }
.text-navy { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

/* --- 9. FORMS & INPUTS --- */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

label.required::after {
    content: ' *';
    color: var(--danger);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 0.5rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

/* DARK MODE: Inputs plus visibles */
body.dark-mode input:not([type="checkbox"]):not([type="radio"]),
body.dark-mode select,
body.dark-mode textarea {
    background-color: #0f172a !important; /* Plus sombre que la card pour le contraste */
    color: #f1f5f9 !important;
    border: 1.5px solid #FF6B35 !important; /* Bordure ORANGE pour bien les voir */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3) !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #cbd5e1 !important;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: #FF6B35 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 0 3px rgba(255, 107, 53, 0.2) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02), 0 0 0 3px var(--accent-glow);
    background: var(--bg-input);
}

/* Input States */
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-hover);
    color: var(--text-muted);
}

input:read-only {
    border-color: transparent;
    background: var(--bg-hover);
    cursor: default;
}

input.error {
    border-color: var(--danger);
    background: var(--danger-light);
}

input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

input.success {
    border-color: var(--success);
    background: var(--success-light);
}

input.success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.input-helper {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: -0.25rem;
    margin-bottom: 1rem;
    display: block;
}

.input-helper.error { color: var(--danger); }
.input-helper.success { color: var(--success); }

/* --- 10. BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-ui);
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Sizes */
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    left: 50%;
    top: 50%;
    margin: -8px 0 0 -8px;
}

/* Primary Button */
.btn-primary {
    background: #0f172a;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #1a243a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

body.dark-mode .btn-primary {
    background: var(--accent);
    color: #0f172a;
}

body.dark-mode .btn-primary:hover {
    background: #fbbf24;
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.2);
}

/* Secondary Button */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* Tertiary Button */
.btn-tertiary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-tertiary:hover {
    background: var(--accent);
    color: white;
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-ghost:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

/* Success Button */
.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Danger Button */
.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* --- 11. BADGES --- */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-primary { background: var(--info-light); color: var(--info); border-color: rgba(59, 130, 246, 0.2); }
.badge-success { background: var(--success-light); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.badge-warning { background: var(--warning-light); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-gold { background: var(--accent-glow); color: var(--accent); border-color: rgba(217, 119, 6, 0.3); }

.badge-dot { display: inline-flex; align-items: center; gap: 0.5rem; }
.badge-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* --- 12. TABLES --- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-color);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tbody tr:hover { background: var(--accent-glow); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--bg-hover); }

/* --- 13. MODALS & DIALOGS --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn 0.2s var(--ease-smooth);
}

.modal {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 2rem;
    box-shadow: var(--shadow-lg); max-width: 500px; width: 90%;
    animation: scaleIn 0.3s var(--ease-smooth); max-height: 90vh; overflow-y: auto;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color);
}

.modal-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-main); }

.modal-close {
    background: transparent; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--text-muted); transition: color var(--transition-fast);
    padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text-main); }

.modal-body { margin-bottom: 1.5rem; }
.modal-footer { display: flex; gap: 1rem; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--border-color); }

/* --- 14. TOASTS & NOTIFICATIONS --- */
.toast-container {
    position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column;
    gap: 12px; z-index: 10000; max-width: 400px; pointer-events: none;
}

.toast {
    background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--accent);
    border-radius: var(--radius-md); padding: 1rem; box-shadow: var(--shadow-float);
    animation: slideInUp 0.3s var(--ease-smooth); display: flex; align-items: flex-start; gap: 12px; pointer-events: auto;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-main); margin-bottom: 0.25rem; }
.toast-message { font-size: 0.9rem; color: var(--text-muted); }
.toast-close { flex-shrink: 0; background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 1.2rem; }

/* --- 15. TOOLTIPS --- */
.tooltip { position: relative; }
.tooltip::after {
    content: attr(data-tooltip); position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: var(--text-main); color: white; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
    font-size: 0.8rem; white-space: nowrap; z-index: 999; opacity: 0; pointer-events: none; transition: opacity var(--transition-fast);
}
.tooltip::before {
    content: ''; position: absolute; bottom: 108%; left: 50%; transform: translateX(-50%); width: 0; height: 0;
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid var(--text-main);
    z-index: 999; opacity: 0; pointer-events: none; transition: opacity var(--transition-fast);
}
.tooltip:hover::after, .tooltip:hover::before { opacity: 1; }

/* --- 16. SKELETON LOADERS --- */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-hover) 50%, var(--border-color) 75%);
    background-size: 1000px 100%; animation: shimmer 2s infinite; border-radius: var(--radius-md); height: 20px;
}
.skeleton.text { height: 16px; margin-bottom: 8px; }
.skeleton.card { height: 200px; }
.skeleton.avatar { width: 40px; height: 40px; border-radius: 50%; }

/* --- 17. UTILITIES --- */
/* Spacing */
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; } .gap-4 { gap: 2rem; }

/* Flex utilities */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }

/* --- 18. MOBILE "ELITE" NAVIGATION (SCROLLABLE BAR) --- */
@media (max-width: 768px) {
    
    /* 1. HEADER & LAYOUT */
    .mobile-menu-btn { display: none !important; } /* Plus besoin de burger */
    
    .top-header {
        padding: 10px 15px;
    }

    #page-title {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    /* 2. BARRE DE NAVIGATION BASSE (SCROLLABLE) */
    #sidebar {
        position: fixed;
        bottom: 0; left: 0; right: 0; top: auto;
        width: 100%; height: auto;
        background: var(--bg-card); /* Fond adapté au thème */
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 8px 0;
        z-index: 9900; /* Juste en dessous des modales */
        transform: none !important; /* Toujours visible */
        display: flex !important;
        flex-direction: row;
        align-items: center;
        overflow-x: auto; /* SCROLL HORIZONTAL */
        white-space: nowrap;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        -webkit-overflow-scrolling: touch; /* Fluidité iOS */
        transition: none;
    }

    /* Masquer le logo et header du sidebar */
    .sidebar-header { display: none !important; }

    /* Conteneur des liens */
    .nav-links {
        display: flex;
        flex-direction: row;
        gap: 10px;
        width: auto;
        margin: 0; padding: 0 15px; /* Padding horizontal pour le scroll */
    }

    /* Style des liens (Icône + Texte) */
    .nav-link {
        flex: 0 0 auto; /* EMPÊCHE LA COMPRESSION */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 12px;
        border-radius: 12px;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-align: center;
        min-width: 75px; /* Largeur min pour toucher facile */
        background: transparent;
        border: 1px solid transparent;
    }

    .nav-link i {
        font-size: 1.3rem;
        margin-right: 0;
        margin-bottom: 4px;
        width: auto;
    }

    .nav-link.active {
        background: var(--accent-glow);
        color: var(--accent);
        border-color: rgba(255, 107, 53, 0.2);
    }

    /* Cacher la scrollbar mais garder le scroll */
    #sidebar::-webkit-scrollbar { display: none; }

    /* 3. CONTENU PRINCIPAL */
    .content-wrapper {
        padding: 15px;
        padding-bottom: 100px !important; /* Espace pour la barre */
    }
    
    .mt-auto { display: none; }

    /* 4. TABLES MOBILE (Restauré) */
    .results-table { border-collapse: separate; border-spacing: 0; }
    .results-table thead { display: none; }
    .results-table tr { display: block; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; background: var(--bg-card); }
    .results-table td {
        display: flex; justify-content: space-between; padding: 8px 0;
        border-bottom: 1px solid var(--border-color); font-size: 0.9rem;
    }
    .results-table td:last-child { border-bottom: none; }
    .results-table td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); flex: 1; }
    
    h1 { font-size: 100%; }
    .toast { font-size: 0.85rem; }
}

@media print {
    .btn, .toast-container { display: none !important; }
    body { background: white; }
    .card { break-inside: avoid; }
}

/* Grilles & Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; gap: 1rem; } }
@media (min-width: 769px) { .layout-sidebar { grid-template-columns: 1fr; } }

.btn-group { display: flex; gap: 5px; }
.btn-icon { border: none; background: var(--bg-body); cursor: pointer; padding: 8px; border-radius: 6px; color: var(--text-main); }
.btn-icon:hover { background: var(--border-color); }
.btn-icon.pdf i { color: var(--accent); }
.btn-icon.trash i { color: #ef4444; }

/* Checkbox & Listes */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 10px; }
.checkbox-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 0.9rem; color: var(--text-main); }
.checklist-item { display: block; }

/* Mobile Menu Button */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text-main); cursor: pointer; padding: 5px; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) { 
    .mobile-menu-btn { display: block; } 
    .sidebar-overlay { display: none; } /* Correction de la corruption */
}

/* Documents & Galerie */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; radius: 8px; text-align: center; }
.doc-img { width: 100%; max-height: 60vh; min-height: 500px; border-radius: 16px; box-shadow: var(--shadow-card); border: 1px solid var(--border-color); z-index: 1; position: relative; }
.map-floating-btn { 
    position: absolute; 
    z-index: 1000; 
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--accent);
    padding: 12px 20px; 
    border-radius: 50px; 
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.25);
    cursor: pointer; 
    transition: all 0.3s var(--ease-smooth);
    display: flex; 
    align-items: center; 
    gap: 10px; 
    color: var(--accent);
}

.map-floating-btn:hover { 
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.35);
    background: linear-gradient(135deg, var(--accent) 0%, #e85a20 100%);
    color: white;
}

.map-floating-btn i { 
    font-size: 1.1rem; 
}

/* Positionner le bouton REFRESH en bas à gauche - PETITE VERSION */
.map-floating-btn.refresh { 
    top: auto; 
    right: auto;
    bottom: 120px; 
    left: 15px; 
    padding: 10px 16px;  /* Plus petit */
    font-size: 0.85rem;  /* Plus petit */
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    color: white;
}

.map-floating-btn.refresh:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.35);
    color: white;
}

.map-floating-btn.refresh i {
    animation: spin 2s linear infinite;
    animation-play-state: paused;
}

.map-floating-btn.refresh:hover i {
    animation-play-state: running;
}

/* Positionner le bouton COMPASS en bas à gauche */
.map-floating-btn.compass { 
    bottom: 25px; 
    left: 15px; 
    width: 52px; 
    height: 52px; 
    padding: 0; 
    justify-content: center; 
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #e85a20 100%);
    border-color: transparent;
    color: white;
}

.map-floating-btn.compass:hover {
    transform: scale(1.1) rotate(45deg);
    background: linear-gradient(135deg, #e85a20 0%, #d94810 100%);
}

/* Conteneur des boutons de la carte (en bas à gauche, stack vertical) */
.map-buttons-container {
    position: absolute;
    bottom: 25px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.map-search-container {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    z-index: 999;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.map-search-container input {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.map-search-container input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.map-search-container select {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--text-main);
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Boutons d'action de la carte */
.map-action-buttons {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90%;
}

.map-action-buttons .btn {
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid transparent;
    transition: all 0.3s var(--ease-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.map-action-buttons .btn-orange {
    background: linear-gradient(135deg, var(--accent) 0%, #e85a20 100%);
    color: white;
    border-color: var(--accent);
}

.map-action-buttons .btn-orange:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(255, 107, 53, 0.35);
    background: linear-gradient(135deg, #e85a20 0%, #d94810 100%);
}

.map-action-buttons .btn-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
}

.map-action-buttons .btn-green:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.35);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.map-action-buttons .btn-dark {
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border-color);
}

.map-action-buttons .btn-dark:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 10px 28px rgba(255, 107, 53, 0.2);
    color: var(--accent);
}

/* Map container style */
#map-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
}

/* Leaflet controls */
.leaflet-control-layers {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    background: var(--bg-card) !important;
}

.leaflet-control-layers-list label {
    color: var(--text-main) !important;
}

.leaflet-control-layers-toggle {
    background-color: var(--accent) !important;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25) !important;
}

/* Tableaux de résultats (DPE/DVF) */
.results-table-container { max-height: 70vh; font-size: 0.85rem; }
.results-table thead { background: var(--bg-hover); color: var(--accent); padding: 8px 12px; font-weight: 700; border-left: 4px solid var(--accent); margin: 20px 0 10px 0; font-size: 0.85rem; text-transform: uppercase; }
body.dark-mode .form-section-title { background: rgba(225, 29, 72, 0.15); color: #fda4af; }
.piece-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dotted var(--border-color); }
.piece-row span { font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.p-surf { width: 100%; display: flex; gap: 15px; justify-content: center; margin-top: 30px; }
.choice-card { 
    border: 2px solid var(--border-color); 
    padding: 30px 20px; 
    border-radius: 16px; 
    width: 160px; 
    text-align: center; 
    cursor: pointer; 
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    transition: all 0.3s var(--ease-smooth);
    font-weight: 700;
    color: var(--text-main);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.choice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.choice-card:hover::before {
    left: 100%;
}

.choice-card:hover { 
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent) 0%, #e85a20 100%);
    color: white;
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.35);
}

.choice-card i { 
    font-size: 2.5rem; 
    margin-bottom: 15px; 
    display: block;
    transition: all 0.3s var(--ease-smooth);
}

.choice-card:hover i {
    transform: scale(1.15) rotate(5deg);
}

.close-modal-btn { 
    position: absolute; 
    top: 15px; 
    right: 15px; 
    background: linear-gradient(135deg, var(--danger) 0%, #be123c 100%);
    color: white; 
    border: none; 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    font-size: 1.4rem; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s var(--ease-smooth);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.close-modal-btn:hover { 
    background: linear-gradient(135deg, #be123c 0%, #991b1b 100%);
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* Conteneur de la modale - à ajouter au script.js si manquant */
#project-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

#project-modal.visible {
    display: flex !important;
}

#project-modal .card {
    position: relative;
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a2332 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: slideUp 0.3s var(--ease-smooth);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#project-modal h3 {
    color: var(--text-main);
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 800;
}

.choice-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Améliorer les formulaires dans la modale */
#project-modal input,
#project-modal select,
#project-modal textarea {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

#project-modal input:focus,
#project-modal select:focus,
#project-modal textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.form-section-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    margin-top: 20px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}
.form-scrollable { padding-right: 5px; }
.form-footer-sticky { bottom: 0; position: sticky; z-index: 50; background: var(--bg-card); border-top: 1px solid var(--border-color); padding: 15px; margin: 0 -40px -40px -40px; }

/* --- 22. ULTRA-POLISH ELITE (V4.1) --- */
/* Bouton Primaire avec Dégradé Or SAFTI */
.btn-primary {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white; /* correction */
    position: relative;
    overflow: hidden;
}
body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Effet de brillance (Shine) au survol des boutons */
.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    left: 120%;
    pointer-events: none;
}
.btn-primary:hover::after { left: -50%; }

/* Dashboard Stat Cards Elite */
.stat-card {
    border: 1px solid var(--border-color);
    background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
    color: var(--accent);
    opacity: 1; /* correction opacity */
}

/* Mobile Navigation Haptic Feedback */
@media (max-width: 768px) {
    .nav-link:active {
        transform: scale(0.9) translateY(2px);
        transition: 0.1s;
    }
}

/* --- 23. SKELETONS SIGNATURE "SAFTI ELITE" --- */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    /* Une subtile lueur orange fixe pour délimiter */
    box-shadow: inset 0 0 0 1px var(--accent-glow);
}

.skeleton-line {
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
    /* Fond de base neutre */
    background-color: var(--bg-secondary);
}

.skeleton-line::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent 0%, var(--accent-glow) 50%, transparent 100%);
    animation: safti-shimmer 2s infinite ease-in-out;
}
.skeleton-line.text { height: 16px; width: 100%; }
.skeleton-line.text-short { height: 16px; width: 40%; }
.skeleton-line.image { height: 180px; width: 100%; border-radius: var(--radius-md); }

/* Ajustement spécifique pour le Dark Mode */
body.dark-mode .skeleton-line { background-color: rgba(15, 23, 42, 0.5); }

@keyframes safti-shimmer { 100% { transform: translateX(100%); } }

/* =========================================
   STUDIO SOCIAL - ELITE UI (V9.0)
========================================= */

/* Conteneur Principal (Layout Split) */
.studio-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    height: calc(100vh - 140px); /* Prend toute la hauteur dispo */
    min-height: 600px;
}

/* Zone de Prévisualisation (Gauche) */
.studio-preview-container {
    background-color: #0f172a; /* Toujours sombre pour faire ressortir l'image */
    background-image: 
        linear-gradient(45deg, #1e293b 25%, transparent 25%), 
        linear-gradient(-45deg, #1e293b 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #1e293b 75%), 
        linear-gradient(-45deg, transparent 75%, #1e293b 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Le Canvas (L'image générée) */
#social-canvas {
    max-width: 90%;
    max-height: 85%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 4px; /* Légèrement arrondi comme une photo */
    transition: transform 0.3s ease;
    display: none; /* Caché par défaut */
}

/* Placeholder (Zone de drop vide) */
.studio-placeholder {
    text-align: center;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: transform 0.2s;
}
.studio-placeholder:hover { transform: scale(1.05); color: white; }

.upload-circle {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
    color: var(--accent);
}

/* Sidebar de Contrôles (Droite) */
.studio-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 5px;
}

.control-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.panel-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: 8px;
}

/* Boutons Tags Premium */
.tag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag-btn {
    background: var(--bg-input); border: 1px solid var(--border-color);
    padding: 12px; border-radius: 10px; font-size: 0.85rem; font-weight: 600;
    color: var(--text-main); cursor: pointer; transition: all 0.2s;
}
.tag-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.tag-btn.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); }

/* Responsive */
@media (max-width: 1024px) {
    .studio-wrapper { grid-template-columns: 1fr; height: auto; }
    .studio-preview-container { height: auto; aspect-ratio: 1/1; max-height: 50vh; margin-bottom: 20px; }
    .studio-sidebar { padding-bottom: 100px; } /* Espace pour le scroll */
}

/* =========================================
   FIX BOUTON SWITCH (Studio Social)
========================================= */

/* Le conteneur du bouton */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;       /* Largeur fixe */
  height: 28px;      /* Hauteur fixe */
  margin-left: 10px;
}

/* On cache la case à cocher brute */
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

/* Le fond du switch (Rail) */
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

/* Le rond blanc (Knob) */
.switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* État activé (Orange SAFTI) */
.switch input:checked + .slider {
  background-color: var(--accent);
}

.switch input:focus + .slider {
  box-shadow: 0 0 1px var(--accent);
}

/* Mouvement du rond quand activé */
.switch input:checked + .slider:before {
  transform: translateX(22px);
}

/* =========================================
   CORRECTIF DARK MODE (CASES BLANCHES)
========================================= */

/* 1. Définition de la variable manquante (Gris clair / Gris foncé) */
:root {
    --bg-secondary: #f1f5f9; /* Gris très clair pour le mode jour */
}

body.dark-mode {
    --bg-secondary: #1e293b; /* Gris bleuté foncé pour le mode nuit */
}

/* 2. FORÇAGE DES ÉLÉMENTS JS "EN DUR" */

/* Si une div a un fond bleu clair (#e0e7ff) en mode sombre -> On la met en bleu nuit transparent */
body.dark-mode [style*="background:#e0e7ff"],
body.dark-mode [style*="background: #e0e7ff"] {
    background-color: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    color: #60a5fa !important; /* Texte bleu clair lisible */
}

/* Si une div a un fond vert clair (#d1fae5) en mode sombre -> On la met en vert nuit transparent */
body.dark-mode [style*="background:#d1fae5"],
body.dark-mode [style*="background: #d1fae5"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #34d399 !important; /* Texte vert clair lisible */
}

/* Si une div a un fond gris clair (#f9f9f9) dans les notes -> On la met en sombre */
body.dark-mode [style*="background:#f9f9f9"],
body.dark-mode [style*="background: #f9f9f9"] {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

/* Correction des icônes dans les entêtes (Maison/User) */
body.dark-mode [style*="background:#e0e7ff"] i,
body.dark-mode [style*="background:#d1fae5"] i {
    color: inherit !important; /* Prend la couleur du texte défini au dessus */
}

/* Correction Pop-up : Inputs et Textarea */
body.dark-mode input, 
body.dark-mode textarea, 
body.dark-mode select {
    background-color: var(--bg-input) !important;
    color: white !important;
    border-color: var(--border-color);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: rgba(255,255,255,0.5);
}

/* =========================================
   STUDIO CARTE DE VISITE V2 (NETTOYÉ)
========================================= */

.card-preview-container {
    background: #0f172a;
    padding: 50px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 450px;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

/* LA CARTE (Format standard 85x55mm) */
.business-card {
    width: 510px; height: 330px;
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    flex-shrink: 0;
}

.card-layout { display: flex; height: 100%; padding-bottom: 35px; position: relative; z-index: 2; }
.card-left-col { width: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; border-right: 1px solid rgba(0,0,0,0.05); }
.card-right-col { flex: 1; padding: 40px 30px; display: flex; flex-direction: column; justify-content: center; }

/* ÉLÉMENTS VISUELS */
.card-photo-zone { width: 100px; height: 100px; border-radius: 50%; overflow: hidden; border: 3px solid var(--safti-orange); margin-top: 15px; }
.card-photo-zone img { width: 100%; height: 100%; object-fit: cover; }
.card-logo img { max-width: 100px; max-height: 60px; object-fit: contain; }

/* TEXTES */
.agent-name { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 800; color: var(--safti-orange); margin: 0; line-height: 1.1; }
.agent-title { font-size: 0.8rem; color: #64748b; text-transform: uppercase; margin: 5px 0 20px 0; font-weight: 600; letter-spacing: 1px; }
.card-contact-lines { display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; }
.contact-line i { color: var(--safti-orange); width: 20px; text-align: center; margin-right: 8px; }

/* FOOTER */
.card-footer-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 35px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; background: #f1f5f9; color: #64748b; z-index: 3; }

/* STYLE MODERN (Bande Orange) */
.business-card.style-modern .card-bg-element { position: absolute; top: 0; bottom: 0; left: 0; width: 15px; background: var(--safti-orange); z-index: 1; }
.business-card.style-modern .card-layout { padding-left: 15px; }

/* STYLE CORPORATE (Bleu Nuit) */
.business-card.style-corporate { background: #00234B; color: white; }
.business-card.style-corporate .agent-name { color: white; }
.business-card.style-corporate .agent-title { color: var(--safti-orange); }
.business-card.style-corporate .card-footer-bar { background: #001a38; color: rgba(255,255,255,0.5); }

/* STYLE MINIMAL (Blanc Centré) */
.business-card.style-minimal { text-align: center; }
.business-card.style-minimal .card-layout { flex-direction: column; align-items: center; padding: 20px; }
.business-card.style-minimal .card-left-col { width: 100%; border: none; flex-direction: row; gap: 30px; margin-bottom: 10px; }
.business-card.style-minimal .card-right-col { padding: 0; align-items: center; }
.business-card.style-minimal .card-footer-bar { background: var(--safti-orange); color: white; }

/* =========================================
   OPTIMISATIONS MOBILE (TEL)
========================================= */

/* 1. Layout Split (Utilisé dans Cartes) */
.layout-split {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .layout-split { grid-template-columns: 1fr; gap: 20px; }
}

/* 2. Mise à l'échelle de la Carte de Visite sur Mobile */
@media (max-width: 640px) {
    .card-preview-container {
        padding: 10px;
        min-height: 280px;
        overflow: hidden;
        display: flex; align-items: center; justify-content: center;
    }
    .business-card {
        transform: scale(0.58); /* Réduit à 58% pour tenir sur un écran de 360px */
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    }
    /* Empêcher le zoom auto sur iOS */
    input, select, textarea { font-size: 16px !important; }
}

/* =========================================
   OPTIMISATIONS GLOBALES MOBILE (ALL PAGES)
========================================= */

/* Grille Checklist (Projets) */
.checklist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    /* Force les boutons d'action de la carte à s'empiler */
    .map-actions-row { grid-template-columns: 1fr !important; }
    
    /* Checklist en une seule colonne pour lisibilité */
    .checklist-grid { grid-template-columns: 1fr; }
    
    /* Input Pige pleine largeur */
    #pige-cp { width: 100% !important; max-width: 100% !important; }
}

/* =========================================
   VERSO DES CARTES (FIX LOGO & TEXTES)
   VERSO : FIX TAILLE LOGO HD & TEXTES
========================================= */

.business-card.verso { 
    display: none; /* Caché par défaut - le JS peut le surcharger */
    flex-direction: column !important;
    align-items: center !important; 
    justify-content: center !important; 
    text-align: center !important; 
    background-color: #FF6B35 !important; /* Orange SAFTI */
    color: white !important; 
    padding: 30px !important;
    box-sizing: border-box !important;
}

/* FIX LOGO HD : On force une taille pour éviter qu'il ne cache le reste */
.verso-logo {
    width: 130px !important; 
    height: auto !important;
    margin-bottom: 20px !important;
}

.verso-content { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
    width: 100%;
}

.verso-text h3 {
    line-height: 1.2;
    font-size: 1.2rem !important;
    margin: 0 !important;
    font-weight: 800 !important;
    text-transform: uppercase;
}

.verso-text p {
    font-size: 0.9rem !important;
    margin: 5px 0 !important;
}

.verso-big { 
    font-size: 1.6rem !important; 
    font-weight: 800 !important; 
    border: 2px solid white !important; 
    padding: 10px 25px !important; 
    margin-top: 15px !important; 
    display: inline-block !important;
    text-transform: uppercase;
}

.verso-footer { 
    position: absolute !important; 
    bottom: 20px !important; 
    width: 100%;
    font-weight: 600 !important; 
    font-size: 0.85rem !important; 
    opacity: 0.9;
}

/* --- OVERRIDES DE COULEURS --- */
.business-card.verso.style-corporate { background-color: #00234B !important; }
.business-card.verso.style-corporate .verso-big { border-color: #FF6B35 !important; }

.business-card.verso.style-minimal { 
    background-color: white !important; 
    color: #1e293b !important; 
    border: 1px solid #e2e8f0; 
}
.business-card.verso.style-minimal .verso-big { border-color: #FF6B35 !important; color: #FF6B35 !important; }
.business-card.verso.style-minimal .verso-logo { filter: none !important; }

/* Fix visibilité texte verso minimal */
.business-card.verso.style-minimal h3,
.business-card.verso.style-minimal p { color: #0f172a !important; }

/* --- FIX VISIBILITÉ EMAIL STYLE MINIMAL --- */
.business-card.style-minimal .card-layout {
    padding: 15px !important; /* Réduit la marge interne pour gagner de la place */
}

.business-card.style-minimal .card-right-col {
    padding: 0 !important;
    gap: 2px; /* Resserre les éléments (nom, titre, contacts) */
}

.business-card.style-minimal .card-contact-lines {
    margin-top: 5px;
    gap: 4px !important; /* Espace réduit entre Tel, Email et Web */
}

.business-card.style-minimal .contact-line {
    font-size: 0.75rem !important; /* Taille légèrement réduite pour tout faire tenir */
    justify-content: center; /* Centre les icônes et le texte */
}

/* --- FIX VISIBILITÉ CARTE BLEUE (CORPORATE) --- */

/* Force le texte en blanc sur le fond bleu nuit */
.business-card.style-corporate, 
.business-card.style-corporate .agent-name,
.business-card.style-corporate .contact-line span,
.business-card.style-corporate .card-footer-bar {
    color: #ffffff !important;
}

/* Garde les titres et icônes en orange pour le contraste */
.business-card.style-corporate .agent-title,
.business-card.style-corporate .contact-line i {
    color: var(--safti-orange) !important;
}

/* Fix spécifique pour le pied de page en mode sombre */
body.dark-mode .business-card.style-corporate .card-footer-bar {
    background: rgba(0, 26, 56, 0.8) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

/* --- QR CODE VERSO --- */
.qr-code-box {
    background: white !important;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.qr-code-box canvas, .qr-code-box img {
    width: 100px;
    height: 100px;
}

/* --- FIX MINIMAL & COLOR PICKER --- */

/* Force une couleur sombre par défaut sur le style minimal pour éviter le blanc/blanc */
.business-card.style-minimal {
    color: #1e293b;
}

/* On s'assure que le sélecteur de couleur est bien visible */
#in-text-color {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
}

/* Le QR Code doit rester lisible même si on change la couleur */
.qr-code-box {
    background: white !important;
    padding: 10px;
    border-radius: 12px;
}

/* Ajustement pour que le texte du verso suive la couleur choisie */
.business-card.verso:not(.style-minimal) {
    color: white; /* Reste blanc sur orange/bleu par défaut */
}

/* ==========================================================
   CORRECTIFS D'URGENCE INTEGRES
========================================================== */

/* 1. FORCE LE DARK MODE (Supprime les cases blanches/bleues) */
body.dark-mode .card,
body.dark-mode [style*="background:#ffffff"],
body.dark-mode [style*="background: #ffffff"] {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

body.dark-mode [style*="background:#f1f5f9"],
body.dark-mode [style*="background: #f1f5f9"],
body.dark-mode .btn-group {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
}

/* Fix spécifique pour les textes bleus qui deviennent illisibles */
body.dark-mode [style*="color: #1e293b"] {
    color: #f1f5f9 !important;
}

/* 2. FIX CARTE DE VISITE - VERS À CORRIGER CI-DESSUS - SUPPRIMÉ CAR REDONDANT */

/* 3. FIX DU SCANNER (MOBILE) */
@media (max-width: 768px) {
    .ocr-container {
        position: fixed !important;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100% !important; height: 100vh !important;
        z-index: 99999 !important;
        background: black !important;
        border-radius: 0 !important;
    }
    .fab-btn { display: none !important; } /* Cache le bouton + pendant le scan */
}

/* ============================================================
   SCANNER OCR PRO - PREMIUM STYLES (V3.0)
============================================================ */

:root {
    --scanner-accent: #FF6B35;
    --scanner-bg: #000000;
    --scanner-overlay: rgba(15, 23, 42, 0.95);
}

/* CONTAINER */
.scanner-pro-main {
    position: fixed; inset: 0; z-index: 3000;
    background: var(--scanner-bg);
    display: flex; flex-direction: column;
    font-family: 'Inter', sans-serif;
    color: white;
}

/* TOP HUD */
.scanner-pro-hud-top {
    position: absolute; top: 0; left: 0; right: 0;
    height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    z-index: 20;
}

.hud-info { display: flex; align-items: center; font-weight: 600; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* START SCREEN */
.scanner-pro-start {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #000000 100%);
    padding: 20px;
}

.start-content { text-align: center; width: 100%; max-width: 320px; }

.premium-title {
    font-size: 2rem; font-weight: 800; margin: 10px 0 5px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.premium-subtitle { color: #64748b; margin-bottom: 40px; font-size: 1rem; }

.start-actions { display: flex; flex-direction: column; gap: 15px; }

.btn-premium-start, .btn-premium-upload {
    display: flex; align-items: center;
    padding: 16px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: white; font-weight: 600; font-size: 1rem;
    cursor: pointer; transition: all 0.2s;
}

.btn-premium-start {
    background: linear-gradient(135deg, var(--scanner-accent) 0%, #e85a20 100%);
    border: none; box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.btn-premium-start:active { transform: scale(0.98); }
.btn-premium-upload:hover { background: rgba(255,255,255,0.1); }

.icon-box {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.2); border-radius: 8px;
    margin-right: 15px; font-size: 1rem;
}

/* CAMERA AREA */
.scanner-camera-area { flex: 1; position: relative; background: black; }
#scanner-video { width: 100%; height: 100%; object-fit: cover; }

.scanner-viewfinder {
    position: absolute; inset: 20px; pointer-events: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
}

.viewfinder-corner {
    position: absolute; width: 40px; height: 40px;
    border: 4px solid var(--scanner-accent);
    border-radius: 4px;
}
.corner-tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.corner-tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.corner-br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

/* BOTTOM HUD */
.scanner-pro-hud-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 140px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0) 100%);
    display: flex; justify-content: center; align-items: center;
    z-index: 20; padding-bottom: 20px;
}

.hud-controls {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; max-width: 360px; padding: 0 30px;
}

.shutter-btn {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: transparent;
    border: 4px solid white;
    position: relative; cursor: pointer;
    transition: transform 0.1s;
}

.shutter-btn::after {
    content: ''; position: absolute; inset: 4px;
    background: white; border-radius: 50%;
    transition: all 0.2s;
}

.shutter-btn:active { transform: scale(0.95); }
.shutter-btn:active::after { background: var(--scanner-accent); transform: scale(0.9); }

.hud-btn.secondary {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none; color: white; font-size: 1.2rem;
    backdrop-filter: blur(10px); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* MODALS */
.scanner-pro-modal {
    position: fixed; inset: 0; z-index: 3100;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}

.modal-content {
    background: #1e293b; border: 1px solid #334155;
    border-radius: 20px; width: 100%; max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    overflow: hidden; display: flex; flex-direction: column;
}

.modal-header {
    padding: 15px 20px; border-bottom: 1px solid #334155;
    display: flex; justify-content: space-between; align-items: center;
}

.modal-body { padding: 20px; overflow-y: auto; max-height: 60vh; }

.modal-footer {
    padding: 15px 20px; border-top: 1px solid #334155;
    display: flex; gap: 10px; justify-content: flex-end;
}

.scan-preview-img {
    width: 100%; max-height: 300px; object-fit: contain;
    border-radius: 12px; background: #0f172a;
}

.scans-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px;
}

.scan-card {
    position: relative; aspect-ratio: 1;
    border-radius: 12px; overflow: hidden;
    border: 2px solid transparent;
}
.scan-card img { width: 100%; height: 100%; object-fit: cover; }
.scan-card:hover { border-color: var(--scanner-accent); }

/* SELECTION SCREEN */
.scanner-pro-selection { background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); }

.scanner-pro-folder-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.scanner-pro-folder-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--scanner-accent);
    transform: translateX(4px);
}

.folder-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--scanner-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.scanner-pro-folder-card:hover .folder-icon {
    background: var(--scanner-accent);
    color: white;
    border-color: var(--scanner-accent);
}

.folder-info { flex: 1; min-width: 0; }
.folder-name { font-weight: 600; color: white; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-address { font-size: 0.8rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.folder-chevron { color: #475569; font-size: 0.9rem; transition: transform 0.2s; }
.scanner-pro-folder-card:hover .folder-chevron { color: white; transform: translateX(2px); }

.scanner-pro-input {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: white !important;
    border-radius: 10px !important;
    padding: 12px 15px !important;
    font-size: 0.95rem !important;
}

.scanner-pro-input:focus {
    border-color: var(--scanner-accent) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2) !important;
}

.status-pill {
    padding: 4px 12px; border-radius: 20px;
    background: rgba(255,255,255,0.1); font-size: 0.8rem;
    backdrop-filter: blur(4px);
}
.status-ready { color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-processing { color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-error { color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }