@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
    /* Couleurs principales */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #e0e7ff;
    --primary-100: #dbeafe;

    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);

    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);

    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);

    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);

    --danger-600: rgba(184, 17, 17, 0.6);
    --danger-50: rgba(184, 17, 17, 0.5);

    /* Nouvelles variables pour le user menu */
    --primary-500: #667eea;
    --primary-600: #5568d3;
    --primary-50: #e0e7ff;

    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;

    --danger-700: #b91c1c;

    /* Shadow */
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);


    /* Couleurs neutres */
    --white: #ffffff;
    --black: #000000;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;

    --text-primary: #1f2937;
    --text-secondary: #6b7280;

    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;

    /* Espacement */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border radius */
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Ombres */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-base: 0.3s ease-in-out;

    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 0.9rem;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    overflow-x: hidden;
    max-width: 100vw;
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================================
   SELECTION
   ======================================== */
::selection {
    background-color: var(--primary-100);
    color: var(--primary-dark);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.0rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.8rem; }
h6 { font-size: 0.6rem; }

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   BUTTONS
   ======================================== */
button {
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-base);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--gray-300);
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.6rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--text-secondary);
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-xl);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

.card-subtitle {
    font-size: 0.7rem;
    margin: 0.25rem 0 0 0;
    color: var(--text-secondary);
}

.card-body {
    padding: var(--spacing-xl);
}

.card-footer {
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

.card-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* ========================================
   FORMS
   ======================================== */
input, textarea, select {
    font-family: var(--font-sans);
    outline: none;
}

.form-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--spacing-xl);
    max-width: 1400px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.8rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-control.is-invalid {
    border-color: var(--danger);
    background: #fef2f2;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-help {
    display: block;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    line-height: 1.4;
}

.form-error {
    display: none;
    color: var(--danger);
    font-size: 0.6rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

/* Form Switch */
.form-switch-container {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all 0.3s ease;
}

.form-switch-input {
    display: none;
}

.form-switch-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.form-switch-indicator {
    width: 52px;
    height: 28px;
    background: var(--gray-300);
    border-radius: 28px;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.form-switch-indicator::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-switch-input:checked + .form-switch-label .form-switch-indicator {
    background: var(--success);
}

.form-switch-input:checked + .form-switch-label .form-switch-indicator::after {
    transform: translateX(24px);
}

.form-switch-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.form-switch-description {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Input with icon */
.input-wrapper {
    position: relative;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-control {
    padding-right: 3rem;
}

.form-control.has-icon-left {
    padding-left: 3rem;
}

.form-control.has-icon-right {
    padding-right: 3rem;
}

.input-icon-left {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.input-icon-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
    z-index: 1;
}

.input-icon-btn:hover {
    color: var(--primary);
}

/* ========================================
   TABLES
   ======================================== */
.table, .stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.table thead th, .stats-table thead th {
    padding: 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td, .stats-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9375rem;
}

.table tbody tr:hover, .stats-table tbody tr:hover {
    background: var(--gray-50);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* ========================================
   KPI CARDS
   ======================================== */
.stats-grid-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    display: flex;
    gap: var(--spacing-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.kpi-card.kpi-primary::before { background: linear-gradient(135deg, #667eea, #764ba2); }
.kpi-card.kpi-success::before { background: linear-gradient(135deg, #10b981, #059669); }
.kpi-card.kpi-info::before { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.kpi-card.kpi-danger::before { background: linear-gradient(135deg, #ef4444, #dc2626); }

.kpi-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.kpi-primary .kpi-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
}

.kpi-success .kpi-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    color: #10b981;
}

.kpi-info .kpi-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    color: #3b82f6;
}

.kpi-danger .kpi-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: #ef4444;
}

.kpi-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kpi-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    transition: transform 0.2s ease;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.kpi-trend i {
    font-size: 0.75rem;
}

.kpi-trend.positive {
    color: var(--success);
}

.kpi-trend.negative {
    color: var(--danger);
}

.kpi-trend-label {
    color: var(--text-secondary);
    font-weight: 400;
}

.kpi-progress {
    height: 8px;
    background: var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.kpi-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 8px;
    transition: width 1s ease;
}

/* ========================================
   CHARTS
   ======================================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chart-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.chart-title i {
    color: var(--primary);
}

.chart-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
}

.chart-body {
    padding: var(--spacing-xl);
    position: relative;
    min-height: 300px;
}

/* ========================================
   ALERTS
   ======================================== */
.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-md);
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: white;
    border-left: 4px solid;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alert-item.alert-warning {
    border-color: var(--warning);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05), white);
}

.alert-item.alert-danger {
    border-color: var(--danger);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), white);
}

.alert-item.alert-info {
    border-color: var(--info);
    background: linear-gradient(to right, rgba(59, 130, 246, 0.05), white);
}

.alert-item.alert-success {
    border-color: var(--success);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05), white);
}

.alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.alert-warning .alert-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.alert-danger .alert-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.alert-info .alert-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.alert-success .alert-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.alert-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.alert-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.alert-action:hover {
    gap: 0.625rem;
    text-decoration: underline;
}

.alert-dismiss {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
}

.alert-item:hover .alert-dismiss {
    opacity: 1;
}

.alert-dismiss:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.no-alerts {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(59, 130, 246, 0.05));
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-200);
}

