:root {
    /* Colors - Light Theme Premium */
    --bg-main: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    
    --success: #059669;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #d97706;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #dc2626;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #2563eb;
    --info-bg: rgba(59, 130, 246, 0.15);
    
    --border-color: #e2e8f0;
    
    /* Metrics */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed);
    z-index: 100;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.logo-text .highlight {
    color: var(--accent-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-speed);
    position: relative;
}

.nav-link:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.nav-item.active .nav-link {
    background-color: var(--accent-primary);
    color: white;
}

.nav-icon {
    width: 24px;
    font-size: 16px;
    margin-right: 12px;
}

.badge {
    background-color: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 90;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    width: 300px;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.search-icon {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-icon-wrapper.sales { background-color: var(--success-bg); color: var(--success); }
.kpi-icon-wrapper.orders { background-color: var(--info-bg); color: var(--info); }
.kpi-icon-wrapper.pending { background-color: var(--warning-bg); color: var(--warning); }
.kpi-icon-wrapper.conversion { background-color: var(--accent-primary); color: white; background: rgba(99, 102, 241, 0.1); color: var(--accent-primary); }

.kpi-details {
    flex: 1;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.kpi-trend {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend span {
    color: var(--text-secondary);
    font-weight: 400;
}

.positive { color: var(--success); }
.negative { color: var(--danger); }
.neutral { color: var(--text-secondary); }

/* Section & Table */
.section-container {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
}

.view-all {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.3s;
}

.view-all:hover {
    gap: 10px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
}

.data-table tbody tr {
    transition: background-color 0.3s;
}

.data-table tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-completed { background-color: var(--success-bg); color: var(--success); }
.status-pending { background-color: var(--warning-bg); color: var(--warning); }
.status-processing { background-color: var(--info-bg); color: var(--info); }
.status-cancelled { background-color: var(--danger-bg); color: var(--danger); }

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

.client-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.client-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.order-id {
    font-weight: 600;
    color: var(--accent-primary);
}

/* ================================ */
/* NOUVEAU DESIGN : HUB & SIDEBAR   */
/* ================================ */

/* Hub Buttons */
.hub-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 24px 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    gap: 12px;
}

.hub-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
}

.hub-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.hub-btn:hover .hub-icon {
    transform: scale(1.1);
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 80px;
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-link span:not(.badge) {
    display: none;
}
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}
.sidebar.collapsed .nav-icon {
    margin-right: 0;
    font-size: 20px;
}
.sidebar.collapsed .badge {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    padding: 2px 5px;
    border: 2px solid var(--bg-secondary);
}
.sidebar-header {
    transition: padding 0.3s ease;
}
.sidebar.collapsed .sidebar-header {
    padding: 20px 0;
    justify-content: center !important;
}
.sidebar.collapsed .sidebar-toggle {
    margin: 0;
    padding: 10px;
}
.dashboard-container {
    transition: all 0.3s ease;
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
    /* Cache la sidebar completement quand elle est collapsed sur mobile */
    .sidebar {
        position: fixed;
        height: 100vh;
        left: 0;
        top: 0;
        z-index: 9999;
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.collapsed {
        left: -260px; /* Cache totalement */
        width: 260px;
    }
    .main-content {
        width: 100%;
    }
    .mobile-toggle-btn {
        display: block !important;
    }
    
    /* Boutons et grilles */
    .quick-actions-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .hub-btn {
        padding: 10px;
        font-size: 11px;
    }
    .hub-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    /* KPIs */
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Modale Vente Magasin (Caisse Rapide) */
    .modal-content {
        width: 95% !important;
        padding: 0 !important;
    }
    
    /* Ajustements modale Vente Magasin */
    #venteVentePhoto {
        width: 70px !important;
        height: 90px !important;
        min-width: 70px !important;
    }
    #venteVenteCode {
        font-size: 20px !important;
    }
    #venteVentePrixBase {
        font-size: 20px !important;
    }
    #venteVentePrixFinal {
        font-size: 24px !important;
    }
    #venteVenteReste {
        font-size: 18px !important;
    }
    
    /* Tableaux */
    .table-responsive {
        overflow-x: auto;
    }
}

