/* ============================================================
   FSGL — Portail des licences
   Fédération Sportive LGBT+
   ============================================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Variables */
:root {
    --bg:         #1a1f2e;
    --bg2:        #242a3a;
    --bg3:        #2e3548;
    --card:       #242a3a;
    --border:     rgba(255,255,255,0.08);
    --border-focus: #4f8ef7;
    --text:       #f0f4ff;
    --text-muted: #7a8aab;
    --blue:       #4f8ef7;
    --blue-dark:  #3a6fd8;
    --blue-light: #7aacff;
    --red:        #ef4444;
    --green:      #22c55e;
    --orange:     #f59e0b;
    --radius:     12px;
    --radius-sm:  8px;
    --shadow:     0 20px 60px rgba(0,0,0,0.4);
}

/* Base */
html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   AUTH PAGES (login, premier accès)
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(79,142,247,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168,85,247,0.05) 0%, transparent 50%),
        var(--bg);
}

.auth-logo {
    margin-bottom: 28px;
    text-align: center;
}

.auth-logo img {
    height: 80px;
    width: auto;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin-bottom: 28px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.form-label a {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s;
}

.form-label a:hover { color: var(--blue-light); }

.form-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 44px 12px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.15);
}

.form-input::placeholder { color: var(--text-muted); }

/* Input avec icône œil */
.input-wrapper {
    position: relative;
}

.btn-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.btn-eye:hover { color: var(--text); }

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    margin-bottom: 24px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
    flex-shrink: 0;
}

/* Force password meter */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
}

.strength-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================================
   BOUTONS
   ============================================================ */

.btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,142,247,0.3);
}

.btn-primary:active { transform: scale(0.99); }

.btn-outline {
    background: transparent;
    color: var(--blue);
    border: 1px solid var(--border-focus);
}

.btn-outline:hover { background: rgba(79,142,247,0.08); }

/* ============================================================
   ALERTES
   ============================================================ */

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-icon { flex-shrink: 0; font-size: 16px; }

.alert-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.25);
    color: #86efac;
}

.alert-info {
    background: rgba(79,142,247,0.1);
    border: 1px solid rgba(79,142,247,0.25);
    color: #93c5fd;
}

.alert-warning {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25);
    color: #fcd34d;
}

/* ============================================================
   DIVIDER
   ============================================================ */

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

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

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .auth-title { font-size: 20px; }
}

/* ============================================================
   LAYOUT DASHBOARD
   ============================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo-img  { height: 36px; width: auto; }
.sidebar-logo-text { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: 0.05em; }

/* Nav */
.sidebar-nav { flex: 1; padding: 16px 10px; }

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,0.12); color: var(--blue-light); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Footer sidebar */
.sidebar-footer {
    padding: 14px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), #6366f1);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.btn-logout {
    padding: 7px; border-radius: 7px; color: var(--text-muted);
    text-decoration: none; transition: all 0.2s; flex-shrink: 0;
    display: flex; align-items: center;
}
.btn-logout:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar mobile */
.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.btn-menu { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; display: flex; }

/* Page content */
.page-content { padding: 32px; flex: 1; }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); }

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

.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

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

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-muted); }
.stat-card.blue  { border-color: rgba(79,142,247,0.2); }
.stat-card.green { border-color: rgba(34,197,94,0.2); }
.stat-card.red   { border-color: rgba(239,68,68,0.2); }
.stat-card.blue  .stat-value { color: var(--blue-light); }
.stat-card.green .stat-value { color: #86efac; }
.stat-card.red   .stat-value { color: #fca5a5; }

/* ============================================================
   FILTRES & RECHERCHE
   ============================================================ */

.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 380px;
}
.search-box svg {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px 9px 38px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--border-focus); }
.search-input::placeholder { color: var(--text-muted); }

.filter-select {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--border-focus); }

