/* ========================================
   AUTOMATIS - Modern Theme with Light/Dark Mode
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Sora:wght@600;700;800&display=swap');

/* CSS Variables - Light Mode (Default) */
:root {
    /* Bleu spécifique demandé #0072CE */
    --primary: #0072CE;
    --primary-light: #3b9eff;
    /* Version plus claire */
    --primary-dark: #00569e;
    /* Version plus foncée */

    --accent: #f97316;
    --accent-light: #fb923c;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Light mode colors - Blanc Pur & Noir Profond */
    --bg-main: #ffffff;
    /* Fond blanc pur */
    --bg-card: #ffffff;
    /* Cartes blanches */
    --bg-card-hover: #f8fafc;
    /* Hover très léger */
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    /* Bordures nettes gris clair */

    /* Textes contrastés */
    --text-primary: #0f172a;
    /* Noir profond (Slate 900) */
    --text-secondary: #475569;
    /* Gris foncé (Slate 600) */

    /* Effets de lumière ajustés pour le bleu #0072CE */
    --glow-primary: rgba(0, 114, 206, 0.15);
    --glow-accent: rgba(249, 115, 22, 0.15);

    /* Glassmorphism plus clean et opaque */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.06);

    --mesh-opacity: 0.8;
    /* Plus visible en light mode */
}

