/* ========================================
   CONFEMEN SPOC - THÈME COMPLET
   Version 2.0 - Architecture cohérente
   ======================================== */

/* ========================================
   VARIABLES ROOT
   ======================================== */
:root {
    /* Couleurs principales */
    --ds-blue: #4D6BFE;
    --ds-blue-dark: #3A56D4;
    --ds-blue-light: #7A94FF;
    --ds-blue-pale: #EEF1FF;
    
    /* Couleurs secondaires */
    --ds-purple: #6C5CE7;
    --ds-purple-light: #A29BFE;
    --ds-teal: #00B4D8;
    --ds-teal-light: #48CAE4;
    --ds-green: #2ECC71;
    --ds-green-light: #82E0AA;
    --ds-orange: #F39C12;
    --ds-orange-light: #F7DC6F;
    --ds-red: #E74C3C;
    --ds-red-light: #F1948A;
    
    /* Neutres */
    --ds-gray-50: #F8FAFC;
    --ds-gray-100: #F1F4F9;
    --ds-gray-200: #E2E8F0;
    --ds-gray-300: #CBD5E1;
    --ds-gray-400: #94A3B8;
    --ds-gray-500: #64748B;
    --ds-gray-600: #475569;
    --ds-gray-700: #334155;
    --ds-gray-800: #1E293B;
    --ds-gray-900: #0F172A;
    
    /* Layout */
    --header-height: 70px;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    
    /* Espacements */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Ombres */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Rayons */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--ds-gray-50);
    color: var(--ds-gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */
#layout-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   HEADER
   ======================================== */
#page-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1002;
    background: #FFFFFF;
    border-bottom: 1px solid var(--ds-gray-200);
    box-shadow: var(--shadow-sm);
}

.navbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--spacing-lg);
    max-width: 100%;
}

/* Logo */
.navbar-brand-box {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-brand-box .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-brand-box .logo img {
    height: 40px;
    width: auto;
}

.navbar-brand-box .logo .brand-text {
    font-weight: 700;
    font-size: 20px;
    color: var(--ds-gray-900);
    letter-spacing: -0.5px;
}

.navbar-brand-box .logo .brand-text span {
    color: var(--ds-blue);
}

.navbar-brand-box .logo .brand-sub {
    font-size: 11px;
    color: var(--ds-gray-400);
    font-weight: 400;
}

/* Header Items */
.header-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--ds-gray-500);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    padding: 0;
    font-size: 18px;
}

.header-item:hover {
    background: var(--ds-gray-100);
    color: var(--ds-gray-700);
}

.header-item i {
    font-size: 20px;
}

.header-item .notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 20px;
    background: var(--ds-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    border: 2px solid #fff;
    display: none;
}

.header-profile-user {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ds-gray-200);
}

/* Search */
.app-search {
    flex: 1;
    max-width: 400px;
    margin: 0 var(--spacing-md);
}

.app-search .form-control {
    height: 40px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--ds-gray-200);
    padding-left: 40px;
    font-size: 14px;
    background: var(--ds-gray-50);
    transition: var(--transition-fast);
    width: 100%;
}

.app-search .form-control:focus {
    border-color: var(--ds-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(77,107,254,0.1);
    outline: none;
}

/* ========================================
   SIDEBAR
   ======================================== */
.vertical-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--ds-gray-900);
    z-index: 1001;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-base), width var(--transition-base);
    border-right: 1px solid rgba(255,255,255,0.06);
}

.vertical-menu::-webkit-scrollbar {
    width: 4px;
}

.vertical-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

#sidebar-menu {
    padding: var(--spacing-md) var(--spacing-sm) var(--spacing-xl);
}

#sidebar-menu .menu-title {
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.3);
}

#sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar-menu ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--spacing-md);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

#sidebar-menu ul li a i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    color: rgba(255,255,255,0.3);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

#sidebar-menu ul li a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

#sidebar-menu ul li a:hover i {
    color: rgba(255,255,255,0.7);
}

#sidebar-menu ul li a.active {
    background: rgba(77,107,254,0.15);
    color: #fff;
}

#sidebar-menu ul li a.active i {
    color: var(--ds-blue-light);
}

#sidebar-menu ul li a .badge {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(77,107,254,0.2);
    color: var(--ds-blue-light);
    flex-shrink: 0;
}

/* Sous-menus */
#sidebar-menu ul li .sub-menu {
    padding-left: 12px;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

#sidebar-menu ul li .sub-menu.show {
    max-height: 500px;
}

#sidebar-menu ul li .sub-menu li a {
    padding: 8px var(--spacing-md) 8px 48px;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    position: relative;
}