.no-alerts-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--success), var(--info));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.no-alerts-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.no-alerts-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    font-size: 1.0rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
}

/* ========================================
   PERIOD SELECTOR
   ======================================== */
.period-selector {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.period-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.period-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.period-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.period-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.custom-period {
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--gray-200);
}

/* ========================================
   INFO & HELP CARDS
   ======================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-label i {
    color: var(--primary);
    width: 16px;
}

.info-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.help-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.help-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.help-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.help-card-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.help-card-body {
    padding: var(--spacing-lg);
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-list li {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: var(--gray-50);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.help-list li:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.help-list li strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.7rem;
}

.help-list li p {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ========================================
   UTILITIES
   ======================================== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: var(--spacing-sm);
}

.gap-2 {
    gap: var(--spacing-md);
}

.gap-3 {
    gap: var(--spacing-lg);
}

.filters-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-in;
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-base) ease-out;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-base) ease-out;
}

.animate-slide-in-up {
    animation: slideInUp var(--transition-base) ease-out;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .form-container {
        grid-template-columns: 1fr;
    }

    .help-card {
        position: static;
        max-height: none;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .stats-grid-kpi {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid-kpi {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .alerts-grid {
        grid-template-columns: 1fr;
    }

    .period-buttons {
        flex-direction: column;
    }

    .period-btn {
        width: 100%;
    }

    .kpi-card {
        padding: var(--spacing-lg);
    }

    .kpi-icon {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }

    .kpi-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 640px) {
    .modal {
        padding: 0;
    }

    .modal-container {
        max-height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .kpi-card {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }

    .kpi-icon {
        margin: 0 auto;
    }

    .kpi-content {
        align-items: center;
    }

    .kpi-trend {
        justify-content: center;
    }



}

/* ========================================
   TIMELINE - Style Moderne
   ======================================== */

.timeline-liste {
    position: relative;
    padding: var(--spacing-lg) 0;
}

/* Ligne verticale de la timeline */
.timeline-liste::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
            to bottom,
            var(--primary-light) 0%,
            var(--primary) 50%,
            var(--primary-light) 100%
    );
    border-radius: 3px;
    opacity: 0.3;
}

/* ========================================
   TIMELINE ITEM
   ======================================== */

.timeline-item {
    position: relative;
    padding-left: 70px;
    padding-bottom: var(--spacing-xl);
    opacity: 0;
    transform: translateX(-20px);
    animation: timelineSlideIn 0.5s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.15s; }