/* Dark Mode */
html.dark {
    --bg-main: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a24;
    --bg-sidebar: rgba(9, 9, 11, 0.95);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;

    /* Bleu adapté au Dark Mode (plus lumineux) */
    --glow-primary: rgba(0, 114, 206, 0.4);
    --glow-accent: rgba(59, 158, 255, 0.3);
    /* Accent bleu clair au lieu d'orange */

    --glass-bg: rgba(18, 18, 26, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --mesh-opacity: 0.5;
}

html.dark {
    color-scheme: dark;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Tech Font for Headings */
h1,
h2,
h3,
h4,
h5,
h6,
.font-tech {
    font-family: 'Sora', sans-serif;
    letter-spacing: -0.02em;
    font-weight: 700;
    /* Force un rendu plus gras */
}

/* Logo Font */
.font-logo {
    font-family: 'Sora', sans-serif;
    letter-spacing: -0.03em;
    /* Plus serré pour un look compact et solide */
    text-transform: uppercase;
    font-weight: 800;
    /* ExtraBold */
}

/* Animated Background Gradient */
.bg-animated {
    background: linear-gradient(-45deg, #0a0a0f, #12121a, #0f0f1a, #1a1025);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Mesh Gradient Overlay - Version Bleu #0072CE */
.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(0, 114, 206, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(59, 158, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    opacity: var(--mesh-opacity);
    transition: opacity 0.3s ease;
}

/* Surcharge pour Dark Mode (alignement sur le thème bleu) */
html.dark .nav-item::before {
    background: var(--primary-light);
    /* Ligne bleu clair */
}

html.dark .nav-item.active {
    background: rgba(0, 114, 206, 0.2);
    color: var(--primary-light);
}

html.dark .gradient-text {
    background: linear-gradient(135deg, #3b9eff, #0072CE);
    /* Bleu clair -> Bleu */
    -webkit-background-clip: text;
    background-clip: text;
}

html.dark .kpi-card::before {
    background: linear-gradient(90deg, #0072CE, #3b9eff);
}

html.dark .mesh-gradient {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 114, 206, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(59, 158, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 60%, rgba(0, 82, 204, 0.1) 0%, transparent 40%);
    opacity: 0.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

/* ========================================
   GLASSMORPHISM CARDS
   ======================================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Ombre subtile par défaut en light mode */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    /* Ombre plus nette et bleue au hover */
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 0 20px rgba(0, 114, 206, 0.1);
}

html.dark .glass-card:hover {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(0, 114, 206, 0.15);
    /* Glow bleu */
    border-color: rgba(59, 158, 255, 0.2);
}

/* Sidebar Glass */
.glass-sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
}

/* Header Glass */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   GLOW EFFECTS
   ======================================== */
.glow-text {
    text-shadow: 0 0 20px var(--glow-primary), 0 0 40px var(--glow-primary);
}

.glow-box {
    box-shadow:
        0 0 20px var(--glow-primary),
        0 0 40px rgba(99, 102, 241, 0.2),
        inset 0 0 60px rgba(99, 102, 241, 0.05);
}

.glow-accent {
    box-shadow:
        0 0 20px var(--glow-accent),
        0 0 40px rgba(249, 115, 22, 0.2);
}

/* Neon Border */
.neon-border {
    position: relative;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary), var(--accent), var(--primary));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neon-border:hover::before {
    opacity: 1;
    animation: borderGlow 2s linear infinite;
}

@keyframes borderGlow {

    0%,
    100% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(30deg);
    }
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: transparent !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-card-hover) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #ea580c) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.4);
}

.btn-ghost {
    background: transparent !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--primary) !important;
    color: var(--text-primary) !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--glow-primary);
    }

    50% {
        box-shadow: 0 0 40px var(--glow-primary), 0 0 60px rgba(99, 102, 241, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.4s ease-out forwards;
}

.animate-slide-in {
    animation: slideInLeft 0.4s ease-out forwards;
}

/* Staggered animations for lists */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* ========================================
   KPI CARDS
   ======================================== */
.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

html.dark .kpi-card {
    background: linear-gradient(135deg, rgba(18, 18, 26, 0.8), rgba(26, 26, 36, 0.6));
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    /* Bleu -> Bleu clair */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 60px var(--glow-primary);
}

html.dark .kpi-card:hover {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(0, 114, 206, 0.2);
    /* Glow bleu */
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

html.dark .kpi-value {
    background: linear-gradient(135deg, #fff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   NAVIGATION
   ======================================== */
.nav-item {
    position: relative;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    /* Ligne bleue pure au lieu du dégradé orange */
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: rgba(0, 114, 206, 0.08);
    /* Fond bleu très léger */
    color: var(--primary);
}

.nav-item.active::before {
    height: 60%;
}

/* ========================================
   TABLES
   ======================================== */
.table-modern {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

html.dark .table-modern {
    background: rgba(18, 18, 26, 0.6);
}

.table-modern thead {
    background: rgba(99, 102, 241, 0.1);
}

.table-modern th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-modern td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.table-modern tbody tr {
    transition: all 0.2s ease;
}

.table-modern tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.table-modern tbody tr:hover td {
    color: var(--text-primary);
}

/* ========================================
   INPUTS & SELECTS
   ======================================== */
.input-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

html.dark .input-modern {
    background: rgba(18, 18, 26, 0.8);
}

.input-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-modern::placeholder {
    color: var(--text-secondary);
}

.select-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
}

html.dark .select-modern {
    background: rgba(18, 18, 26, 0.8);
}

.select-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.select-modern option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========================================
   BADGES & TAGS
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========================================
   CHARTS
   ======================================== */
.chart-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

html.dark .chart-container {
    background: rgba(18, 18, 26, 0.6);
}

.chart-container:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

html.dark .chart-container:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ApexCharts tooltip fix
   Tooltips are portalized to document.body via JS (portalizTooltip()) to escape
   the overflow-y-auto scroll container on <main>. position: fixed is applied by JS;
   these rules ensure z-index stacking and canvas overflow don't clip anything. */
.apexcharts-canvas {
    overflow: visible !important;
}

.apexcharts-tooltip {
    z-index: 99999 !important;
}

.apexcharts-xaxistooltip {
    z-index: 99999 !important;
}

/* ========================================
   LOADING STATES
   ======================================== */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   TOOLTIPS
   ======================================== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(99, 102, 241, 0.1);
    animation: fadeInScale 0.3s ease-out;
}

/* ========================================
   UTILITY OVERRIDES - Only in Dark Mode
   ======================================== */
/* Dark mode background overrides */
html.dark .bg-white {
    background-color: var(--bg-card) !important;
}

html.dark .bg-gray-50 {
    background-color: var(--bg-main) !important;
}

html.dark .bg-gray-100 {
    background-color: rgba(18, 18, 26, 0.6) !important;
}

/* Dark mode border overrides */
html.dark .border-gray-200,
html.dark .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Dark mode text color overrides */
html.dark .text-gray-900,
html.dark .text-gray-800 {
    color: var(--text-primary) !important;
}

html.dark .text-gray-600,
html.dark .text-gray-500 {
    color: var(--text-secondary) !important;
}

/* ========================================
   SPECIAL EFFECTS
   ======================================== */
/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    /* Bleu -> Bleu clair */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glowing orbs decoration */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
}

.orb-primary {
    background: var(--primary);
}

.orb-accent {
    background: var(--accent);
}

/* Noise texture overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

/* Hover lift effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Focus ring */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========================================
   FILTER BUTTONS
   ======================================== */
.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-btn:hover {
    background: rgba(0, 114, 206, 0.05);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary);
    /* Bleu pur */
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 114, 206, 0.3);
}

/* PDF Export specific fixes */
.pdf-mode .break-inside-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* Ensure charts don't overlap in PDF by forcing their container width or ensuring grid behaves */
.pdf-mode #globalChart,
.pdf-mode #statusChart {
    max-width: 100% !important;
    width: 100% !important;
}

