/* ===== VARIABLES CSS ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --white: #ffffff;
    --gray-100: #f9fafb;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    --transition: all 0.3s ease;
    --sidebar-width: 250px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* Wrapper principal pour le sticky footer */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER / NAVIGATION ===== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo a { 
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-menu a {
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: var(--gray-100);
    color: var(--primary-color);
}

/* Menu burger */
.burger-menu {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--gray-800);
    cursor: pointer;
    z-index: 1020; /* Pour être au-dessus du menu */
}

/* ===== CONTAINERS ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.container-fluid {
    width: 100%;
    padding: 2rem;
}

/* Layout principal (sidebar + main) */
.main-layout {
    display: flex;
    gap: 2rem;
}
.main-layout main {
    flex: 1;
    min-width: 0; /* Empêche le contenu de déborder */
}


/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.card-body {
    padding: 0;
}

.card-footer {
    border-top: 1px solid var(--gray-200);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

/* ===== GRID SYSTEM ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.col-2, .col-3, .col-4 {
    flex-grow: 1;
}

.col-2 {
    flex-basis: calc(50% - 1rem);
    min-width: 250px;
}

.col-3 {
    flex-basis: calc(33.333% - 1.33rem);
    min-width: 250px;
}

.col-4 {
    flex-basis: calc(25% - 1.5rem);
    min-width: 250px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background-color: var(--gray-100);
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-help {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    background-color: var(--gray-50);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.file-upload-label i { 
    font-size: 2rem;
    color: var(--gray-500);
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-300);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--white);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* ===== BADGES & LABELS ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

.badge-primary {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert span { 
    flex: 1;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* ===== TABLES ===== */
.table-responsive { 
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    min-width: 600px; /* Empêche la table de trop rétrécir */
}

.table thead {
    background-color: var(--gray-100);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.5rem; 
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 3px var(--primary-color);
    z-index: 1;
}

.timeline-item:last-child { 
    padding-bottom: 0;
}

.timeline-content {
    background: var(--gray-50); 
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200); 
    box-shadow: none; 
}

.timeline-date {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.sidebar {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    flex: 0 0 var(--sidebar-width);
    align-self: flex-start;
    position: sticky;
    top: 100px; /* Ajustez en fonction de la hauteur du header */
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    color: var(--gray-700);
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* ===== FOOTER ===== */
.footer { 
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 3rem 2rem;
    margin-top: auto; /* Pour le sticky footer */
}

.footer .container {
    padding: 0;
}

.footer .logo {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer h4 {
    color: var(--white);
    margin-bottom: 1rem;
}
.footer ul {
    list-style: none;
}
.footer ul li {
    margin-bottom: 0.5rem;
}
.footer ul a {
    color: var(--gray-400);
}
.footer .footer-bottom {
    border-top: 1px solid var(--gray-700);
    margin-top: 2rem;
    padding-top: 2rem;
    text-align: center;
}

/* ===== RESPONSIVE ===== */

/* Tablettes et petits écrans (max 992px) */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 1010;
        overflow-y: auto;
        padding-top: 6rem; /* Espace pour le header */
    }
    
    .sidebar.show {
        transform: translateX(0);
    }

    .main-layout {
        flex-direction: column;
    }

    .burger-menu {
        display: block;
    }

    /* Cache le menu desktop sur la page d'accueil */
    .main-content .nav-menu {
        display: none;
    }
    
    /* Affiche le menu admin responsive */
    .admin-header .nav-menu {
        position: fixed;
        top: 70px; /* Hauteur du header */
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        transform: translateY(-150%);
        transition: var(--transition);
        gap: 0.5rem;
    }
    .admin-header .nav-menu.show {
        transform: translateY(0);
    }
    .admin-header .nav-menu a {
        padding: 1rem;
    }

    /* Affiche le menu icônes client */
    .client-header .nav-menu {
        display: flex;
        gap: 1rem; /* Réduire l'espace pour les icônes */
    }

    .desktop-only {
        display: none;
    }
    
    /* Overlay pour fermer la sidebar */
    .sidebar-overlay { 
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1005;
    }
    .sidebar-overlay.show {
        display: block;
    }
}


/* Mobiles (max 768px) */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .container, .container-fluid {
        padding: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }

    h1, .card-title {
        font-size: 1.5rem;
    }
    
    /* Hero section */
    h1 {
        font-size: 2.2rem;
    }

    /* Les colonnes s'empilent */
    .row {
        flex-direction: column;
        gap: 1.5rem; /* Espace réduit */
        margin-bottom: 1.5rem;
    }

    .col-2, .col-3, .col-4 {
        flex-basis: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }
    .modal-footer .btn {
        width: 100%;
    }

    /* Footer */
    .footer .row {
        gap: 2rem;
    }
    
    /* Quai virtuel sur mobile */
    #virtual-queue .queue-content {
        padding: 2rem;
        width: 95%;
    }
    #virtual-queue h1 {
        font-size: 1.5rem;
    }
    #virtual-queue p {
        font-size: 1rem;
    }
}


/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.rounded { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-lg); }


/* ===== STYLES NOTIFICATIONS HEADER ===== */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    border: 2px solid var(--white);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    min-width: 200px;
    right: 0;
    left: auto;
    z-index: 1001;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--gray-700) !important;
    background: none !important;
}

.dropdown-menu a:hover {
    background-color: var(--gray-100) !impo<ctrl61>rtant;
}

.notification-dropdown {
    padding: 0;
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}

.notification-item:hover {
    background-color: var(--gray-50);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item strong {
    font-weight: 600;
}

.notification-item p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0.25rem 0 0.5rem;
}

.notification-item small {
    font-size: 0.8rem;
    color: var(--gray-400);
}


/* ===== STYLES POUR LE QUAI VIRTUEL (AJOUTÉ) ===== */
#virtual-queue {
    display: none; /* Caché par défaut, géré par JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    padding: 2rem;
}

#virtual-queue .queue-content {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
}

#virtual-queue h1 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

#virtual-queue p {
    font-size: 1.1rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 2rem;
}

#virtual-queue .queue-status {
    background: var(--gray-100);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 2rem;
}

#virtual-queue .queue-status-item {
    margin-bottom: 1rem;
}
#virtual-queue .queue-status-item:last-child {
    margin-bottom: 0;
}

#virtual-queue .queue-status-label {
    font-size: 0.9rem;
    color: var(--gray-500);
    display: block;
}

#virtual-queue .queue-status-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

#virtual-queue .loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}