/* ============================================================
   TABLE
   ============================================================ */

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

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges statut */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}
.badge-active  { background: rgba(34,197,94,0.12);  color: #86efac; }
.badge-expired { background: rgba(239,68,68,0.12);  color: #fca5a5; }
.badge-pending { background: rgba(245,158,11,0.12); color: #fcd34d; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 6px; }
.btn-page {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-page:hover { border-color: var(--border-focus); color: var(--text); }
.btn-page.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }

/* Overlay sidebar mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

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

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .topbar { display: flex; }
    .page-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
}

/* ============================================================
   THÈME CLAIR
   ============================================================ */

body.theme-light {
    --bg:           #f0f2f7;
    --bg2:          #ffffff;
    --bg3:          #e8ecf4;
    --card:         #ffffff;
    --border:       rgba(0,0,0,0.10);
    --border-focus: #4f8ef7;
    --text:         #1a1f2e;
    --text-muted:   #6b7a99;
    --blue:         #3a6fd8;
    --blue-dark:    #2a5cbf;
    --blue-light:   #2563eb;
    --red:          #dc2626;
    --green:        #16a34a;
    --orange:       #d97706;
    --shadow:       0 20px 60px rgba(0,0,0,0.12);
}

/* Sidebar thème clair */
body.theme-light .sidebar {
    background: #ffffff;
    border-right-color: rgba(0,0,0,0.08);
}
body.theme-light .nav-section-label { color: #9aa3b8; }
body.theme-light .nav-item          { color: #4a5568; }
body.theme-light .nav-item:hover    { background: rgba(79,142,247,0.08); color: #1a1f2e; }
body.theme-light .nav-item.active   { background: rgba(79,142,247,0.12); color: #2563eb; }
body.theme-light .sidebar-footer    { border-top-color: rgba(0,0,0,0.08); }
body.theme-light .sidebar-user-name { color: #1a1f2e; }
body.theme-light .sidebar-user-role { color: #6b7a99; }
body.theme-light .btn-logout        { color: #6b7a99; }
body.theme-light .btn-logout:hover  { color: #dc2626; }

/* Topbar thème clair */
body.theme-light .topbar {
    background: rgba(240,242,247,0.95);
    border-bottom-color: rgba(0,0,0,0.08);
}
body.theme-light .topbar-title { color: #1a1f2e; }
body.theme-light .btn-menu     { color: #4a5568; }

/* Cards thème clair */
body.theme-light .card          { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.theme-light .card-header   { border-bottom-color: rgba(0,0,0,0.08); }
body.theme-light .card-title    { color: #1a1f2e; }

/* Stats thème clair */
body.theme-light .stat-card         { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.theme-light .stat-label        { color: #6b7a99; }
body.theme-light .stat-value        { color: #1a1f2e; }
body.theme-light .stat-card.blue    { border-color: rgba(37,99,235,0.25); }
body.theme-light .stat-card.green   { border-color: rgba(22,163,74,0.25); }
body.theme-light .stat-card.red     { border-color: rgba(220,38,38,0.25); }

/* Table thème clair */
body.theme-light table           { border-color: rgba(0,0,0,0.06); }
body.theme-light th              { background: #f8f9fc; color: #6b7a99; border-bottom-color: rgba(0,0,0,0.08); }
body.theme-light td              { border-bottom-color: rgba(0,0,0,0.05); color: #1a1f2e; }
body.theme-light tr:hover td    { background: rgba(79,142,247,0.04); }

/* Formulaires thème clair */
body.theme-light .form-input     { background: #f8f9fc; border-color: rgba(0,0,0,0.12); color: #1a1f2e; }
body.theme-light .form-input:focus { border-color: #3a6fd8; background: #fff; }
body.theme-light .form-label     { color: #374151; }
body.theme-light .filter-select  { background: #f8f9fc; border-color: rgba(0,0,0,0.12); color: #1a1f2e; }
body.theme-light .search-box     { background: #f8f9fc; border-color: rgba(0,0,0,0.12); }
body.theme-light .search-input   { background: transparent; color: #1a1f2e; }
body.theme-light .search-box svg { color: #6b7a99; }

/* Alertes thème clair */
body.theme-light .alert-success  { background: rgba(22,163,74,0.08);  border-color: rgba(22,163,74,0.2);  color: #15803d; }
body.theme-light .alert-error    { background: rgba(220,38,38,0.08);  border-color: rgba(220,38,38,0.2);  color: #dc2626; }
body.theme-light .alert-warning  { background: rgba(217,119,6,0.08);  border-color: rgba(217,119,6,0.2);  color: #b45309; }
body.theme-light .alert-info     { background: rgba(37,99,235,0.06);  border-color: rgba(37,99,235,0.15); color: #1d4ed8; }

/* Badges thème clair */
body.theme-light .badge-active   { background: rgba(22,163,74,0.1);   color: #15803d; border-color: rgba(22,163,74,0.2); }
body.theme-light .badge-pending  { background: rgba(217,119,6,0.1);   color: #b45309; border-color: rgba(217,119,6,0.2); }
body.theme-light .badge-expired  { background: rgba(107,114,128,0.1); color: #4b5563; border-color: rgba(107,114,128,0.2); }

/* Pagination thème clair */
body.theme-light .btn-page       { background: #f8f9fc; color: #4a5568; border-color: rgba(0,0,0,0.1); }
body.theme-light .btn-page:hover { background: #e8ecf4; }
body.theme-light .btn-page.active { background: #3a6fd8; color: #fff; border-color: #3a6fd8; }

/* Auth page thème clair */
body.theme-light.auth-page      { background: #f0f2f7; }
body.theme-light .auth-card     { background: #ffffff; box-shadow: 0 8px 32px rgba(0,0,0,0.1); }

/* Bouton toggle thème */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.6;
}
.theme-toggle:hover { opacity: 1; color: var(--text); }

/* Corrections thème clair — boutons et badges */
body.theme-light .export-btn {
    background: rgba(22,163,74,0.12);
    color: #15803d;
    border-color: rgba(22,163,74,0.3);
}
body.theme-light .export-btn:hover {
    background: rgba(22,163,74,0.2);
}

body.theme-light .cnx-jamais {
    background: rgba(217,119,6,0.12);
    color: #92400e;
    border-color: rgba(217,119,6,0.3);
}

body.theme-light .gen-mdp-btn {
    background: rgba(217,119,6,0.1);
    color: #92400e;
    border-color: rgba(217,119,6,0.3);
}
body.theme-light .gen-mdp-btn:hover {
    background: rgba(217,119,6,0.2);
    color: #78350f;
}