.timeline-item:nth-child(3) { animation-delay: 0.2s; }
.timeline-item:nth-child(4) { animation-delay: 0.25s; }
.timeline-item:nth-child(5) { animation-delay: 0.3s; }
.timeline-item:nth-child(6) { animation-delay: 0.35s; }
.timeline-item:nth-child(7) { animation-delay: 0.4s; }
.timeline-item:nth-child(8) { animation-delay: 0.45s; }
.timeline-item:nth-child(9) { animation-delay: 0.5s; }
.timeline-item:nth-child(10) { animation-delay: 0.55s; }

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Hover effect sur toute la timeline-item */
.timeline-item:hover .timeline-content {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.1);
}

/* ========================================
   TIMELINE DOT (Cercle avec icône)
   ======================================== */

.timeline-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Effet de pulsation pour le premier élément */
.timeline-item:first-child .timeline-dot {
    animation: timelinePulse 2s ease-in-out infinite;
}

@keyframes timelinePulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

/* Variantes de couleur pour les dots */
.timeline-dot.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.timeline-dot.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.timeline-dot.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.timeline-dot.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.timeline-dot.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

/* Icône dans le dot */
.timeline-dot i {
    position: relative;
    z-index: 1;
}

/* ========================================
   TIMELINE CONTENT (Carte de contenu)
   ======================================== */

.timeline-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Barre colorée sur le côté gauche */
.timeline-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-item:hover .timeline-content::before {
    opacity: 1;
}

/* Variantes de couleur pour la barre */
.timeline-item:has(.timeline-dot.success) .timeline-content::before {
    background: var(--success);
}

.timeline-item:has(.timeline-dot.danger) .timeline-content::before {
    background: var(--danger);
}

.timeline-item:has(.timeline-dot.info) .timeline-content::before {
    background: var(--info);
}

.timeline-item:has(.timeline-dot.warning) .timeline-content::before {
    background: var(--warning);
}

/* ========================================
   TIMELINE DATE
   ======================================== */

.timeline-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.timeline-date::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.timeline-item:hover .timeline-date {
    background: var(--primary-light);
    color: var(--primary);
}

/* ========================================
   TIMELINE TITLE
   ======================================== */

.timeline-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.timeline-item:hover .timeline-title {
    color: var(--primary);
}

/* ========================================
   TIMELINE DETAIL
   ======================================== */

.timeline-detail {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-detail::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
}

/* ========================================
   TIMELINE MORE (Indicateur "plus d'événements")
   ======================================== */

.timeline-more {
    text-align: center;
    padding-top: var(--spacing-md);
    margin-left: 70px;
}

.timeline-more-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
    cursor: pointer;
}

.timeline-more-text:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
}

.timeline-more-text i {
    font-size: 0.75rem;
}

/* ========================================
   TIMELINE EMPTY STATE
   ======================================== */

.timeline-empty {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-secondary);
}

.timeline-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--gray-400);
}

