/**
 * Athlenet - Style ESPN Inspired
 * Dark/Light Mode Support
 */

/* ========================================
   VARIABLES CSS - THEME ESPN
   ======================================== */

:root {
    /* Couleurs Dark Mode (par défaut) */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1b;
    --bg-tertiary: #2a2a2b;
    --bg-hover: #333333;

    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;

    --accent-primary: #e31837; /* Rouge ESPN */
    --accent-secondary: #ff6b35;
    --accent-hover: #ff0033;

    --border-color: #2a2a2b;
    --shadow: rgba(0, 0, 0, 0.5);

    /* Couleurs de statut */
    --success: #00c853;
    --error: #ff3d00;
    --warning: #ffc107;
    --info: #2196f3;

    /* Espacements */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Light Mode */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f7;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #f0f0f0;

    --text-primary: #1a1a1b;
    --text-secondary: #4d4d4d;
    --text-muted: #808080;

    --border-color: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* ========================================
   RESET & BASE
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ========================================
   TYPOGRAPHIE
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* ========================================
   LAYOUT - NAVBAR (Style ESPN)
   ======================================== */

.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-logo .logo-accent {
    color: var(--accent-primary);
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.navbar-nav a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.navbar-nav a.active {
    color: var(--accent-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    transform: scale(1.1);
}

/* ========================================
   LAYOUT - CONTAINER
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.container-sm {
    max-width: 600px;
}

.container-lg {
    max-width: 1400px;
}

/* ========================================
   CARDS (Style ESPN)
   ======================================== */

.card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: 0 4px 20px var(--shadow);
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--shadow);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: var(--spacing-md) 0;
}

.card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

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

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    background-color: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

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

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: var(--spacing-xs);
}

.form-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: var(--spacing-xs);
}

/* ========================================
   BUTTONS (Style ESPN)
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 24, 55, 0.4);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--accent-primary);
    color: white;
}

.btn-google {
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
}

.btn-google:hover:not(:disabled) {
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: 1.125rem;
}

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

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

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

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

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

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

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-lg) 0;
}

/* ========================================
   AUTH PAGES STYLING
   ======================================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.auth-card {
    width: 100%;
    max-width: 450px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.auth-logo {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: var(--spacing-md);
}

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

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--spacing-xl) 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    color: var(--text-secondary);
}

/* ========================================
   ALERTS & NOTIFICATIONS
   ======================================== */

.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background-color: rgba(0, 200, 83, 0.1);
    border-left: 4px solid var(--success);
    color: var(--success);
}

.alert-error {
    background-color: rgba(255, 61, 0, 0.1);
    border-left: 4px solid var(--error);
    color: var(--error);
}

.alert-info {
    background-color: rgba(33, 150, 243, 0.1);
    border-left: 4px solid var(--info);
    color: var(--info);
}

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

@media (max-width: 768px) {
    html {
        font-size: 14px;
        overflow-x: hidden; /* Empêcher le scroll horizontal */
    }

    body {
        overflow-x: hidden; /* Empêcher le scroll horizontal */
        padding-bottom: 70px; /* Espace pour le menu en bas */
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    #main-content {
        overflow-x: hidden; /* Empêcher le scroll horizontal */
    }

    .navbar-container {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .navbar-nav {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-sm);
    }

    .navbar-nav a {
        width: 100%;
        text-align: center;
    }

    .auth-container {
        padding: var(--spacing-lg);
    }

    .card {
        padding: var(--spacing-lg);
    }

    .page-header-text,
    #main-content h1 {
        display: none;
    }

    /* Forum buttons - Cacher le texte, garder seulement les icônes/drapeaux */
    #btn-forum-general,
    #btn-forum-nation,
    a.btn[href*="forum-admin"] {
        font-size: 0; /* Cacher le texte */
        padding: 0.75rem; /* Padding uniforme */
        min-width: 48px; /* Taille tactile minimum */
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #btn-forum-general::before {
        content: '🌍';
        font-size: 1.5rem;
    }

    #btn-forum-nation img {
        margin: 0 !important; /* Retirer la marge du drapeau */
        width: 28px !important; /* Plus grand pour être visible */
        height: auto;
    }

    a.btn[href*="forum-admin"]::before {
        content: '⚙️';
        font-size: 1.5rem;
    }

    /* Cacher la sidebar sur mobile */
    .sidebar {
        display: none;
    }

    /* Main content en pleine largeur sur mobile */
    .app-layout {
        grid-template-columns: 1fr;
    }

    .main-content {
        max-width: 100%;
    }

    /* Empêcher tout débordement */
    * {
        max-width: 100%;
    }

    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .auth-logo {
        font-size: 2rem;
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   CHECKBOX & RADIO
   ======================================== */

.checkbox-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.checkbox-container label {
    cursor: pointer;
    user-select: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.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: var(--bg-tertiary);
    transition: var(--transition-fast);
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--accent-primary);
}

