/* ============================================
   SPORTMETER - FRONTOFFICE SPORTIF
   Style global pour l'application sportif
   ============================================ */

:root {
    --primary-color: #b91c1c;
    --primary-dark: #b91c1c;
    --primary-light: #ff5252;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #ff1744;
    --info-color: #17a2b8;
    --light-bg:  #f8f9fa;
    --dark-bg: #343a40;
    --white: #ffffff;
    --text-dark: #212529;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    /* Teintes pastel pour badges et boutons */
    --pastel-success: #e7f1e9;
    --pastel-danger: #f7e1e3;
    --pastel-warning: #fcf5e1;
    --pastel-info: #e6f2f8;
    --pastel-secondary: #eef2f8;
    --pastel-primary: #ffcccb;

    /* Couleurs des sports : injectées dynamiquement depuis la BDD (voir app.js → loadSportColors) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 3rem;
    max-width: 450px;
    width: 90%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

.info-box {
    background-color: #e7f3ff;
    border-left: 4px solid var(--info-color);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #0c5460;
}

.btn-login {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.btn-login:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0);
}

.tab-switcher {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-switcher button {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.3s;
}

.tab-switcher button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   SIDEBAR (Menu latéral)
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--white);
    color: var(--text-dark);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    border-right: 1px solid var(--border-color);
    z-index: 999;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
}

.brand {
    align-items: center;
    gap: 0.75rem;
}

.brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background:
        radial-gradient(12px 12px at 30% 30%, rgba(255,255,255,.95), transparent 55%),
        linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 10px 20px rgba(225,29,72,.25);
    flex-shrink: 0;
}

.brand > div {
    flex: 1;
    min-width: 0;
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.brand small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(17,24,39,.03);
    color: #374151;
    font-weight: 500;
}

.badge.red {
    background: rgba(225,29,72,.08);
    border-color: rgba(225,29,72,.25);
    color: #9f1239;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-menu a:hover {
    background-color: var(--light-bg);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-menu a.active {
    background-color: var(--light-bg);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: var(--white);
    color: var(--text-dark);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between; /* nom à gauche, bouton à droite */
    width: 100%;
}

.admin-user-menu .user-info {
    color: var(--text-dark);
}

.admin-user-menu .btn-logout {
    background-color: var(--light-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.875rem;
}

.admin-user-menu .btn-logout:hover {
    background-color: var(--border-color);
    color: var(--text-dark);
}

.admin-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.sidebar-toggle {
    display: none;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.sidebar-toggle:hover {
    background-color: var(--border-color);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card-body {
    padding: 0;
}

/* ============================================
   STATISTICS CARDS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: flex-start;
    
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    flex: 2;
    flex-basis: 200px;
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-value {
    flex: 2;
    flex-basis: 100px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-icon {
    align-self: flex-end;
    font-size: 2.5rem;
    float: right;
    opacity: 0.3;

}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

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

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    transition: background-color 0.2s;
}

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

/* ============================================
   BADGES
   ============================================ */

.badge-success {
    background-color: var(--pastel-success);
    color: #155724;
}

.badge-danger {
    background-color: var(--pastel-danger);
    color: #721c24;
}

.badge-warning {
    background-color: var(--pastel-warning);
    color: #856404;
}

.badge-info {
    background-color: var(--pastel-info);
    color: #0c5460;
}

.badge-secondary {
    background-color: var(--pastel-secondary);
    color: #383d41;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: flex;
    align-items: center;

    /* display: inline-block; */
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--pastel-secondary);
    color: #383d41;
}

.btn-secondary:hover {
    background-color: #b8bcc0;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-success {
    background-color: var(--pastel-success);
    color: #155724;
}

.btn-success:hover {
    background-color: #9dd4a8;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-danger {
    background-color: var(--pastel-danger);
    color: #721c24;
}

.btn-danger:hover {
    background-color: #ff9ba3;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

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

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

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

.form-control:disabled {
    background-color: var(--light-bg);
    cursor: not-allowed;
}

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

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--white);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   SEARCH & FILTERS
   ============================================ */

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stats-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
}

.stats-filters .form-group:first-child {
    margin-right: auto;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: var(--info-color);
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

/* ============================================
   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: var(--white);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-dark);
}

/* ============================================
   GRID LAYOUT
   ============================================ */

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

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

/* ============================================
   UTILITIES
   ============================================ */

.text-center {
    text-align: center;
}

.text-light {
    color: var(--text-light);
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.weeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.75rem;
}

.week-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.week-cell label {
    font-size: 0.75rem;
    color: var(--text-light);
}

.week-cell input {
    width: 100%;
}

/* ============================================
   RESPONSIVE spécifique pour desktop
   ============================================ */

/*span full pour les cartes sur desktop*/

@media (min-width: 769px) {
    .grid-2 .grid-span-full {
      grid-column: 1 / -1;
    }
  }  

  /* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-container {
        padding: 1rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .search-bar {
        flex-direction: column;
    }

    .table-container {
        overflow-x: scroll;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }

    /* Séances: tableau -> cartes empilées sur mobile */
    .table-container.seances-table {
        overflow-x: visible;
    }

    .table-container.seances-table table,
    .table-container.seances-table thead,
    .table-container.seances-table tbody,
    .table-container.seances-table th,
    .table-container.seances-table td,
    .table-container.seances-table tr {
        display: block;
        width: 100%;
    }

    .table-container.seances-table thead {
        display: none;
    }

    .table-container.seances-table tbody tr {
        margin-bottom: 0.75rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.75rem;
        background: var(--white);
    }

    .table-container.seances-table td {
        padding: 0.35rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .table-container.seances-table td::before {
        content: none;
        display: none;
    }

    .table-container.seances-table .btn-group {
        flex-wrap: nowrap;
        width: 100%;
    }

    /* Centrer le contenu des lignes sur toute la largeur de la carte */
    .table-container.seances-table td {
        text-align: center;
        justify-content: center;
    }

    .table-container.seances-table td::before {
        min-width: 0;
    }

    .table-container.seances-table td > *:not(.btn-group) {
    
        text-align: center;
    }

    /* Boutons sur une ligne, répartis sur toute la largeur */
    .table-container.seances-table .btn-group .btn {
        flex: 1 1 0;
        width: auto;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

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

    .btn-group .btn {
        width: 100%;
    }

    /* Conserver les boutons des séances sur une ligne en très petit écran */
    .table-container.seances-table .btn-group {
        flex-direction: row;
    }
}