.pdf-mode canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* PDF Export specific fixes */
.pdf-mode {
    /* Basic styling for the clone */
    width: 800px !important;
    max-width: 800px !important;
    background-color: white !important;
    padding: 20px !important;
    color: black !important;
    font-family: 'Inter', sans-serif !important;
    /* Ensure readable font */
}

.pdf-mode * {
    text-shadow: none !important;
    box-shadow: none !important;
}

/* Force 1 column for charts in portrait to avoid squeezing */
.pdf-mode .grid-cols-1.lg\:grid-cols-2 {
    grid-template-columns: 1fr !important;
}

/* Force 2 columns for detailed cards in portrait */
.pdf-mode #detailed-cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
}

/* Prevent cutting inside cards */
.pdf-mode #detailed-cards>div,
.pdf-mode .kpi-card,
.pdf-mode .chart-container {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 20px !important;
    border: 1px solid #e5e7eb !important;
    /* Force visible border */
    background: white !important;
}

/* Ensure Table header is visible */
.pdf-mode thead {
    display: table-header-group;
}

.pdf-mode tfoot {
    display: table-footer-group;
}

.pdf-mode tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

.pdf-mode canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* ========================================
   UTILITY OVERRIDES - Only in Dark Mode
   ======================================== */
/* Dark mode background overrides */
html.dark .bg-white {
    background-color: var(--bg-card) !important;
}

html.dark .bg-gray-50 {
    background-color: var(--bg-main) !important;
}

html.dark .bg-gray-100 {
    background-color: rgba(18, 18, 26, 0.6) !important;
}

/* Dark mode border overrides */
html.dark .border-gray-200,
html.dark .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Dark mode text color overrides */
html.dark .text-gray-900,
html.dark .text-gray-800 {
    color: var(--text-primary) !important;
}

html.dark .text-gray-600,
html.dark .text-gray-500 {
    color: var(--text-secondary) !important;
}

/* ========================================
   SPECIAL EFFECTS
   ======================================== */
/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    /* Bleu -> Bleu clair */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glowing orbs decoration */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
}

.orb-primary {
    background: var(--primary);
}

.orb-accent {
    background: var(--accent);
}

/* Noise texture overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

/* Hover lift effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Focus ring */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========================================
   FILTER BUTTONS
   ======================================== */
.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-btn:hover {
    background: rgba(0, 114, 206, 0.05);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary);
    /* Bleu pur */
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 114, 206, 0.3);
}