.timeline-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.timeline-empty-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes timelineSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation de chargement */
@keyframes timelineShimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.timeline-loading .timeline-content {
    background: linear-gradient(
            90deg,
            var(--gray-100) 0%,
            var(--gray-200) 20%,
            var(--gray-100) 40%,
            var(--gray-100) 100%
    );
    background-size: 1000px 100%;
    animation: timelineShimmer 1.5s linear infinite;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .timeline-liste::before {
        left: 18px;
    }

    .timeline-item {
        padding-left: 56px;
    }

    .timeline-dot {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .timeline-content {
        padding: var(--spacing-md);
    }

    .timeline-title {
        font-size: 0.9375rem;
    }

    .timeline-date {
        font-size: 0.75rem;
    }

    .timeline-more {
        margin-left: 56px;
    }
}

@media (max-width: 480px) {
    .timeline-liste::before {
        left: 14px;
    }

    .timeline-item {
        padding-left: 48px;
    }

    .timeline-dot {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
}

/* ========================================
   DARK MODE (Optionnel)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .timeline-content {
        background: #1f2937;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .timeline-date {
        background: #374151;
        color: #9ca3af;
    }

    .timeline-title {
        color: #f3f4f6;
    }

    .timeline-detail {
        color: #9ca3af;
    }

    .timeline-more-text {
        background: #374151;
        color: #9ca3af;
    }
}

/* ========================================
   VARIANTES SUPPLÉMENTAIRES
   ======================================== */

/* Timeline compacte */
.timeline-liste.compact .timeline-item {
    padding-bottom: var(--spacing-md);
}

.timeline-liste.compact .timeline-dot {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.timeline-liste.compact .timeline-content {
    padding: var(--spacing-md);
}

/* Timeline avec connexion */
.timeline-item.connected::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 48px;
    bottom: -12px;
    width: 2px;
    background: var(--gray-200);
    z-index: 0;
}

.timeline-item:last-child.connected::after {
    display: none;
}


/* ========================================
   LISTE DES PAIEMENTS - Style Moderne
   ======================================== */

.paiement-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--spacing-lg);
    align-items: center;
    padding: var(--spacing-lg);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Barre colorée sur le côté gauche */
.paiement-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.paiement-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.paiement-item:hover::before {
    opacity: 1;
}

/* ========================================
   SECTION PRINCIPALE (Icône + Info)
   ======================================== */

.paiement-main {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    min-width: 0; /* Pour le text-overflow */
}

.paiement-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.paiement-item:hover .paiement-icon {
    transform: scale(1.1) rotate(5deg);
}

.paiement-icon i {
    font-size: 1.25rem;
}

/* Informations du paiement */
.paiement-info {
    flex: 1;
    min-width: 0;
}

.paiement-montant {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    line-height: 1.2;
}

.paiement-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.paiement-details i {
    opacity: 0.6;
    font-size: 0.75rem;
}

.paiement-separator {
    color: var(--gray-300);
    font-weight: 600;
}

.paiement-type {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   MÉTHODE DE PAIEMENT
   ======================================== */

.paiement-methode {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
    padding: 0 var(--spacing-md);
    border-right: 1px solid var(--gray-200);
    min-width: 140px;
}

.paiement-methode-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.paiement-methode-label i {
    color: var(--primary);
    font-size: 0.875rem;
}

.paiement-reference {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

/* ========================================
   BOUTONS D'ACTION
   ======================================== */

.paiement-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.paiement-actions .btn {
    transition: all 0.3s ease;
    opacity: 0.7;
}

.paiement-item:hover .paiement-actions .btn {
    opacity: 1;
}

.paiement-actions .btn:hover {
    transform: translateY(-2px);
}

.paiement-actions .btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.paiement-actions .btn-outline-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Style pour les boutons sm */
.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    min-width: 40px;
}

.btn-sm i {
    font-size: 0.875rem;
}

/* ========================================
   ÉTATS VIDES
   ======================================== */

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--gray-50), white);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
}

