/* ============================================================
   EXPERT RESOURCES ETL — Design System v3.0
   Premium UI with Sidebar Navigation
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
    /* Colors */
    --bg-body: #0f1117;
    --bg-sidebar: #151820;
    --bg-card: #1a1d28;
    --bg-card-hover: #1f2330;
    --bg-input: #151820;
    --bg-header: rgba(15, 17, 23, 0.8);

    --text-primary: #e8eaed;
    --text-secondary: #8b8fa3;
    --text-muted: #5f6377;
    --text-white: #ffffff;

    --accent-blue: #4f8cff;
    --accent-blue-soft: rgba(79, 140, 255, 0.12);
    --accent-green: #34d399;
    --accent-green-soft: rgba(52, 211, 153, 0.12);
    --accent-orange: #fb923c;
    --accent-orange-soft: rgba(251, 146, 60, 0.12);
    --accent-red: #f87171;
    --accent-red-soft: rgba(248, 113, 113, 0.12);
    --accent-purple: #a78bfa;
    --accent-purple-soft: rgba(167, 139, 250, 0.12);
    --accent-yellow: #fbbf24;
    --accent-yellow-soft: rgba(251, 191, 36, 0.12);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(79, 140, 255, 0.15);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: white;
    padding: 4px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

/* Nav Items */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 16px 14px 6px;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-color);
}