/* ========================================
   BOTTOM NAVIGATION (MOBILE)
   ======================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: none; /* Caché par défaut, visible en mobile */
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--spacing-sm);
    z-index: 1000;
    box-shadow: 0 -2px 10px var(--shadow);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: var(--transition-fast);
    cursor: pointer;
    flex: 1;
    min-width: 50px;
}

.bottom-nav-item .icon {
    font-size: 1.5rem;
}

.bottom-nav-item.active {
    color: var(--accent-primary);
}

.bottom-nav-item:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
}

/* Badge dans bottom-nav mobile */
.bottom-nav-item {
    position: relative;
}

.bottom-nav-item .shortcut-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--accent-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================
   MOBILE SIDEBAR OPEN STATE
   ============================================ */
@media (max-width: 768px) {
    .sidebar.open {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        animation: slideIn 0.3s ease;
    }

    @keyframes slideIn {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0);
        }
    }

    /* Resources dropdown mobile */
    .resources-dropdown .resources-panel {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
    }

    .resources-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 10px;
    }

    .resource-item {
        padding: 8px 4px;
    }

    .resource-icon {
        font-size: 1.2rem;
    }

    .resource-value {
        font-size: 0.9rem;
    }

    .resource-label {
        font-size: 0.6rem;
    }
}

/* ============================================
   MOBILE SIDEBAR FIX - COMPLETE OVERRIDE
   ============================================ */
