/* Responsive tableau couples et boutons actions */
@media (max-width: 700px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 600px;
        font-size: 13px;
    }
    .btn-group {
        flex-direction: column;
        gap: 4px;
    }
    .btn-sm, .btn.btn-sm {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 80px;
        width: 100%;
        box-sizing: border-box;
    }
    .table td, .table th {
        padding: 6px 4px;
    }
    .menu-mobile-btn {
        position: fixed !important;
        top: 16px !important;
        right: 16px !important;
        left: auto !important;
        z-index: 2001;
        box-shadow: var(--shadow);
        width: auto !important;
        min-width: 40px;
        max-width: 48px;
        padding-left: 0.7em;
        padding-right: 0.7em;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    #filterAnnee {
        min-width: 80px !important;
        max-width: 120px !important;
        width: 100px !important;
        font-size: 13px;
        padding: 6px 8px;
    }
}
/* Champs de saisie de note responsive pour mobile */
@media (max-width: 600px) {
    .table input[type="number"][name*="note"],
    input[type="number"][name*="note"].form-control {
        min-width: 60px;
        max-width: 100%;
        width: 100%;
        font-size: 18px;
        padding: 8px 6px;
        box-sizing: border-box;
        border-radius: 6px;
        margin: 0;
    }
    .table td {
        padding: 6px 4px;
    }
}
/* Affichage du nom de l'utilisateur connecté dans la sidebar */
.sidebar-user {
    margin-top: 12px;
    padding: 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,0.08);
    border-radius: 6px;
    letter-spacing: 0.01em;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* Filtres expositions */
.expo-filters-bar {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 16px 8px 16px;
    margin-bottom: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.expo-filters-bar label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}
.expo-filters-bar select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
    background: #fff;
}
.expo-filters-bar button[type="submit"] {
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    border: none;
    transition: background 0.2s;
    cursor: pointer;
}
.expo-filters-bar button[type="submit"]:hover {
    background: #1d4ed8;
}
/* --- NAVIGATION COLLAPSIBLE --- */
.nav-collapsible {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-arrow {
    font-size: 12px;
    margin-left: 8px;
    transition: transform 0.2s;
}
.nav-collapsible.active .nav-arrow {
    transform: rotate(-180deg);
}
.nav-collapsible-content {
    display: block;
    transition: max-height 0.3s ease;
    overflow: hidden;
}
.nav-collapsible-content.collapsed {
    display: none;
}

/* --- BOUTON MENU MOBILE FIXE --- */
@media (max-width: 768px) {
    .menu-mobile-btn {
        position: fixed;
        top: 16px;
        right: 16px;
        left: auto;
        z-index: 2001;
        box-shadow: var(--shadow);
    }
    .header-actions {
        position: static;
    }
    .sidebar-close-btn {
        display: block !important;
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 2100;
        font-size: 1.5em;
        background: #fff;
        border: none;
        cursor: pointer;
        box-shadow: var(--shadow);
        width: auto !important;
        min-width: 40px;
        max-width: 48px;
        padding-left: 0.7em;
        padding-right: 0.7em;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --light-2: #f1f5f9;
    --dark: #1e293b;
    --text: #334155;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.5;
}

html, body {
    height: 100%;
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    margin-bottom: 30px;
    text-align: center;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
}

.nav {
    list-style: none;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-group {
    margin-top: 20px;
    margin-bottom: 10px;
}

.nav-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.6;
    padding: 8px 16px;
    margin-bottom: 8px;
}

/* Main Content */
.main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    background: white;
    padding: 16px 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border-left-color: var(--success);
}

.alert-error {
    background-color: #fef2f2;
    color: #7f1d1d;
    border-left-color: var(--danger);
}

.alert-warning {
    background-color: #fffbeb;
    color: #78350f;
    border-left-color: var(--warning);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: #64748b;
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 14px;
    cursor: pointer;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px;
    background-color: var(--light-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 16px;
    background-color: var(--light-2);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 16px;
}

.table thead {
    background-color: var(--light-2);
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    font-size: 13px;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: var(--light);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-item {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
}

.pagination-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background-color: #e0e7ff;
    color: var(--primary);
}

.badge-success {
    background-color: #d1fae5;
    color: #047857;
}

.badge-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

.badge-warning {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-secondary {
    background-color: #e2e8f0;
    color: var(--text);
}

/* Grid */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.empty-state-description {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 24px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        display: none;
        padding: 12px 16px;
    }

    .sidebar-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    .app-title {
        font-size: 18px;
    }

    .sidebar-header img {
        width: 80px !important;
        height: 80px !important;
        margin: 8px auto !important;
    }

    .sidebar-user {
        font-size: 13px;
        padding: 6px 0;
        margin-top: 8px;
    }

    .nav-link {
        padding: 10px 12px;
        font-size: 13px;
    }

    .nav-group {
        margin-top: 12px;
    }

    .nav-group-title {
        font-size: 12px;
        padding: 8px 12px;
    }

    .sidebar.active {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .header {
        flex-wrap: wrap;
    }

    .content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }

    .stat-value {
        font-size: 24px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-block {
        display: block;
    }

    .header-title {
        font-size: 18px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }

    .content {
        padding: 12px;
    }

    .header-title {
        font-size: 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 6px;
    }
}
/* Favicon sidebar responsive */
.sidebar-favicon {
    width: 128px;
    height: 128px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* Styles uniformes pour les listes d'autocomplétion */
.autocomplete-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 100%;
}

.autocomplete-suggestions li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.autocomplete-suggestions li:last-child {
    border-bottom: none;
}

.autocomplete-suggestions li:hover {
    background-color: #f0f0f0;
}

.autocomplete-suggestions li.selected {
    background-color: #e0e7ff;
    color: #4f46e5;
}

.autocomplete-suggestions li.no-results {
    padding: 10px 12px;
    color: #999;
    cursor: default;
    background-color: #f9fafb;
}

.autocomplete-suggestions li.no-results:hover {
    background-color: #f9fafb;
}

@media (max-width: 768px) {
    .autocomplete-suggestions {
        max-height: 180px;
    }
    
    .autocomplete-suggestions li {
        padding: 10px 10px;
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .autocomplete-suggestions {
        max-height: 150px;
        font-size: 13px;
    }
    
    .autocomplete-suggestions li {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .autocomplete-suggestions {
        max-height: 120px;
    }
    
    .autocomplete-suggestions li {
        padding: 8px 8px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        padding: 10px 12px;
    }

    .sidebar-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .app-title {
        font-size: 16px;
    }

    .app-subtitle {
        font-size: 11px;
    }

    .sidebar-favicon {
        width: 80px;
        height: 80px;
        margin: 6px auto;
    }

    .nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }

    .nav-group-title {
        font-size: 11px;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .sidebar-favicon {
        width: 64px;
        height: 64px;
        margin: 4px auto;
    }

    .app-title {
        font-size: 14px;
    }

    .sidebar-user {
        font-size: 12px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 11px;
    }
}