/**
 * SHARED CSS - Application Sectorisation Updata
 * Styles partagés pour toutes les pages
 * Version 2.0 - Optimisation UX
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Couleurs principales */
    --primary: #0075c9;
    --primary-dark: #005a9e;
    --primary-light: #e0f2fe;
    --primary-hover: #0066b3;
    
    /* Couleurs secondaires */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    
    /* Neutres */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Layout */
    --sidebar-width: 240px;
    --header-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ========================================
   BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.logo img {
    max-width: 120px;
    height: auto;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.project-badge {
    background: rgba(255,255,255,0.1);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    backdrop-filter: blur(10px);
}

.project-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}

.project-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
}

/* Navigation Section */
.nav-section {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
    padding: 0 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    margin-bottom: 4px;
    position: relative;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: translateX(2px);
}

.nav-btn.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #fff;
    border-radius: 0 2px 2px 0;
}

.nav-btn-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.nav-icon {
    font-size: 16px;
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Special highlight for Optimisation IA */
.nav-btn.highlight {
    background: linear-gradient(90deg, rgba(139,92,246,0.2), rgba(139,92,246,0.05));
    border: 1px solid rgba(139,92,246,0.3);
}

.nav-btn.highlight:hover {
    background: linear-gradient(90deg, rgba(139,92,246,0.3), rgba(139,92,246,0.1));
}

/* Navigation Divider */
.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 8px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius-sm);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-back:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px;
    background: var(--gray-50);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-icon {
    font-size: 28px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--primary-dark);
}

.breadcrumb-separator {
    color: var(--gray-300);
}

/* ========================================
   FILTERS BAR
   ======================================== */
.filters-bar {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-xs);
    font-size: 13px;
    min-width: 180px;
    background: white;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-select:hover {
    border-color: var(--gray-300);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,117,201,0.1);
}

/* Filter Checkboxes (Marchés) */
.filter-checkboxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--border-radius-xs);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.filter-checkbox:hover {
    transform: translateY(-1px);
}

.filter-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.filter-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   STATS CARDS
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-value.blue { color: var(--primary); }
.stat-value.green { color: var(--success); }
.stat-value.orange { color: var(--warning); }
.stat-value.red { color: var(--danger); }
.stat-value.purple { color: var(--purple); }

.stat-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ========================================
   CARDS
   ======================================== */
.card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 4px rgba(0,117,201,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,117,201,0.4);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 2px 4px rgba(16,185,129,0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16,185,129,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-xs);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   TABLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--gray-50);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

th.sortable:hover {
    background: var(--gray-100);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

tr:hover td {
    background: var(--gray-50);
}

tr.modified td {
    background: var(--info-light);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 600; }
.text-nowrap { white-space: nowrap; }

.text-blue { color: var(--primary); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-orange { color: var(--warning); }
.text-gray { color: var(--gray-500); }

/* Cell Badges */
.cell-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.cell-badge-success {
    background: var(--success-light);
    color: var(--success);
}

.cell-badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.cell-badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.cell-badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: var(--gray-600);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius-xs);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 100px;
    border-radius: var(--border-radius);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 450px;
    transform: translateX(120%);
    transition: transform var(--transition-slow);
    border-left: 4px solid var(--gray-400);
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    transition: color var(--transition);
}

.toast-close:hover {
    color: var(--gray-600);
}

/* ========================================
   PROGRESS INDICATOR
   ======================================== */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 4px;
    transition: width var(--transition-slow);
}

/* Step Progress */
.step-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    background: var(--gray-100);
    transition: all var(--transition);
}

.step.active {
    background: var(--primary);
    color: white;
}

.step.completed {
    background: var(--success-light);
    color: var(--success);
}

.step-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    font-weight: 600;
    font-size: 12px;
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--gray-200);
    min-width: 20px;
}

.step-connector.completed {
    background: var(--success);
}