@media (max-width: 768px) {
    /* Sidebar fermé par défaut */
    .sidebar {
        display: none !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        background: var(--bg-primary);
        overflow-y: auto;
        padding-bottom: 80px;
    }

    /* Sidebar ouvert */
    .sidebar.open {
        display: flex !important;
        flex-direction: column;
        animation: slideInMobile 0.3s ease;
    }

    @keyframes slideInMobile {
        from {
            opacity: 0;
            transform: translateX(-30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* Header du sidebar avec bouton fermer */
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        z-index: 10;
    }

    /* Contenu du menu */
    .sidebar .menu-section {
        padding: 0.5rem 1rem;
    }

    .sidebar .menu-link {
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        white-space: nowrap;
        overflow: visible;
    }

    .sidebar .menu-link span {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    /* Resources dropdown mobile - centré */
    .resources-dropdown .resources-panel {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
        width: 90vw !important;
        max-width: 350px !important;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 10000;
    }

    .resources-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .resource-item {
        padding: 10px 6px !important;
    }

    .resource-icon {
        font-size: 1.3rem !important;
    }

    .resource-value {
        font-size: 0.95rem !important;
    }

    .resource-label {
        font-size: 0.65rem !important;
    }
}

/* Sidebar close button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
}

.sidebar-close:hover {
    background: var(--accent-primary);
    color: white;
}

@media (max-width: 768px) {
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-header {
        position: relative;
        padding-right: 60px;
    }
}

/* ============================================
   SEASON STATUS IN SIDEBAR
   ============================================ */
.season-status {
    margin-top: auto;
    padding: 0.75rem 1rem;
    margin: 0 0.5rem 0.5rem 0.5rem;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.season-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.season-icon {
    font-size: 1.5rem;
}

.season-text {
    flex: 1;
}

.season-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.season-progress {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.season-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.season-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), #f59e0b);
    border-radius: 3px;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .season-status {
        padding: 0.75rem;
    }
}


/* ========================================
   MODE HYBRIDE : menus dark + contenu light
   ======================================== */

[data-theme="hybrid"] .main-content,
[data-theme="hybrid"] .athlete-modal,
[data-theme="hybrid"] .comp-modal-container,
[data-theme="hybrid"] .club-modal,
[data-theme="hybrid"] .nation-modal,
[data-theme="hybrid"] .help-modal,
[data-theme="hybrid"] .purchase-confirm-modal,
[data-theme="hybrid"] .card-select-modal,
[data-theme="hybrid"] .info-modal-content {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-hover: #f1f3f5;

    --text-primary: #1a1a1b;
    --text-secondary: #495057;
    --text-muted: #868e96;

    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.08);
}

/* Fond de la zone de contenu en hybrid */
[data-theme="hybrid"] .main-content {
    background-color: #eef1f5;
}

/* Ajustements specifiques hybrid pour les tables */
[data-theme="hybrid"] .main-content table th {
    background-color: #e9ecef;
    color: #1a1a1b;
}

[data-theme="hybrid"] .main-content table td {
    border-color: #dee2e6;
}

/* Inputs en mode hybrid */
[data-theme="hybrid"] .main-content input,
[data-theme="hybrid"] .main-content select,
[data-theme="hybrid"] .main-content textarea,
[data-theme="hybrid"] .athlete-modal input,
[data-theme="hybrid"] .athlete-modal select,
[data-theme="hybrid"] .comp-modal-container input,
[data-theme="hybrid"] .comp-modal-container select,
[data-theme="hybrid"] .club-modal input,
[data-theme="hybrid"] .club-modal select {
    background-color: #ffffff;
    color: #1a1a1b;
    border-color: #ced4da;
}

[data-theme="hybrid"] .main-content input:focus,
[data-theme="hybrid"] .main-content select:focus {
    border-color: #e31837;
    box-shadow: 0 0 0 2px rgba(227, 24, 55, 0.15);
}

/* Badges et tags en hybrid */
[data-theme="hybrid"] .main-content .rank-badge {
    color: #d97706;
}

/* Boutons en hybrid - garder les couleurs d'accent */
[data-theme="hybrid"] .main-content .btn-secondary,
[data-theme="hybrid"] .athlete-modal .btn-secondary {
    background-color: #e9ecef;
    color: #495057;
    border-color: #ced4da;
}

[data-theme="hybrid"] .main-content .btn-secondary:hover,
[data-theme="hybrid"] .athlete-modal .btn-secondary:hover {
    background-color: #dee2e6;
}

/* Scrollbar du contenu en hybrid */
[data-theme="hybrid"] .main-content::-webkit-scrollbar-track {
    background: #f1f3f5;
}

[data-theme="hybrid"] .main-content::-webkit-scrollbar-thumb {
    background: #ced4da;
}

[data-theme="hybrid"] .main-content::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}
/* ========================================
   HYBRID MODE - Fix texte blanc sur fond clair
   ======================================== */

/* Reset global - :where() a zero specificite donc les couleurs explicites
   (vert pour gains, rouge pour pertes, etc.) gardent la priorite */
[data-theme="hybrid"] .main-content :where(div, span, p, td, th, label, li, dt, dd, small, strong, em, b, i, h1, h2, h3, h4, h5, h6, a, button, input, select, textarea, option, summary, figcaption, legend, caption) {
    color: var(--text-primary);
}

[data-theme="hybrid"] .athlete-modal :where(div, span, p, td, th, label, li, h1, h2, h3, h4, h5, h6) {
    color: var(--text-primary);
}

[data-theme="hybrid"] .comp-modal-container :where(div, span, p, td, th, label, li, h1, h2, h3, h4, h5, h6) {
    color: var(--text-primary);
}

[data-theme="hybrid"] .club-modal :where(div, span, p, td, th, label, li, h1, h2, h3, h4, h5, h6) {
    color: var(--text-primary);
}

[data-theme="hybrid"] .nation-modal :where(div, span, p, td, th, label, li, h1, h2, h3, h4, h5, h6) {
    color: var(--text-primary);
}

[data-theme="hybrid"] .help-modal :where(div, span, p, td, th, label, li, h1, h2, h3, h4, h5, h6) {
    color: var(--text-primary);
}

/* Base text color for all content */
[data-theme="hybrid"] .main-content {
    color: var(--text-primary);
}

/* Titres et headings */
[data-theme="hybrid"] .main-content h1,
[data-theme="hybrid"] .main-content h2,
[data-theme="hybrid"] .main-content h3,
[data-theme="hybrid"] .main-content h4,
[data-theme="hybrid"] .main-content h5 {
    color: var(--text-primary) !important;
}

/* Labels et textes secondaires */
[data-theme="hybrid"] .main-content .balance-label,
[data-theme="hybrid"] .main-content .stat-card-title,
[data-theme="hybrid"] .main-content .section-title,
[data-theme="hybrid"] .main-content .card-title,
[data-theme="hybrid"] .main-content .form-label,
[data-theme="hybrid"] .main-content label {
    color: var(--text-secondary) !important;
}

/* Tables */
[data-theme="hybrid"] .main-content th {
    color: var(--text-secondary) !important;
}

[data-theme="hybrid"] .main-content td {
    color: var(--text-primary);
}

/* Texte general dans les divs et spans (pas les badges colores) */
[data-theme="hybrid"] .main-content .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="hybrid"] .main-content .text-primary {
    color: var(--text-primary) !important;
}