#sidebar-menu ul li .sub-menu li a::before {
    content: '';
    position: absolute;
    left: 28px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: var(--transition-fast);
}

#sidebar-menu ul li .sub-menu li a:hover::before {
    background: var(--ds-blue-light);
}

#sidebar-menu ul li .sub-menu li a.active {
    color: #fff;
}

#sidebar-menu ul li .sub-menu li a.active::before {
    background: var(--ds-blue-light);
}

/* Flèches */
#sidebar-menu ul li a.has-arrow::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    margin-left: auto;
    transition: transform var(--transition-base);
    opacity: 0.4;
    flex-shrink: 0;
}

#sidebar-menu ul li a.has-arrow.active::after {
    transform: rotate(180deg);
    opacity: 1;
}

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

.page-content {
    padding: var(--spacing-lg);
}

.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   PAGE TITLE
   ======================================== */
.page-title-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.page-title-box h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--ds-gray-900);
    margin: 0;
}

.page-title-box .breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 13px;
    color: var(--ds-gray-500);
}

.page-title-box .breadcrumb a {
    color: var(--ds-blue);
    text-decoration: none;
}

.page-title-box .breadcrumb a:hover {
    text-decoration: underline;
}

.page-title-box .breadcrumb .separator {
    color: var(--ds-gray-300);
}

.page-title-box .breadcrumb .active {
    color: var(--ds-gray-700);
    font-weight: 500;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: #fff;
    border: 1px solid var(--ds-gray-100);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ds-gray-700);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--ds-blue);
}

/* ========================================
   STATS CARDS
   ======================================== */
.stat-card {
    background: #fff;
    border: 1px solid var(--ds-gray-100);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue {
    background: var(--ds-blue-pale);
    color: var(--ds-blue);
}

.stat-card .stat-icon.green {
    background: rgba(46,204,113,0.12);
    color: var(--ds-green);
}

.stat-card .stat-icon.purple {
    background: rgba(108,92,231,0.12);
    color: var(--ds-purple);
}

.stat-card .stat-icon.orange {
    background: rgba(243,156,18,0.12);
    color: var(--ds-orange);
}

.stat-card .stat-number {
    font-size: 26px;
    font-weight: 700;
    color: var(--ds-gray-900);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--ds-gray-500);
    font-weight: 500;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: #fff;
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--ds-gray-200);
    color: var(--ds-gray-500);
    font-size: 13px;
    margin-top: auto;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 992px) {
    .vertical-menu {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .vertical-menu.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-search {
        display: none !important;
    }
    
    .navbar-brand-box .logo .brand-sub {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar-header {
        padding: 0 var(--spacing-md);
    }
    
    .page-content {
        padding: var(--spacing-md);
    }
    
    .page-title-box {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stat-card .stat-number {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .navbar-brand-box .logo .brand-text {
        font-size: 16px;
    }
    
    .navbar-brand-box .logo img {
        height: 32px;
    }
    
    .header-item {
        width: 34px;
        height: 34px;
    }
    
    .header-item i {
        font-size: 16px;
    }
    
    .header-profile-user {
        width: 30px;
        height: 30px;
    }
}

/* ========================================
   DARK THEME
   ======================================== */
body.dark-theme {
    --ds-gray-50: #0F172A;
    --ds-gray-100: #1E293B;
    --ds-gray-200: #334155;
    --ds-gray-300: #475569;
    --ds-gray-400: #64748B;
    --ds-gray-500: #94A3B8;
    --ds-gray-600: #CBD5E1;
    --ds-gray-700: #E2E8F0;
    --ds-gray-800: #F1F4F9;
    --ds-gray-900: #F8FAFC;
}

body.dark-theme #page-topbar {
    background: var(--ds-gray-100);
    border-color: var(--ds-gray-200);
}

body.dark-theme .navbar-brand-box .logo .brand-text {
    color: #fff;
}

body.dark-theme .card,
body.dark-theme .stat-card {
    background: var(--ds-gray-100);
    border-color: var(--ds-gray-200);
}

body.dark-theme .footer {
    background: var(--ds-gray-100);
    border-color: var(--ds-gray-200);
}

body.dark-theme .header-item {
    color: var(--ds-gray-400);
}

body.dark-theme .header-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

body.dark-theme .app-search .form-control {
    background: var(--ds-gray-100);
    border-color: var(--ds-gray-200);
    color: var(--ds-gray-300);
}

body.dark-theme .app-search .form-control:focus {
    background: var(--ds-gray-100);
}

body.dark-theme .header-item .notification-badge {
    border-color: var(--ds-gray-100);
}