/**
 * GestArena — Design System
 * Charte graphique FFHB — palette exclusive
 * Design épuré, sans effets visuels superflus
 */

/* ============================================
   VARIABLES & PALETTE FFHB
   ============================================ */
:root {
    /* Palette exclusive GestArena */
    --ga-primary: rgb(26, 62, 113);
    --ga-red: rgb(155, 22, 20);
    --ga-orange: rgb(207, 102, 28);
    --ga-green: rgb(139, 182, 77);
    --ga-teal: rgb(123, 185, 178);
    --ga-red-bright: rgb(197, 54, 40);
    --ga-yellow: rgb(230, 174, 25);
    --ga-blue-bright: rgb(0, 115, 206);
    --ga-beige: rgb(200, 181, 119);
    --ga-purple: rgb(126, 85, 152);
    --ga-gold: rgb(184, 146, 23);
    --ga-pink: rgb(195, 0, 111);
    --ga-magenta: rgb(151, 22, 90);

    /* Couleurs sémantiques */
    --success: var(--ga-green);
    --danger: var(--ga-red-bright);
    --warning: var(--ga-yellow);
    --info: var(--ga-blue-bright);

    /* Surfaces */
    --surface-primary: #ffffff;
    --surface-secondary: #f8fafc;
    --surface-tertiary: #f1f5f9;

    /* Bordures */
    --border-color: #e2e8f0;
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;

    /* Typographie */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Header */
    --header-height: 56px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    background: var(--surface-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

/* ============================================
   TYPOGRAPHIE
   ============================================ */
h1, h2, h3, h4 {
    color: #1e293b;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.0625rem; font-weight: 600; }

.text-muted,
.text-secondary {
    color: #64748b !important;
}

/* ============================================
   HEADER SIMPLIFIÉ
   ============================================ */
.ga-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--ga-primary);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.ga-header .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
}

.ga-header .d-flex {
    height: 100%;
}

/* Logo */
.ga-header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.ga-header-logo:hover {
    color: #ffffff;
}

.ga-header-logo-img {
    width: 40px;
    height: 40px;
}

.ga-header-logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Bouton burger */
.ga-burger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.ga-burger-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.ga-burger-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Profil dropdown */
.ga-header-profile {
    position: relative;
}

.ga-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.ga-profile-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ga-profile-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.ga-profile-btn .material-icons {
    font-size: 1.25rem;
}

.ga-profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    list-style: none;
    padding: 0.25rem;
    z-index: 1100;
}

.ga-profile-menu.open {
    display: block;
}

.ga-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.9375rem;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
}

.ga-profile-menu-item:hover {
    background: var(--surface-tertiary);
    color: var(--ga-primary);
}

.ga-profile-menu-item .material-icons {
    font-size: 1.125rem;
    color: #64748b;
}

/* ============================================
   BURGER MENU LATÉRAL
   ============================================ */
.ga-burger-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
}

.ga-burger-overlay.open {
    display: block;
}

.ga-burger-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--ga-primary);
    z-index: 950;
    transform: translateX(-100%);
    transition: transform var(--transition);
    overflow-y: auto;
}

.ga-burger-menu.open {
    transform: translateX(0);
}

.ga-burger-menu-list {
    list-style: none;
    padding: 0.5rem;
    margin: 0;
}

.ga-burger-menu-item {
    margin-bottom: 2px;
}

.ga-burger-menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.ga-burger-menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.ga-burger-menu-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 600;
}