/* Descriptions, paragraphes */
[data-theme="hybrid"] .main-content p {
    color: var(--text-primary);
}

/* Liens */
[data-theme="hybrid"] .main-content a {
    color: var(--accent-primary);
}

/* Tabs et navigation dans le contenu */
[data-theme="hybrid"] .main-content .tab-btn,
[data-theme="hybrid"] .main-content .filter-btn,
[data-theme="hybrid"] .main-content .period-btn {
    color: var(--text-secondary);
}

[data-theme="hybrid"] .main-content .tab-btn.active,
[data-theme="hybrid"] .main-content .filter-btn.active,
[data-theme="hybrid"] .main-content .period-btn.active {
    color: white !important;
}

/* Cards dans le contenu */
[data-theme="hybrid"] .main-content .card,
[data-theme="hybrid"] .main-content .section-card {
    color: var(--text-primary);
}

/* Placeholder des inputs */
[data-theme="hybrid"] .main-content input::placeholder {
    color: var(--text-muted);
}

/* Stat values - garder les couleurs */
[data-theme="hybrid"] .main-content .stat-card-value {
    color: var(--text-primary);
}

/* Override pour les elements avec color:#fff explicite dans les pages */
[data-theme="hybrid"] .main-content .comp-row,
[data-theme="hybrid"] .main-content .athlete-row,
[data-theme="hybrid"] .main-content .list-item,
[data-theme="hybrid"] .main-content .transaction-date,
[data-theme="hybrid"] .main-content .transaction-desc,
[data-theme="hybrid"] .main-content .entry-name,
[data-theme="hybrid"] .main-content .entry-info {
    color: var(--text-primary);
}

/* Section headers */
[data-theme="hybrid"] .main-content .section-header {
    color: var(--text-primary) !important;
}

/* Empty states */
[data-theme="hybrid"] .main-content .empty-state,
[data-theme="hybrid"] .main-content .no-data {
    color: var(--text-muted);
}

/* Override tout element avec color:#fff hard-code via style inline */
[data-theme="hybrid"] .main-content [style*="color: #fff"],
[data-theme="hybrid"] .main-content [style*="color:#fff"],
[data-theme="hybrid"] .main-content [style*="color: white"],
[data-theme="hybrid"] .main-content [style*="color:white"] {
    color: var(--text-primary) !important;
}

