/**
 * Dark Mode centralisé pour le plugin Membres
 * Applique le dark mode automatiquement selon les préférences système
 * ou via la classe .dark-mode sur body
 */

/* ===========================
   DARK MODE AUTO (Système)
   =========================== */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        background: #0b1220 !important;
        color: #e5e7eb !important;
    }
    
    /* Activités globales */
    body:not(.light-mode) .membres-composer-card,
    body:not(.light-mode) .membres-activity-card,
    body:not(.light-mode) .membres-sidebar-block {
        background: #0f172a !important;
        border-color: #334155 !important;
    }
    
    body:not(.light-mode) .membres-activity-body,
    body:not(.light-mode) .membres-activity-content,
    body:not(.light-mode) h1, body:not(.light-mode) h2, 
    body:not(.light-mode) h3, body:not(.light-mode) h4 {
        color: #e5e7eb !important;
    }
    
    body:not(.light-mode) textarea,
    body:not(.light-mode) input[type="text"],
    body:not(.light-mode) input[type="email"],
    body:not(.light-mode) select {
        background: #0b1220 !important;
        border-color: #334155 !important;
        color: #e5e7eb !important;
    }
    
    body:not(.light-mode) a {
        color: #93c5fd !important;
    }
    
    body:not(.light-mode) a:hover {
        color: #bfdbfe !important;
    }
    
    /* Événements et événements sidebar */
    body:not(.light-mode) .membres-events-block,
    body:not(.light-mode) .event-card {
        background: #0f172a !important;
        border-color: #334155 !important;
    }
    
    body:not(.light-mode) .event-card h3 {
        color: #e5e7eb !important;
    }
    
    /* Leaderboard */
    body:not(.light-mode) .membres-leaderboard-container > div {
        background: #0f172a !important;
    }
    
    body:not(.light-mode) .leaderboard-item {
        border-bottom-color: #334155 !important;
    }
    
    body:not(.light-mode) .leaderboard-item:hover {
        background: #1e293b !important;
    }
    
    /* Badges */
    body:not(.light-mode) .membres-badge,
    body:not(.light-mode) .membres-role-badge,
    body:not(.light-mode) .membres-tab-badge,
    body:not(.light-mode) .membres-page-badge,
    body:not(.light-mode) .session-badge {
        background: #1e293b !important;
        color: #e5e7eb !important;
    }
    
    /* Onglets */
    body:not(.light-mode) .membres-nav-tabs,
    body:not(.light-mode) .membres-profile-tabs {
        background: #0f172a !important;
        border-color: #334155 !important;
    }
    
    body:not(.light-mode) .membres-nav-tab,
    body:not(.light-mode) .membres-profile-tab {
        color: #94a3b8 !important;
    }
    
    body:not(.light-mode) .membres-nav-tab.active,
    body:not(.light-mode) .membres-profile-tab.active {
        background: #1e293b !important;
        color: #e5e7eb !important;
    }
    
    /* Header overlay pages communautaires */
    body:not(.light-mode) .membres-user-header-overlay {
        background: rgba(15, 23, 42, 0.85) !important;
        color: #e5e7eb !important;
    }
    
    body:not(.light-mode) .membres-user-header-overlay h1 {
        color: #e5e7eb !important;
    }
    
    body:not(.light-mode) .membres-planning-day-title {
        color: #e5e7eb !important;
        background: #1e293b !important;
    }
    
    body:not(.light-mode) .membres-planning-event {
        background: #0f172a !important;
        border-color: #334155 !important;
    }
    
    /* Surcharge des styles inline */
    body:not(.light-mode) [style*="background:#fff"],
    body:not(.light-mode) [style*="background: #fff"],
    body:not(.light-mode) [style*="background:white"],
    body:not(.light-mode) [style*="background: white"] {
        background: #0f172a !important;
    }
    
    body:not(.light-mode) [style*="color:#0f172a"],
    body:not(.light-mode) [style*="color: #0f172a"],
    body:not(.light-mode) [style*="color:#222"],
    body:not(.light-mode) [style*="color: #222"] {
        color: #e5e7eb !important;
    }
    
    body:not(.light-mode) [style*="border:1px solid #e2e8f0"],
    body:not(.light-mode) [style*="border: 1px solid #e2e8f0"] {
        border-color: #334155 !important;
    }
    
    body:not(.light-mode) [style*="color:#64748b"],
    body:not(.light-mode) [style*="color: #64748b"],
    body:not(.light-mode) [style*="color:#555"],
    body:not(.light-mode) [style*="color: #555"] {
        color: #94a3b8 !important;
    }
    
    body:not(.light-mode) [style*="background:#f8fafc"],
    body:not(.light-mode) [style*="background: #f8fafc"] {
        background: #1e293b !important;
    }
}