.ga-burger-menu-link:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.ga-burger-menu-link .material-icons {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.card-header {
    background: var(--surface-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.0625rem;
    color: #0f172a;
}

.card-header h5 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--border-radius);
    border: none;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.btn-primary {
    background: var(--ga-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--ga-primary);
    opacity: 0.9;
    color: #ffffff;
}

.btn-success {
    background: var(--ga-green);
    color: #ffffff;
}

.btn-danger {
    background: var(--ga-red-bright);
    color: #ffffff;
}

.btn-warning {
    background: var(--ga-orange);
    color: #ffffff;
}

.btn-info {
    background: var(--ga-blue-bright);
    color: #ffffff;
}

.btn-secondary {
    background: #64748b;
    color: #ffffff;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--ga-primary);
    color: var(--ga-primary);
}

.btn:focus-visible {
    outline: 2px solid var(--ga-primary);
    outline-offset: 2px;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--surface-tertiary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 1rem 1.25rem;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    font-size: 0.9375rem;
}

.table-sm tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

/* Lignes de comités */
.ligue-row {
    cursor: pointer;
    font-weight: 500;
}

.comite-row {
    background: var(--surface-secondary);
    font-size: 0.875rem;
}

.toggle-icon {
    color: #94a3b8;
}

/* ============================================
   TABLES / LIST PAGES (salles, clubs, licences)
   ============================================ */
body.page-liste {
    overflow-x: hidden;
}

main.salles-container {
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.salles-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.salles-header .form-select-sm.filter-select-auto {
    width: auto;
}

.salles-header .form-select-sm.filter-select-wide,
.salles-header .form-control-sm.filter-input-wide {
    min-width: 200px;
}

.salles-container .form-select-sm.filter-select-auto {
    width: auto;
}

.salles-container .form-select-sm.filter-select-wide,
.salles-container .form-control-sm.filter-input-wide {
    min-width: 200px;
}

.salles-tabs {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.salles-table-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card.table-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
}

.card.table-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.card.table-card .table-responsive {
    flex: 1;
    overflow: auto;
}

/* En-têtes de tableau avec couleur primaire */
.card.table-card table.table thead th {
    position: sticky;
    top: 0;
    background: var(--ga-primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: none;
    white-space: nowrap;
    z-index: 10;
}

/* Ligne de filtres sticky sous les en-têtes */
.card.table-card table.table thead tr.filter-row th {
    position: sticky;
    top: 42px;
    background: #ffffff;
    z-index: 9;
    padding: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.filter-row .filter-input,
.filter-row .form-control,
.filter-row .form-select {
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}

.filter-row .filter-input:focus,
.filter-row .form-control:focus,
.filter-row .form-select:focus {
    border-color: var(--ga-primary);
    box-shadow: 0 0 0 0.2rem rgba(26, 62, 113, 0.15);
    outline: none;
}

/* Hover sur les lignes du tableau */
.card.table-card table.table tbody tr:hover {
    background-color: rgba(26, 62, 113, 0.04);
}

/* Cellules du tableau dans les pages de listes */
.card.table-card table.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border-color);
}

/* Style des onglets actifs dans les pages de listes */
.salles-tabs .nav-tabs .nav-link.active {
    color: #fff !important;
    background: var(--ga-primary);
    border-color: var(--ga-primary);
}

.salles-tabs .nav-tabs .nav-link.active .badge {
    background-color: #fff !important;
    color: var(--ga-primary) !important;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 0.375rem 0.875rem;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.badge.bg-success {
    background: var(--ga-green) !important;
}

.badge.bg-danger {
    background: var(--ga-red-bright) !important;
}

.badge.bg-warning {
    background: var(--ga-orange) !important;
    color: #ffffff !important;
}

.badge.bg-info {
    background: var(--ga-blue-bright) !important;
}

.badge.bg-primary {
    background: var(--ga-primary) !important;
}

.badge.bg-secondary {
    background: #64748b !important;
}

.badge-counter {
    min-width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8125rem;
    padding: 0;
}

/* Badges de conformité */
.badge-conforme {
    background: var(--ga-green) !important;
}

.badge-non-conforme {
    background: var(--ga-red-bright) !important;
}

.badge-non-verifie {
    background: #64748b !important;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    transition: border-color var(--transition-fast);
    background: var(--surface-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--ga-primary);
    box-shadow: 0 0 0 3px rgba(26, 62, 113, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.file-upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--surface-primary);
    transition: border-color var(--transition-fast);
}

.file-upload-area.dragover {
    border-color: var(--ga-green);
    background: rgba(139, 182, 77, 0.05);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    font-weight: 500;
    font-size: 0.9375rem;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(139, 182, 77, 0.1);
    color: #2d5016;
    border-left-color: var(--ga-green);
}

.alert-danger {
    background: rgba(197, 54, 40, 0.1);
    color: #7f1d1d;
    border-left-color: var(--ga-red-bright);
}

.alert-warning {
    background: rgba(230, 174, 25, 0.1);
    color: #78350f;
    border-left-color: var(--ga-yellow);
}

.alert-info {
    background: rgba(0, 115, 206, 0.1);
    color: #1e3a5f;
    border-left-color: var(--ga-blue-bright);
}

/* ============================================
   PROGRESS
   ============================================ */
.progress {
    height: 1.25rem;
    border-radius: var(--border-radius);
    background: var(--surface-tertiary);
    overflow: hidden;
}

.progress-bar {
    background: var(--ga-primary);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.75rem;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: #0f172a;
    margin-top: auto;
    padding: 1rem 0;
}

.footer-version-badge {
    font-size: 0.7rem;
    text-transform: none;
}

.footer-build-info {
    font-size: 0.85em;
    opacity: 0.8;
}

/* ============================================
   AUTHENTICATION PAGES
   ============================================ */
body.auth-body {
    background: var(--ga-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.login-card {
    background: var(--surface-primary);
    max-width: 420px;
    width: 100%;
    border-radius: var(--border-radius-lg);
    border: none;
}

.brand-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: 0.05em;
    color: var(--ga-primary);
}

/* Toggle switch (rester connecté) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: background-color var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: transform var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--ga-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(26, 62, 113, 0.15);
}

.btn-auth-submit {
    background: var(--ga-primary);
    color: #ffffff;
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.btn-auth-submit:hover {
    opacity: 0.9;
    color: #ffffff;
}

.btn-auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   UTILITIES
   ============================================ */
.icon-inline {
    vertical-align: middle;
}

.icon-inline-sm {
    vertical-align: middle;
    font-size: 0.9rem;
}

.icon-inline-btn {
    vertical-align: middle;
    font-size: 1rem;
}

.icon-accent-sm {
    font-size: 0.8rem;
}

.stat-icon {
    font-size: 2.5rem;
}

.text-bronze {
    color: #cd7f32;
}

/* Bandeau d'impersonation */
.impersonation-banner {
    background: var(--ga-orange);
    color: #ffffff;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

.impersonation-banner .btn {
    pointer-events: auto;
}

.impersonation-banner .material-icons {
    vertical-align: middle;
}

.impersonation-banner .btn .material-icons {
    font-size: 1rem;
}

.icon-sm {
    font-size: 1.125rem;
}

/* Icon circles */
.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--ga-primary);
    border-radius: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991px) {
    .ga-header-logo-title {
        font-size: 1.1rem;
    }

    .ga-header-logo-img {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 1rem 1.25rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .badge {
        font-size: 0.6875rem;
        padding: 0.3125rem 0.75rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }

    main.salles-container {
        height: calc(100vh - 200px);
        padding: 0.5rem;
    }

    .salles-header .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .salles-header .d-flex .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .card.table-card .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card.table-card table.table {
        min-width: 800px;
    }

    .card.table-card table.table thead th,
    .card.table-card table.table tbody td {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }

    .card.table-card table.table thead tr.filter-row th {
        padding: 0.375rem;
    }

    .filter-row .filter-input,
    .filter-row .form-control,
    .filter-row .form-select {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .ga-burger-menu {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITÉ - REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