/* PDF Export specific fixes */
.pdf-mode .break-inside-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* Ensure charts don't overlap in PDF by forcing their container width or ensuring grid behaves */
.pdf-mode #globalChart,
.pdf-mode #statusChart {
    max-width: 100% !important;
    width: 100% !important;
}

.pdf-mode canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* PDF Optimization - ensure content fits approx A4 landscape width */
.pdf-mode {
    width: 1120px !important;
    /* Force exact A4 width matches windowWidth */
    max-width: 1120px !important;
    margin: 0 auto;
    background-color: white !important;
    /* Ensure white bg */
    color: black !important;
    /* Ensure black text */
}

/* Force grid to respect width */
.pdf-mode .grid {
    display: grid !important;
}

/* STRICT PDF RULES */
.pdf-mode {
    padding: 20px !important;
}

/* Prevent cutting inside cards */
.pdf-mode #detailed-cards>div,
.pdf-mode .kpi-card,
.pdf-mode .chart-container {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 20px !important;
}

/* Prevent cutting inside table rows */
.pdf-mode tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: auto;
}

/* Optimize Grid for PDF - maybe 2 columns for cards instead of 3 to allow more breathing room? */
.pdf-mode #detailed-cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
}

/* Ensure Table header is visible (html2pdf doesn't repeat headers, but we can try to force block context) */
.pdf-mode thead {
    display: table-header-group;
}

.pdf-mode tfoot {
    display: table-footer-group;
}

/* Fix text colors for PDF */
.pdf-mode * {
    text-shadow: none !important;
    box-shadow: none !important;
}

/* ========================================
   CUSTOM DROPDOWN (Premium UI)
   ======================================== */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    min-width: 150px;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .custom-select-trigger {
    background: rgba(18, 18, 26, 0.6);
}

.custom-select-trigger:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

html.dark .custom-select-trigger:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.custom-select-trigger.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-select-trigger span {
    margin-right: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-arrow {
    position: relative;
    width: 10px;
    height: 10px;
}

.custom-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: translateY(-70%) rotate(45deg);
    transition: all 0.3s ease;
}

.custom-select-trigger.open .custom-arrow::after {
    transform: translateY(-30%) rotate(225deg);
    border-color: var(--primary);
}

.custom-options {
    position: absolute;
    display: block;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

html.dark .custom-options {
    background: rgba(18, 18, 26, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Disabled state */
.custom-select-wrapper.disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}
.custom-select-wrapper.disabled .custom-select-trigger {
    cursor: not-allowed;
}

.custom-option {
    position: relative;
    display: block;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-option:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    padding-left: 1.25rem;
}

.custom-option.selected {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    font-weight: 600;
}

/* Disabled option */
.custom-option.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Scrollbar for long lists */
.custom-options-scroll {
    max-height: 250px;
    overflow-y: auto;
}

.custom-options-scroll::-webkit-scrollbar {
    width: 4px;
}

.custom-options-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* ========================================
   SIDEBAR COLLAPSIBLE
   ======================================== */

/* Collapsed state */
#main-sidebar.sidebar-collapsed {
    width: 64px !important;
}

/* Hide text labels when collapsed */
#main-sidebar.sidebar-collapsed .sidebar-text {
    display: none;
}

/* Center nav items and remove gap when collapsed */
#main-sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
}

/* Center logo area when collapsed */
#main-sidebar.sidebar-collapsed .sidebar-logo-area {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* Hide admin section divider label when collapsed */
#main-sidebar.sidebar-collapsed .sidebar-section-label {
    display: none;
}

/* Hide user profile text/logout when collapsed, center avatar */
#main-sidebar.sidebar-collapsed .sidebar-user-footer {
    padding: 0.5rem;
}

#main-sidebar.sidebar-collapsed .sidebar-user-card {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
}

/* Rotate toggle icon direction */
#main-sidebar.sidebar-collapsed #sidebar-toggle .sidebar-toggle-icon {
    transform: rotate(180deg);
}

#sidebar-toggle .sidebar-toggle-icon {
    transition: transform 0.3s ease;
}