/* ===========================
   DARK MODE MANUEL (.dark-mode)
   =========================== */
   
/* Body et conteneurs principaux */
body.dark-mode {
    background: #0b1220 !important;
    color: #e5e7eb !important;
}

/* Cartes et blocs */
body.dark-mode .membres-composer-card,
body.dark-mode .membres-activity-card,
body.dark-mode .membres-sidebar-block,
body.dark-mode .membres-edit-page-wrapper,
body.dark-mode .membres-manage-page-card,
body.dark-mode .membres-profile-card,
body.dark-mode .membres-community-card,
body.dark-mode .membres-vod-card,
body.dark-mode .membres-game-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}

/* Titres */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #e5e7eb !important;
}

/* Textes */
body.dark-mode p,
body.dark-mode span,
body.dark-mode .membres-activity-body,
body.dark-mode .membres-activity-content,
body.dark-mode label {
    color: #e5e7eb !important;
}

/* Textes secondaires */
body.dark-mode .membres-activity-meta,
body.dark-mode .membres-user-login,
body.dark-mode small {
    color: #9ca3af !important;
}

/* Formulaires */
body.dark-mode textarea,
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="url"],
body.dark-mode input[type="number"],
body.dark-mode select {
    background: #0b1220 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-mode textarea::placeholder,
body.dark-mode input::placeholder {
    color: #6b7280 !important;
}

/* Boutons primaires */
body.dark-mode .membres-btn-primary,
body.dark-mode button[type="submit"],
body.dark-mode .wp-block-button__link {
    background: #1d4ed8 !important;
    color: #fff !important;
    border-color: #1e40af !important;
}

body.dark-mode .membres-btn-primary:hover,
body.dark-mode button[type="submit"]:hover {
    background: #1e40af !important;
}

/* Boutons secondaires */
body.dark-mode .membres-btn-secondary,
body.dark-mode button[type="button"] {
    background: #111827 !important;
    color: #e5e7eb !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-btn-secondary:hover,
body.dark-mode button[type="button"]:hover {
    background: #1f2937 !important;
    color: #93c5fd !important;
}

/* Liens */
body.dark-mode a {
    color: #93c5fd !important;
}

body.dark-mode a:hover {
    color: #bfdbfe !important;
}

/* Borders */
body.dark-mode .membres-activity-header,
body.dark-mode .membres-activity-footer,
body.dark-mode .membres-user-footer {
    border-color: #334155 !important;
}

/* Composer & Commentaires */
body.dark-mode #global-activity-content,
body.dark-mode .comment-text {
    background: #0b1220 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

/* Panels */
body.dark-mode #composer-mood-panel,
body.dark-mode #emoji-panel,
body.dark-mode .membres-modal {
    background: #0f172a !important;
    border-color: #334155 !important;
}

/* Tabs */
body.dark-mode .membres-tabs,
body.dark-mode .membres-tab-content {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-tab-btn {
    background: #111827 !important;
    color: #9ca3af !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-tab-btn:hover,
body.dark-mode .membres-tab-btn.active {
    background: #1f2937 !important;
    color: #93c5fd !important;
}

/* Header profil */
body.dark-mode .membres-user-header-overlay {
    background: linear-gradient(
        to bottom,
        rgba(15, 23, 42, 0.75),
        rgba(11, 18, 32, 0.95)
    ) !important;
}

/* Badges */
body.dark-mode .membres-badge,
body.dark-mode .membres-status-indicator {
    background: #111827 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

/* Erreurs */
body.dark-mode .membres-error,
body.dark-mode #global-activity-error {
    background: #2a0f12 !important;
    border-color: #7f1d1d !important;
    color: #fecaca !important;
}

/* Success */
body.dark-mode .membres-success {
    background: #0f2a1a !important;
    border-color: #166534 !important;
    color: #bbf7d0 !important;
}

/* Footer Elementor */
body.dark-mode footer,
body.dark-mode .elementor,
body.dark-mode .elementor-widget-container {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

body.dark-mode footer a,
body.dark-mode .elementor a {
    color: #93c5fd !important;
}

body.dark-mode footer a:hover,
body.dark-mode .elementor a:hover {
    color: #bfdbfe !important;
}

/* Roue quotidienne */
body.dark-mode .membres-wheel-container {
    background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%) !important;
}

body.dark-mode .membres-wheel-wrapper,
body.dark-mode .membres-wheel-stat {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-wheel-title {
    color: #e5e7eb !important;
}

/* Messages */
body.dark-mode .membres-messages-wrapper,
body.dark-mode .membres-conversation-item,
body.dark-mode .membres-message-item {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-mode .membres-message-input {
    background: #0b1220 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

/* Pages communautaires */
body.dark-mode .membres-community-header,
body.dark-mode .membres-community-content {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-community-stat {
    background: #111827 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-mode .membres-user-header-overlay {
    background: rgba(15, 23, 42, 0.85) !important;
    color: #e5e7eb !important;
}

body.dark-mode .membres-user-header-overlay h1 {
    color: #e5e7eb !important;
}

body.dark-mode .membres-user-login {
    color: #94a3b8 !important;
}

body.dark-mode .membres-user-description {
    color: #cbd5e1 !important;
}

/* Événements */
body.dark-mode .membres-events-block,
body.dark-mode .membres-sidebar-block {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-events-block h4,
body.dark-mode .membres-sidebar-block h4 {
    color: #e5e7eb !important;
}

body.dark-mode .membres-events-block a,
body.dark-mode .event-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-mode .event-card h3 {
    color: #e5e7eb !important;
}

body.dark-mode .event-card div {
    color: #94a3b8 !important;
}

/* Leaderboard */
body.dark-mode .membres-leaderboard-container > div:first-child h1 {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%) !important;
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.dark-mode .membres-leaderboard-container > div:first-child p {
    color: #94a3b8 !important;
}

body.dark-mode .leaderboard-filter-btn {
    background: transparent !important;
}

body.dark-mode .leaderboard-filter-btn:not(.active) {
    color: inherit !important;
}

body.dark-mode #podium,
body.dark-mode #leaderboard-list {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

body.dark-mode .leaderboard-item {
    border-bottom-color: #334155 !important;
}

body.dark-mode .leaderboard-item:hover {
    background: #1e293b !important;
}

body.dark-mode .podium-card {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%) !important;
}

/* Badges */
body.dark-mode .membres-badge,
body.dark-mode .membres-role-badge,
body.dark-mode .membres-tab-badge,
body.dark-mode .membres-games-badge,
body.dark-mode .membres-page-badge,
body.dark-mode .membres-page-card-badge,
body.dark-mode .session-badge,
body.dark-mode .membres-planning-badge-today {
    background: #1e293b !important;
    color: #e5e7eb !important;
    border-color: #334155 !important;
}

/* Onglets pages communautaires */
body.dark-mode .membres-nav-tabs,
body.dark-mode .membres-profile-tabs {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-nav-tab,
body.dark-mode .membres-profile-tab {
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-nav-tab:hover,
body.dark-mode .membres-profile-tab:hover {
    background: #1e293b !important;
    color: #e5e7eb !important;
}

body.dark-mode .membres-nav-tab.active,
body.dark-mode .membres-profile-tab.active {
    background: #1e293b !important;
    color: #e5e7eb !important;
    border-bottom-color: #8b5cf6 !important;
}

/* Contenu des onglets */
body.dark-mode .membres-tab-content {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

body.dark-mode .membres-planning-day-title {
    color: #e5e7eb !important;
    background: #1e293b !important;
}

body.dark-mode .membres-planning-event {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

/* Surcharge des styles inline avec couleurs fixes */
body.dark-mode [style*="background:#fff"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background:white"],
body.dark-mode [style*="background: white"] {
    background: #0f172a !important;
}

body.dark-mode [style*="color:#0f172a"],
body.dark-mode [style*="color: #0f172a"],
body.dark-mode [style*="color:#222"],
body.dark-mode [style*="color: #222"],
body.dark-mode [style*="color:#333"],
body.dark-mode [style*="color: #333"] {
    color: #e5e7eb !important;
}

body.dark-mode [style*="border:1px solid #e2e8f0"],
body.dark-mode [style*="border: 1px solid #e2e8f0"],
body.dark-mode [style*="border-color:#e2e8f0"],
body.dark-mode [style*="border-color: #e2e8f0"] {
    border-color: #334155 !important;
}

body.dark-mode [style*="color:#64748b"],
body.dark-mode [style*="color: #64748b"],
body.dark-mode [style*="color:#555"],
body.dark-mode [style*="color: #555"] {
    color: #94a3b8 !important;
}

body.dark-mode [style*="background:#f8fafc"],
body.dark-mode [style*="background: #f8fafc"],
body.dark-mode [style*="background:#f1f5f9"],
body.dark-mode [style*="background: #f1f5f9"] {
    background: #1e293b !important;
}

/* Cibler spécifiquement les éléments avec classes identifiées */
body.dark-mode .membres-events-block > div > a,
body.dark-mode .membres-community-pages-block > div > a {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-mode .membres-events-block > div > a:hover,
body.dark-mode .membres-community-pages-block > div > a:hover {
    background: #334155 !important;
}

/* Responsiveness */
@media (max-width: 768px) {
    body.dark-mode .membres-mobile-menu {
        background: #0f172a !important;
        border-color: #334155 !important;
    }
}