/* Memes overrides pour les modals */
[data-theme="hybrid"] .athlete-modal [style*="color: #fff"],
[data-theme="hybrid"] .athlete-modal [style*="color:#fff"],
[data-theme="hybrid"] .athlete-modal [style*="color: white"],
[data-theme="hybrid"] .comp-modal-container [style*="color: #fff"],
[data-theme="hybrid"] .comp-modal-container [style*="color:#fff"],
[data-theme="hybrid"] .comp-modal-container [style*="color: white"],
[data-theme="hybrid"] .club-modal [style*="color: #fff"],
[data-theme="hybrid"] .club-modal [style*="color:#fff"],
[data-theme="hybrid"] .club-modal [style*="color: white"] {
    color: var(--text-primary) !important;
}
/* ============================================
   CONNECTED USERS (CHAT SIDEBAR)
   ============================================ */
.connected-users-section {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.connected-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.connected-users-count {
    background: var(--accent-primary, #e74c3c);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.connected-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 4px;
    min-height: 0;
}
.connected-users-list::-webkit-scrollbar { width: 4px; }
.connected-users-list::-webkit-scrollbar-track { background: transparent; }
.connected-users-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.connected-user-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 12px;
}
.connected-user-item:hover {
    background: var(--bg-hover);
}
.connected-user-flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}
.connected-user-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.connected-user-status.online {
    background: #43b581;
    box-shadow: 0 0 4px rgba(67, 181, 113, 0.4);
}
.connected-user-status.away {
    background: #faa61a;
}
.connected-user-status.offline {
    background: #72767d;
}
.connected-user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.connected-user-away-time {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.connected-user-badge {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.2;
}
.connected-user-badge.admin {
    background: #ed4245;
    color: #fff;
}
.connected-user-badge.president {
    background: #5865f2;
    color: #fff;
}

/* Mobile connected users */
.connected-users-mobile-btn {
    display: none;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    position: relative;
}
.connected-users-mobile-badge {
    background: #43b581;
    color: #fff;
    font-size: 10px;
    padding: 0 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.6;
}
.connected-users-mobile-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 4px 12px var(--shadow, rgba(0,0,0,0.3));
}
.connected-users-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .connected-users-mobile-btn {
        display: inline-flex;
    }
    .connected-users-section {
        display: none;
    }
}
/* ============================================
   ELECTION MODAL
   ============================================ */
.election-modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    text-align: center;
}
.election-modal-header {
    margin-bottom: 1rem;
}
.election-modal-header h2 {
    margin: 0.5rem 0 0 0;
    font-size: 1.3rem;
    color: var(--text-primary);
}
.election-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.election-deadline {
    color: var(--accent-primary, #e74c3c);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}
.election-candidates {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
    text-align: left;
}
.election-candidate-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.election-candidate-option:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}
.election-candidate-option.selected {
    border-color: #5865f2;
    background: rgba(88, 101, 242, 0.1);
}
.election-candidate-option input[type="radio"] {
    accent-color: #5865f2;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.election-candidate-name {
    flex: 1;
    font-weight: 500;
}
.election-blank-vote {
    border-style: dashed;
    color: var(--text-muted);
}
.election-blank-vote .election-candidate-name {
    font-style: italic;
    font-weight: 400;
}
.election-submit-btn {
    display: inline-block;
    padding: 12px 40px;
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.election-submit-btn:hover:not(:disabled) {
    background: #4752c4;
}
.election-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.election-error {
    color: #ed4245;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}
/* === FIX DROPDOWN NIVEAUX CALENDRIER === */
#level-filter,
#level-filter option,
.filter-group select,
.filter-group select option {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

[data-theme="light"] #level-filter,
[data-theme="light"] #level-filter option,
[data-theme="light"] .filter-group select,
[data-theme="light"] .filter-group select option {
    background-color: #ffffff !important;
    color: #1f2328 !important;
}

[data-theme="hybrid"] #level-filter,
[data-theme="hybrid"] #level-filter option,
[data-theme="hybrid"] .filter-group select,
[data-theme="hybrid"] .filter-group select option {
    background-color: #ffffff !important;
    color: #1f2328 !important;
}