/* Sidebar toggle button */
#sidebar-toggle {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

#sidebar-toggle:hover {
    opacity: 1;
}

/* ── GEO Monitoring — Réponse Markdown ──────────────────── */
.geo-answer-body {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.dark .geo-answer-body {
    color: #d1d5db; /* gray-300 */
}

/* Headings */
.geo-answer-body h1,
.geo-answer-body h2,
.geo-answer-body h3,
.geo-answer-body h4 {
    font-weight: 700;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    color: #111827;
}

.dark .geo-answer-body h1,
.dark .geo-answer-body h2,
.dark .geo-answer-body h3,
.dark .geo-answer-body h4 {
    color: #f9fafb;
}

.geo-answer-body h1 { font-size: 1.15rem; }
.geo-answer-body h2 { font-size: 1.05rem; padding-bottom: 0.3em; border-bottom: 1px solid rgba(0,0,0,0.08); }
.dark .geo-answer-body h2 { border-bottom-color: rgba(255,255,255,0.08); }
.geo-answer-body h3 { font-size: 0.95rem; }

/* Paragraphs */
.geo-answer-body p {
    margin-top: 0;
    margin-bottom: 0.75em;
}

/* Lists */
.geo-answer-body ul,
.geo-answer-body ol {
    padding-left: 1.4em;
    margin-bottom: 0.75em;
}

.geo-answer-body ul { list-style-type: disc; }
.geo-answer-body ol { list-style-type: decimal; }

.geo-answer-body li {
    margin-bottom: 0.3em;
}

.geo-answer-body li::marker {
    color: #6366f1;
}

/* Strong / em */
.geo-answer-body strong { font-weight: 700; color: #111827; }
.dark .geo-answer-body strong { color: #f3f4f6; }
.geo-answer-body em { font-style: italic; color: inherit; }

/* Inline code */
.geo-answer-body code {
    font-size: 0.8em;
    font-weight: 600;
    padding: 0.1em 0.4em;
    border-radius: 0.3em;
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    font-family: ui-monospace, monospace;
}

.dark .geo-answer-body code {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

/* Code blocks */
.geo-answer-body pre {
    background: #f3f4f6;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 0.75rem;
    padding: 1em 1.2em;
    overflow-x: auto;
    margin-bottom: 1em;
}

.dark .geo-answer-body pre {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

.geo-answer-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.82em;
    font-weight: 400;
}

/* Blockquote */
.geo-answer-body blockquote {
    border-left: 3px solid #6366f1;
    padding-left: 1em;
    margin: 0.75em 0;
    color: #4b5563;
    font-style: italic;
}

.dark .geo-answer-body blockquote {
    color: #9ca3af;
    border-left-color: #818cf8;
}

/* Links */
.geo-answer-body a {
    color: #4f46e5;
    text-decoration: underline;
    text-decoration-color: rgba(79, 70, 229, 0.4);
    font-weight: 500;
    transition: text-decoration-color 0.15s;
}

.dark .geo-answer-body a {
    color: #818cf8;
    text-decoration-color: rgba(129, 140, 248, 0.4);
}

.geo-answer-body a:hover {
    text-decoration-color: currentColor;
}

/* Horizontal rule */
.geo-answer-body hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin: 1em 0;
}

.dark .geo-answer-body hr {
    border-top-color: rgba(255,255,255,0.1);
}

/* ── Citation badges inline (ChatGPT 【n†source】 style) ─── */
.geo-citation-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1em;
    height: 1.1em;
    padding: 0 0.3em;
    margin: 0 0.1em;
    font-size: 0.65em;
    font-weight: 700;
    line-height: 1;
    vertical-align: super;
    border-radius: 0.4em;
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.25);
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-style: normal;
}

.dark .geo-citation-badge {
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    border-color: rgba(129, 140, 248, 0.3);
}

.geo-citation-badge:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.dark .geo-citation-badge:hover {
    background: #818cf8;
    color: #fff;
    border-color: #818cf8;
}