/* ========================================
   MODAL
   ======================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-xs);
    font-size: 14px;
    transition: all var(--transition);
}

.form-input:hover {
    border-color: var(--gray-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,117,201,0.1);
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: var(--gray-500);
    max-width: 400px;
    margin-bottom: 24px;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn { animation: fadeIn var(--transition-slow) ease; }
.animate-slideUp { animation: slideUp var(--transition-slow) ease; }
.animate-slideDown { animation: slideDown var(--transition-slow) ease; }
.animate-scaleIn { animation: scaleIn var(--transition-slow) ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* Staggered animations for lists */
.stagger-animation > * {
    opacity: 0;
    animation: slideUp var(--transition-slow) ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
.stagger-animation > *:nth-child(2) { animation-delay: 50ms; }
.stagger-animation > *:nth-child(3) { animation-delay: 100ms; }
.stagger-animation > *:nth-child(4) { animation-delay: 150ms; }
.stagger-animation > *:nth-child(5) { animation-delay: 200ms; }
.stagger-animation > *:nth-child(6) { animation-delay: 250ms; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   UTILITIES
   ======================================== */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.rounded { border-radius: var(--border-radius-sm); }
.shadow { box-shadow: var(--shadow); }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   ENHANCED INTERACTIONS
   ======================================== */

/* Card hover effects */
.card-interactive {
    transition: all var(--transition);
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Ripple effect for buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform .5s, opacity 1s;
}

.btn-ripple:active::after {
    transform: scale(0, 0);
    opacity: .3;
    transition: 0s;
}

/* Glow effect for important elements */
.glow-success {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-primary {
    box-shadow: 0 0 20px rgba(0, 117, 201, 0.3);
}

.glow-warning {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Animated border */
.border-animate {
    position: relative;
}

.border-animate::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(90deg, var(--primary), var(--purple), var(--primary));
    background-size: 200% 100%;
    animation: borderGradient 2s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes borderGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Number counter animation */
.count-up {
    animation: countUp 0.8s ease-out forwards;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success checkmark animation */
.checkmark-animate {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkmark 0.5s ease-out forwards;
}

@keyframes checkmark {
    to {
        stroke-dashoffset: 0;
    }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Bounce animation */
.bounce {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Focus ring for accessibility */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 117, 201, 0.3);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 6px 12px;
    background: var(--gray-800);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    pointer-events: none;
    z-index: 1000;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: var(--gray-800);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    pointer-events: none;
    z-index: 1000;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Status indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background: var(--gray-400);
}

.status-dot.busy {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

/* Improved scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Selection colors */
::selection {
    background: rgba(0, 117, 201, 0.2);
    color: var(--gray-800);
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .toast-container,
    .loading-overlay,
    .btn {
        display: none !important;
    }
    
    .main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}

/* ========================================
   NAVIGATION SIDEBAR - STYLE UNIFIÉ
   ======================================== */

/* Navigation verticale - un bouton par ligne */
.nav-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
}

.nav-vertical .nav-link {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.nav-vertical .nav-link:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.nav-vertical .nav-link.active {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.nav-vertical .nav-link.ia {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(139,92,246,0.4);
    text-align: center;
}

.nav-vertical .nav-link.ia:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 4px 12px rgba(139,92,246,0.5);
}

.nav-vertical .nav-sep {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 6px 0;
}

.nav-vertical .nav-title {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 14px 4px;
}

/* Masquer le bouton quick-nav flottant */
.quick-nav-trigger,
.quick-nav-popup {
    display: none !important;
}

/* ========================================
   BOUTON TOGGLE SIDEBAR
   ======================================== */
.sidebar-toggle {
    position: fixed;
    left: var(--sidebar-width, 220px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 48px;
    background: white;
    border: 1px solid #e2e8f0;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: left 0.3s ease, background 0.2s ease;
    font-size: 14px;
    color: #64748b;
    box-shadow: 2px 0 6px rgba(0,0,0,0.08);
}

.sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--primary, #0075c9);
}

.sidebar-toggle .chevron {
    transition: transform 0.3s ease;
}

body.sidebar-collapsed .sidebar-toggle {
    left: 0;
}

body.sidebar-collapsed .sidebar-toggle .chevron {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main {
    margin-left: 0;
}

.sidebar {
    transition: transform 0.3s ease;
}

.main {
    transition: margin-left 0.3s ease;
}

/* ========================================
   POPUP UGA - STYLE COMPACT ET MODERNE
   ======================================== */

/* Container Leaflet */
.uga-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18) !important;
    overflow: hidden;
}

.uga-popup .leaflet-popup-content {
    margin: 0 !important;
    min-width: 220px;
    width: auto !important;
}

.uga-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,0.9) !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    padding: 4px 8px !important;
    right: 6px !important;
    top: 6px !important;
    z-index: 10;
    width: auto !important;
    height: auto !important;
}

.uga-popup .leaflet-popup-close-button:hover {
    color: white !important;
    background: rgba(255,255,255,0.2) !important;
    border-radius: 4px;
}

/* Contenu du popup */
.uga-popup-content {
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    max-width: 360px;
    background: white;
}

.uga-popup-header {
    background: linear-gradient(135deg, #0075c9 0%, #0066b3 100%);
    color: white;
    padding: 12px 40px 12px 14px;
}

.uga-popup-header .uga-code {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.3px;
}

.uga-popup-header .uga-name {
    opacity: 0.92;
    font-size: 12px;
    margin-left: 6px;
    font-weight: 400;
}

.uga-popup-body {
    padding: 12px;
}

/* Section équipes */
.uga-teams {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.uga-team-col {
    flex: 1;
    min-width: 0;
}

.uga-team-col.uga-team-projet {
    padding-left: 12px;
    border-left: 2px solid #10b981;
}

.uga-team-label {
    font-size: 9px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.uga-team-label.projet {
    color: #059669;
}

.uga-team-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.3;
}

/* Badges délégués */
.uga-delegue-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
}

.uga-delegue-badge.projet {
    background: #ecfdf5;
    color: #065f46;
}

.uga-delegue-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    flex-shrink: 0;
}

.uga-no-delegue {
    color: #94a3b8;
    font-size: 11px;
    font-style: italic;
}

/* Tableau de données */
.uga-data-table {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.uga-data-table table {
    width: 100%;
    min-width: 300px;
    border-collapse: collapse;
    font-size: 10px;
    table-layout: fixed;
}

/* Colonne des libellés (Marché, Produit, PDM, Cibles) : largeur fixe.
   Les colonnes BU se partagent équitablement l'espace restant. */
.uga-data-table td:first-child {
    width: 46px;
}

.uga-data-table td {
    padding: 5px 6px;
    text-align: center;
    border: none;
    color: #334155;
    font-weight: 500;
    word-break: normal;
    overflow-wrap: break-word;
}

.uga-data-table .header-row td {
    background: #f8fafc;
    padding: 4px 5px;
}

.uga-data-table .marche-header {
    font-weight: 700;
    color: #0075c9;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.uga-data-table .row-label {
    text-align: left;
    color: #64748b;
    font-weight: 600;
    font-size: 10px;
    white-space: nowrap;
    padding-left: 8px;
}

.uga-data-table .alt-row td {
    background: #f8fafc;
}

.uga-data-table .pdm-value {
    font-weight: 700;
    color: #0075c9;
}

/* Scrollbar fine */
.uga-data-table::-webkit-scrollbar {
    height: 5px;
}

.uga-data-table::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.uga-data-table::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.uga-data-table::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