.empty-state i {
    display: block;
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* ========================================
   ANIMATIONS
   ======================================== */

/* Animation d'entrée pour les paiements */
@keyframes paiementSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.paiement-item {
    animation: paiementSlideIn 0.4s ease forwards;
}

/* Délai progressif pour chaque élément */
.paiement-item:nth-child(1) { animation-delay: 0.05s; }
.paiement-item:nth-child(2) { animation-delay: 0.1s; }
.paiement-item:nth-child(3) { animation-delay: 0.15s; }
.paiement-item:nth-child(4) { animation-delay: 0.2s; }
.paiement-item:nth-child(5) { animation-delay: 0.25s; }
.paiement-item:nth-child(6) { animation-delay: 0.3s; }
.paiement-item:nth-child(7) { animation-delay: 0.35s; }
.paiement-item:nth-child(8) { animation-delay: 0.4s; }
.paiement-item:nth-child(9) { animation-delay: 0.45s; }
.paiement-item:nth-child(10) { animation-delay: 0.5s; }

/* Animation de suppression */
@keyframes paiementSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.paiement-item.deleting {
    animation: paiementSlideOut 0.3s ease forwards;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .paiement-item {
        grid-template-columns: 1fr auto;
        gap: var(--spacing-md);
    }

    .paiement-methode {
        display: none; /* Masquer sur tablette */
    }

    /* Ajouter la méthode dans les détails */
    .paiement-details::after {
        content: attr(data-methode);
        padding-left: 0.5rem;
    }
}

@media (max-width: 768px) {
    .paiement-item {
        grid-template-columns: 1fr;
        padding: var(--spacing-md);
    }

    .paiement-main {
        gap: var(--spacing-sm);
    }

    .paiement-icon {
        width: 40px;
        height: 40px;
    }

    .paiement-icon i {
        font-size: 1rem;
    }

    .paiement-montant {
        font-size: 1rem;
    }

    .paiement-details {
        font-size: 0.75rem;
        flex-wrap: wrap;
    }

    .paiement-actions {
        justify-content: flex-end;
        width: 100%;
        padding-top: var(--spacing-sm);
        border-top: 1px solid var(--gray-200);
        margin-top: var(--spacing-sm);
    }

    .paiement-actions .btn {
        flex: 1;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .paiement-actions .btn {
        padding: 0.5rem;
        min-width: 36px;
    }

    .paiement-actions .btn span {
        display: none; /* Masquer le texte, garder juste l'icône */
    }
}

/* ========================================
   BADGES DE TYPE (Optionnel)
   ======================================== */

.paiement-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.paiement-type-badge.loyer {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.paiement-type-badge.caution {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.paiement-type-badge.remboursement {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.paiement-type-badge.penalite {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ========================================
   DARK MODE (Optionnel)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .paiement-item {
        background: #1f2937;
        border-color: #374151;
    }

    .paiement-item:hover {
        border-color: #4b5563;
    }

    .paiement-montant {
        color: #f3f4f6;
    }

    .paiement-details {
        color: #9ca3af;
    }

    .paiement-reference {
        background: #374151;
        color: #d1d5db;
    }

    .empty-state {
        background: linear-gradient(135deg, #1f2937, #111827);
        border-color: #374151;
    }
}

/* ========================================
      FILTERS GRID
   ======================================== */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

/* ========================================
   MODAL STYLES
======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    margin: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    padding: var(--spacing-xl);
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: var(--spacing-xl);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

/* ========================================
   TABLE ACTIONS
======================================== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* ========================================
   BADGES
======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.badge-entree {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-depense {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ========================================
   MONTANTS
======================================== */
.montant-entree {
    color: #059669;
    font-weight: 600;
}

.montant-depense {
    color: #dc2626;
    font-weight: 600;
}

/* ========================================
   PAGINATION
======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
}

/* ========================================
   BADGES ADDITIONNELS CAISSE
======================================== */
.date-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.date-badge i {
    color: var(--primary);
    opacity: 0.6;
}

.categorie-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #7c5f00;
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #666;
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #e5a66f);
    color: #4d3319;
}

.rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
    background: var(--gray-200);
    color: var(--text-secondary);
}

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
}

.type-badge.type-studio {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.type-badge.type-une-piece {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.type-badge.type-deux-pieces {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.type-badge.type-default {
    background: var(--gray-100);
    color: var(--text-secondary);
}

.taux-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.taux-bar-bg {
    flex: 1;
    height: 8px;
    background: var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
}

.taux-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
}

.taux-value {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.no-alerts {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-alerts-icon {
    font-size: 4rem;
    color: var(--success);
    opacity: 0.2;
    margin-bottom: 1rem;
}

.no-alerts-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.no-alerts-text {
    font-size: 0.9375rem;
    margin: 0;
}



/* ========================================
   ANIMATIONS
======================================== */
@keyframes alert-fade-out {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

.alert-enter {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.alert-dismiss:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        flex-direction: column;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid-kpi {
        grid-template-columns: 1fr;
    }

    .stats-table {
        font-size: 0.8125rem;
    }

    .stats-table th,
    .stats-table td {
        padding: 0.75rem 0.5rem;
    }
}




/* ========================================
   SWAL2 Z-INDEX
   ======================================== */


/* ========================================
   CORRECTION Z-INDEX - MODALS AU-DESSUS DU HEADER
   ======================================== */

/* Header principal */
header,
.navbar,
.main-header {
    z-index: 100;
}

/* Sidebar */
.sidebar,
.main-sidebar {
    z-index: 90;
}

/* Overlay du modal (fond sombre) */
.modal-overlay,
.swal2-container {
    z-index: 1050 !important;  /* Au-dessus du header */
}

/* Modal container */
.modal,
.modal-container,
.swal2-popup {
    z-index: 1060 !important;  /* Au-dessus de l'overlay */
}

/* Dropdowns et tooltips dans les modals */
.modal .dropdown-menu,
.modal .tooltip,
.swal2-popup .dropdown-menu {
    z-index: 1070 !important;
}

/* Toast notifications */
.toast,
.swal2-container {
    z-index: 99999 !important;
}
/* ========================================
   USER MENU DROPDOWN - Utilisant vos variables existantes
   ======================================== */

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.user-menu:hover {
    background: var(--gray-50);
}

.user-menu.active {
    background: var(--gray-100);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Dropdown Content */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-menu.active .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-100));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.user-menu-info {
    flex: 1;
    min-width: 0;
}

.user-menu-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.user-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.user-menu-item-danger {
    color: var(--danger);
}

.user-menu-item-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .user-info {
        display: none;
    }

    .user-menu-dropdown {
        width: 260px;
        right: -1rem;
    }
}

/* Container parent pour le positionnement */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.3s;
    cursor: pointer;
    user-select: none;
}

.user-menu:hover {
    background: #f0f2f5;
}

/* Le menu caché par défaut */
.dropdown-content {
    display: none; /* Caché */
    position: absolute;
    right: 0;
    top: 110%; /* Juste en dessous du déclencheur */
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    border-radius: 10px;
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

/* Classe pour afficher le menu via JS */
.dropdown-content.show {
    display: block;
}

/* Éléments du menu */
.dropdown-header {
    padding: 12px 16px;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

.dropdown-content a i {
    width: 16px;
    color: #666;
}

.dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 4px 0;
}

.logout-link {
    color: #dc3545 !important;
}

.logout-link:hover {
    background-color: #fff5f5 !important;
}

/* Petite animation */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rotation de la flèche */
.user-menu-container.active .arrow-icon {
    transform: rotate(180deg);
}
.arrow-icon { transition: transform 0.3s; }


/* Positionnement du Dropdown */
.user-menu-container {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #ffffff;
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 1000;
    overflow: hidden;
    padding: 8px 0;
}

/* Affichage dynamique */
.dropdown-content.show {
    display: block;
    animation: fadeInMove 0.2s ease-out;
}

/* Éléments internes */
.dropdown-header {
    padding: 10px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #334155;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-content a i {
    width: 18px;
    font-size: 1rem;
    color: #64748b;
}

.dropdown-content a:hover {
    background-color: #f1f5f9;
    color: var(--primary, #0d6efd);
}

.dropdown-content a:hover i {
    color: var(--primary, #0d6efd);
}

.dropdown-divider {
    height: 1px;
    background-color: #f1f5f9;
    margin: 8px 0;
}

/* Style spécifique déconnexion */
.dropdown-content a.logout-link {
    color: #ef4444;
}

.dropdown-content a.logout-link:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

/* Animation */
@keyframes fadeInMove {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Rotation flèche */
.user-menu-container.active .arrow-icon {
    transform: rotate(180deg);
}
.arrow-icon { transition: transform 0.3s ease; }

.btn-outline-danger {
    border: 1px solid var(--danger) !important;
    color: var(--danger);
    background-color: white;
}

.btn-outline-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary) !important;
}