.sidebar-env-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.sidebar-env-badge.env-dev {
    background: var(--accent-green-soft);
    color: var(--accent-green);
}
.sidebar-env-badge.env-staging {
    background: var(--accent-orange-soft);
    color: var(--accent-orange);
}
.sidebar-env-badge.env-production {
    background: var(--accent-red-soft);
    color: var(--accent-red);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

/* Page Header */
.page-header {
    padding: 20px 32px;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title i {
    font-size: 22px;
    opacity: 0.7;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Page Body */
.page-body {
    padding: 24px 32px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-header i {
    margin-right: 8px;
    opacity: 0.6;
}

.card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-icon.blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.stat-icon.green { background: var(--accent-green-soft); color: var(--accent-green); }
.stat-icon.orange { background: var(--accent-orange-soft); color: var(--accent-orange); }
.stat-icon.red { background: var(--accent-red-soft); color: var(--accent-red); }
.stat-icon.purple { background: var(--accent-purple-soft); color: var(--accent-purple); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
    margin-bottom: 4px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}
.btn-primary:hover {
    background: #3d7ae8;
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-green);
    color: #0f1117;
}
.btn-success:hover {
    background: #2cc48a;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-blue-soft);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    color: var(--text-primary);
    font-size: 13px;
}

.table thead th {
    background: var(--bg-body);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-color: var(--border-color);
    padding: 12px 16px;
}

.table tbody td {
    border-color: var(--border-color);
    padding: 12px 16px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge-blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge-green { background: var(--accent-green-soft); color: var(--accent-green); }
.badge-orange { background: var(--accent-orange-soft); color: var(--accent-orange); }
.badge-red { background: var(--accent-red-soft); color: var(--accent-red); }
.badge-purple { background: var(--accent-purple-soft); color: var(--accent-purple); }

/* ============================================================
   ALERTS & TOASTS
   ============================================================ */
.alert-bar {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-bar.info { background: var(--accent-blue-soft); color: var(--accent-blue); border: 1px solid rgba(79, 140, 255, 0.2); }
.alert-bar.success { background: var(--accent-green-soft); color: var(--accent-green); border: 1px solid rgba(52, 211, 153, 0.2); }
.alert-bar.warning { background: var(--accent-orange-soft); color: var(--accent-orange); border: 1px solid rgba(251, 146, 60, 0.2); }
.alert-bar.error { background: var(--accent-red-soft); color: var(--accent-red); border: 1px solid rgba(248, 113, 113, 0.2); }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .sidebar-title,
    .sidebar .sidebar-subtitle,
    .sidebar .nav-item span,
    .sidebar .nav-section-label,
    .sidebar .nav-badge,
    .sidebar .sidebar-user-info,
    .sidebar .sidebar-env-badge span:not(.env-dot) {
        display: none;
    }
    .sidebar .nav-item { justify-content: center; padding: 12px; }
    .sidebar .sidebar-header { justify-content: center; padding: 16px; }
    .main-content { margin-left: var(--sidebar-collapsed); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-header { padding: 16px 20px; }
    .page-body { padding: 16px 20px; }
    /* Réafficher les labels cachés par la query 1024px */
    .sidebar .sidebar-title { display: block !important; }
    .sidebar .sidebar-subtitle { display: block !important; }
    .sidebar .nav-item span { display: inline !important; }
    .sidebar .nav-section-label { display: block !important; }
    .sidebar .nav-badge { display: inline-flex !important; }
    .sidebar .sidebar-user-info { display: block !important; }
    .sidebar .sidebar-env-badge span:not(.env-dot) { display: inline !important; }
    .sidebar .nav-item { justify-content: flex-start !important; padding: 10px 20px !important; }
    .sidebar .sidebar-header { justify-content: flex-start !important; padding: 16px 20px !important; }
    .sidebar .sidebar-logo { display: block !important; }
    .sidebar .sidebar-nav { display: block !important; overflow-y: auto !important; }
    .sidebar .sidebar-footer { display: block !important; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.gap-row { display: flex; gap: 16px; flex-wrap: wrap; }
.gap-row > * { flex: 1; min-width: 200px; }
.text-accent { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-orange { color: var(--accent-orange); }
.text-red { color: var(--accent-red); }
.text-purple { color: var(--accent-purple); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   LIGHT THEME
   ============================================================ */
[data-theme="light"] {
    --bg-body: #f3f4f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fb;
    --bg-input: #f3f4f8;
    --bg-header: rgba(243, 244, 248, 0.9);

    --text-primary: #1a1d28;
    --text-secondary: #5f6377;
    --text-muted: #8b8fa3;
    --text-white: #0f1117;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow-blue: 0 0 20px rgba(79, 140, 255, 0.1);
}

[data-theme="light"] .sidebar {
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-logo {
    background: #f3f4f8;
    border: 1px solid var(--border-color);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .table thead th {
    background: #f8f9fb;
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Fix logo visibility */
.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: white;
    padding: 5px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .sidebar-logo {
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ============================================================
   THÈMES ADDITIONNELS
   ============================================================ */

/* --- MIDNIGHT BLUE --- */
[data-theme="midnight"] {
    --bg-body: #0c1222;
    --bg-sidebar: #111827;
    --bg-card: #1e293b;
    --bg-card-hover: #253347;
    --bg-input: #111827;
    --bg-header: rgba(12, 18, 34, 0.9);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #f8fafc;

    --accent-blue: #60a5fa;
    --accent-blue-soft: rgba(96, 165, 250, 0.15);
    --accent-green: #4ade80;
    --accent-green-soft: rgba(74, 222, 128, 0.15);
    --accent-orange: #fb923c;
    --accent-orange-soft: rgba(251, 146, 60, 0.15);
    --accent-red: #fb7185;
    --accent-red-soft: rgba(251, 113, 133, 0.15);
    --accent-purple: #c084fc;
    --accent-purple-soft: rgba(192, 132, 252, 0.15);
    --accent-yellow: #facc15;
    --accent-yellow-soft: rgba(250, 204, 21, 0.15);

    --border-color: rgba(148, 163, 184, 0.1);
    --border-hover: rgba(148, 163, 184, 0.2);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow-blue: 0 0 24px rgba(96, 165, 250, 0.2);
}
[data-theme="midnight"] .sidebar { box-shadow: 2px 0 12px rgba(0,0,0,0.4); }

/* --- EMERALD --- */
[data-theme="emerald"] {
    --bg-body: #f0fdf4;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0fdf4;
    --bg-input: #f0fdf4;
    --bg-header: rgba(240, 253, 244, 0.9);

    --text-primary: #14532d;
    --text-secondary: #3f6212;
    --text-muted: #6b7280;
    --text-white: #052e16;

    --accent-blue: #059669;
    --accent-blue-soft: rgba(5, 150, 105, 0.1);
    --accent-green: #10b981;
    --accent-green-soft: rgba(16, 185, 129, 0.12);
    --accent-orange: #d97706;
    --accent-orange-soft: rgba(217, 119, 6, 0.1);
    --accent-red: #dc2626;
    --accent-red-soft: rgba(220, 38, 38, 0.1);
    --accent-purple: #7c3aed;
    --accent-purple-soft: rgba(124, 58, 237, 0.1);
    --accent-yellow: #ca8a04;
    --accent-yellow-soft: rgba(202, 138, 4, 0.1);

    --border-color: rgba(5, 150, 105, 0.12);
    --border-hover: rgba(5, 150, 105, 0.25);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(5, 150, 105, 0.08);
    --shadow-lg: 0 12px 40px rgba(5, 150, 105, 0.1);
    --shadow-glow-blue: 0 0 20px rgba(5, 150, 105, 0.15);
}
[data-theme="emerald"] .sidebar { box-shadow: 2px 0 8px rgba(5,150,105,0.08); }
[data-theme="emerald"] .sidebar-logo { background: #ecfdf5; border: 1px solid var(--border-color); }
[data-theme="emerald"] .stat-card:hover { box-shadow: 0 4px 16px rgba(5,150,105,0.1); }
[data-theme="emerald"] .table thead th { background: #f0fdf4; }
[data-theme="emerald"] .form-control,
[data-theme="emerald"] .form-select { background: #f0fdf4; border-color: rgba(5,150,105,0.15); color: #14532d; }
[data-theme="emerald"] .btn-primary { background: #059669; }
[data-theme="emerald"] .btn-primary:hover { background: #047857; }
[data-theme="emerald"] .nav-item.active { background: rgba(5,150,105,0.1); color: #059669; }
[data-theme="emerald"] .badge-green { background: rgba(16,185,129,0.15); color: #059669; }

/* --- SUNSET WARM --- */
[data-theme="sunset"] {
    --bg-body: #1c1410;
    --bg-sidebar: #231a14;
    --bg-card: #2c1f17;
    --bg-card-hover: #3a2a1f;
    --bg-input: #231a14;
    --bg-header: rgba(28, 20, 16, 0.9);

    --text-primary: #fde8d0;
    --text-secondary: #c9a882;
    --text-muted: #8a7260;
    --text-white: #fff5eb;

    --accent-blue: #f59e0b;
    --accent-blue-soft: rgba(245, 158, 11, 0.15);
    --accent-green: #34d399;
    --accent-green-soft: rgba(52, 211, 153, 0.12);
    --accent-orange: #fb923c;
    --accent-orange-soft: rgba(251, 146, 60, 0.15);
    --accent-red: #f87171;
    --accent-red-soft: rgba(248, 113, 113, 0.12);
    --accent-purple: #e879f9;
    --accent-purple-soft: rgba(232, 121, 249, 0.12);
    --accent-yellow: #fbbf24;
    --accent-yellow-soft: rgba(251, 191, 36, 0.15);

    --border-color: rgba(201, 168, 130, 0.12);
    --border-hover: rgba(201, 168, 130, 0.25);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow-blue: 0 0 24px rgba(245, 158, 11, 0.2);
}
[data-theme="sunset"] .sidebar { box-shadow: 2px 0 12px rgba(0,0,0,0.4); }
[data-theme="sunset"] .btn-primary { background: #d97706; }
[data-theme="sunset"] .btn-primary:hover { background: #b45309; }
[data-theme="sunset"] .nav-item.active { background: rgba(245,158,11,0.12); color: #f59e0b; }

/* --- Notification badge global pour jobs en cours --- */
.job-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    border-radius: 12px;
    padding: 12px 16px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(79,140,255,0.15);
    min-width: 280px;
    cursor: pointer;
    transition: transform 0.2s;
}
.job-notification:hover { transform: translateY(-2px); }
.job-notification .jn-spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.job-notification .jn-progress {
    flex: 1;
}
.job-notification .jn-progress .jn-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.job-notification .jn-progress .jn-bar-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
    transition: width 0.5s;
    width: 0%;
}
.job-notification.done { border-color: var(--accent-green); }
.job-notification.done .jn-spinner { display: none; }
.job-notification.error { border-color: var(--accent-red); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================ */
/* MOBILE SIDEBAR - Hamburger + Overlay         */
/* ============================================ */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 201;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
}
.hamburger-btn:hover {
    background: var(--bg-hover);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1200 !important;
    }
    
    .sidebar {
        z-index: 1100 !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh !important;
        width: var(--sidebar-width) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .sidebar.open + .sidebar-overlay,
    .sidebar-overlay.show {
        display: block !important;
        z-index: 1050 !important;
    }
    
    .page-header {
        padding-left: 60px !important;
    }
    
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 480px) {
    .hamburger-btn {
        display: flex !important;
        top: 8px;
        left: 8px;
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
    .page-header {
        padding-left: 52px !important;
        padding-right: 12px !important;
    }
    .page-body {
        padding: 12px !important;
    }
    .page-title {
        font-size: 16px !important;
    }
}

/* === NOUVEAUX THÈMES PREMIUM === */

/* --- OCEAN DEEP --- */
[data-theme="ocean"] {
    --bg-body: #0a192f;
    --bg-sidebar: #0d2137;
    --bg-card: #112940;
    --bg-card-hover: #163a5c;
    --bg-input: #0d2137;
    --bg-header: rgba(10, 25, 47, 0.92);
    --bg-hover: #163a5c;
    --bg-primary: #0a192f;

    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --text-muted: #5f6f8f;
    --text-white: #e6f1ff;

    --accent-blue: #64ffda;
    --accent-blue-soft: rgba(100, 255, 218, 0.1);
    --accent-green: #64ffda;
    --accent-green-soft: rgba(100, 255, 218, 0.1);
    --accent-orange: #ffb86c;
    --accent-orange-soft: rgba(255, 184, 108, 0.12);
    --accent-red: #ff6b6b;
    --accent-red-soft: rgba(255, 107, 107, 0.12);
    --accent-purple: #bd93f9;
    --accent-purple-soft: rgba(189, 147, 249, 0.12);
    --accent-yellow: #f1fa8c;
    --accent-yellow-soft: rgba(241, 250, 140, 0.12);

    --border-color: rgba(100, 255, 218, 0.08);
    --border-hover: rgba(100, 255, 218, 0.2);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.7);
    --shadow-glow-blue: 0 0 30px rgba(100, 255, 218, 0.15);
}
[data-theme="ocean"] .sidebar { box-shadow: 2px 0 15px rgba(0,0,0,0.5); }
[data-theme="ocean"] .btn-primary { background: linear-gradient(135deg, #64ffda, #48c9b0); color: #0a192f; font-weight: 600; }
[data-theme="ocean"] .btn-primary:hover { background: linear-gradient(135deg, #48c9b0, #64ffda); color: #0a192f; }
[data-theme="ocean"] .nav-item.active { background: rgba(100, 255, 218, 0.08); color: #64ffda; border-left: 3px solid #64ffda; }
[data-theme="ocean"] .kpi-card { border-color: rgba(100, 255, 218, 0.06); }
[data-theme="ocean"] .kpi-card.active { border-color: #64ffda; background: rgba(100, 255, 218, 0.04); }

/* --- AURORA BOREALIS --- */
[data-theme="aurora"] {
    --bg-body: #13111c;
    --bg-sidebar: #1a1726;
    --bg-card: #211d2e;
    --bg-card-hover: #2d2840;
    --bg-input: #1a1726;
    --bg-header: rgba(19, 17, 28, 0.92);
    --bg-hover: #2d2840;
    --bg-primary: #13111c;

    --text-primary: #e4e0f0;
    --text-secondary: #a09cb5;
    --text-muted: #6d6888;
    --text-white: #f5f3ff;

    --accent-blue: #7c3aed;
    --accent-blue-soft: rgba(124, 58, 237, 0.12);
    --accent-green: #34d399;
    --accent-green-soft: rgba(52, 211, 153, 0.12);
    --accent-orange: #fb923c;
    --accent-orange-soft: rgba(251, 146, 60, 0.12);
    --accent-red: #f472b6;
    --accent-red-soft: rgba(244, 114, 182, 0.12);
    --accent-purple: #c084fc;
    --accent-purple-soft: rgba(192, 132, 252, 0.15);
    --accent-yellow: #fbbf24;
    --accent-yellow-soft: rgba(251, 191, 36, 0.12);

    --border-color: rgba(124, 58, 237, 0.1);
    --border-hover: rgba(124, 58, 237, 0.25);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 14px rgba(124, 58, 237, 0.15);
    --shadow-lg: 0 12px 40px rgba(124, 58, 237, 0.12);
    --shadow-glow-blue: 0 0 30px rgba(124, 58, 237, 0.2);
}
[data-theme="aurora"] .sidebar { box-shadow: 2px 0 15px rgba(124,58,237,0.1); background: linear-gradient(180deg, #1a1726 0%, #1e1530 100%); }
[data-theme="aurora"] .btn-primary { background: linear-gradient(135deg, #7c3aed, #a855f7); }
[data-theme="aurora"] .btn-primary:hover { background: linear-gradient(135deg, #6d28d9, #9333ea); }
[data-theme="aurora"] .nav-item.active { background: rgba(124, 58, 237, 0.1); color: #a855f7; border-left: 3px solid #a855f7; }
[data-theme="aurora"] .kpi-card.active { border-color: #7c3aed; background: rgba(124, 58, 237, 0.06); }
[data-theme="aurora"] .sidebar-header { border-bottom: 1px solid rgba(124, 58, 237, 0.1); }

/* --- ROSE GOLD (Light Premium) --- */
[data-theme="rosegold"] {
    --bg-body: #faf5f2;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fdf2ee;
    --bg-input: #faf5f2;
    --bg-header: rgba(250, 245, 242, 0.95);
    --bg-hover: #fdf2ee;
    --bg-primary: #faf5f2;

    --text-primary: #3d2c2c;
    --text-secondary: #6b5050;
    --text-muted: #9a8080;
    --text-white: #2d1f1f;

    --accent-blue: #be7b5e;
    --accent-blue-soft: rgba(190, 123, 94, 0.1);
    --accent-green: #2d8a6e;
    --accent-green-soft: rgba(45, 138, 110, 0.1);
    --accent-orange: #d4763c;
    --accent-orange-soft: rgba(212, 118, 60, 0.1);
    --accent-red: #c94f4f;
    --accent-red-soft: rgba(201, 79, 79, 0.1);
    --accent-purple: #8b5cf6;
    --accent-purple-soft: rgba(139, 92, 246, 0.1);
    --accent-yellow: #b8860b;
    --accent-yellow-soft: rgba(184, 134, 11, 0.1);

    --border-color: rgba(190, 123, 94, 0.12);
    --border-hover: rgba(190, 123, 94, 0.25);

    --shadow-sm: 0 1px 3px rgba(190, 123, 94, 0.06);
    --shadow-md: 0 4px 14px rgba(190, 123, 94, 0.08);
    --shadow-lg: 0 12px 40px rgba(190, 123, 94, 0.1);
    --shadow-glow-blue: 0 0 20px rgba(190, 123, 94, 0.12);
}
[data-theme="rosegold"] .sidebar { box-shadow: 2px 0 10px rgba(190,123,94,0.06); border-right: 1px solid rgba(190,123,94,0.1); }
[data-theme="rosegold"] .sidebar-logo { background: #fdf2ee; border: 1px solid rgba(190,123,94,0.15); }
[data-theme="rosegold"] .btn-primary { background: linear-gradient(135deg, #be7b5e, #d4763c); color: #fff; }
[data-theme="rosegold"] .btn-primary:hover { background: linear-gradient(135deg, #a86848, #c16430); }
[data-theme="rosegold"] .nav-item.active { background: rgba(190, 123, 94, 0.08); color: #be7b5e; border-left: 3px solid #be7b5e; }
[data-theme="rosegold"] .table thead th { background: #fdf2ee; color: #6b5050; }
[data-theme="rosegold"] .form-control,
[data-theme="rosegold"] .form-select { background: #faf5f2; border-color: rgba(190,123,94,0.15); color: #3d2c2c; }
[data-theme="rosegold"] .kpi-card.active { border-color: #be7b5e; background: rgba(190, 123, 94, 0.04); }

/* --- CYBER NEON --- */
[data-theme="cyber"] {
    --bg-body: #0d0d0d;
    --bg-sidebar: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --bg-input: #111111;
    --bg-header: rgba(13, 13, 13, 0.95);
    --bg-hover: #222222;
    --bg-primary: #0d0d0d;

    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --text-white: #ffffff;

    --accent-blue: #00d4ff;
    --accent-blue-soft: rgba(0, 212, 255, 0.1);
    --accent-green: #00ff88;
    --accent-green-soft: rgba(0, 255, 136, 0.1);
    --accent-orange: #ff6600;
    --accent-orange-soft: rgba(255, 102, 0, 0.12);
    --accent-red: #ff0055;
    --accent-red-soft: rgba(255, 0, 85, 0.12);
    --accent-purple: #cc00ff;
    --accent-purple-soft: rgba(204, 0, 255, 0.12);
    --accent-yellow: #ffff00;
    --accent-yellow-soft: rgba(255, 255, 0, 0.1);

    --border-color: rgba(0, 212, 255, 0.08);
    --border-hover: rgba(0, 212, 255, 0.2);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.7);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.9);
    --shadow-glow-blue: 0 0 30px rgba(0, 212, 255, 0.2);
}
[data-theme="cyber"] .sidebar { box-shadow: 2px 0 15px rgba(0,212,255,0.05); border-right: 1px solid rgba(0,212,255,0.08); }
[data-theme="cyber"] .btn-primary { background: linear-gradient(135deg, #00d4ff, #00ff88); color: #0d0d0d; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
[data-theme="cyber"] .btn-primary:hover { background: linear-gradient(135deg, #00ff88, #00d4ff); box-shadow: 0 0 20px rgba(0,212,255,0.3); }
[data-theme="cyber"] .nav-item.active { background: rgba(0, 212, 255, 0.06); color: #00d4ff; border-left: 3px solid #00d4ff; text-shadow: 0 0 8px rgba(0,212,255,0.4); }
[data-theme="cyber"] .kpi-card { border-color: rgba(0, 212, 255, 0.06); }
[data-theme="cyber"] .kpi-card.active { border-color: #00d4ff; box-shadow: 0 0 15px rgba(0,212,255,0.1); }
[data-theme="cyber"] .kpi-card .kpi-val { text-shadow: 0 0 10px currentColor; }
