/* ==========================================
   MODO OSCURO OPTIMIZADO - YACHAY
   ========================================== */

/* ------------------------------------------------------------------- */
/* 1. VARIABLES PRINCIPALES - MODO OSCURO */
/* ------------------------------------------------------------------- */
[data-theme="dark"] {
    /* FONDOS PRINCIPALES */
    --bg-primary: #0f172a;      /* Fondo principal oscuro */
    --bg-secondary: #1e293b;    /* Fondo secundario */
    --bg-dark: #334155;         /* Fondo para elementos destacados */
    --bg-overlay: rgba(0, 0, 0, 0.8);

    /* TEXTOS OPTIMIZADOS */
    --text-primary: #f8fafc;    /* Texto principal - más brillante */
    --text-secondary: #e2e8f0;  /* Texto secundario - mejor contraste */
    --text-tertiary: #94a3b8;   /* Texto terciario */
    --text-white: #0f172a;      /* Invertido para modo oscuro */

    /* COLORES PRIMARIOS MEJORADOS */
    --primary-50: #0f1629;
    --primary-100: #1e293b;
    --primary-200: #334155;
    --primary-300: #475569;
    --primary-400: #64748b;
    --primary-500: #0ea5e9;     /* Azul principal más vibrante */
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    /* COLORES SECUNDARIOS MEJORADOS */
    --secondary-50: #1e1b4b;
    --secondary-100: #312e81;
    --secondary-200: #3730a3;
    --secondary-300: #4338ca;
    --secondary-400: #5b21b6;
    --secondary-500: #7c3aed;   /* Púrpura más vibrante */
    --secondary-600: #6d28d9;
    --secondary-700: #5b21b6;
    --secondary-800: #4c1d95;
    --secondary-900: #3730a3;

    /* COLORES DE ESTADO MEJORADOS */
    --success-50: #022c22;
    --success-500: #10b981;
    --success-600: #059669;

    --warning-50: #2d1b09;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --error-50: #2d0a0a;
    --error-500: #ef4444;
    --error-600: #dc2626;

    /* GRISES MEJORADOS */
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;

    /* SOMBRAS MEJORADAS */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 20px 30px -5px rgb(0 0 0 / 0.7);
    --shadow-2xl: 0 30px 60px -12px rgb(0 0 0 / 0.8);

    /* HEADER MEJORADO */
    --header-scrolled-bg: rgba(15, 23, 42, 0.95);
}

/* ------------------------------------------------------------------- */
/* 2. ELEMENTOS PRINCIPALES */
/* ------------------------------------------------------------------- */

/* BODY - Transiciones suaves */
[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CARDS MEJORADAS */
[data-theme="dark"] .card {
    background: var(--bg-secondary);
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

[data-theme="dark"] .card:hover {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.2), var(--shadow-xl);
    transform: translateY(-3px);
}

/* ------------------------------------------------------------------- */
/* 3. HERO SECTION MEJORADA */
/* ------------------------------------------------------------------- */

/* Hero con gradiente dinámico mejorado */
[data-theme="dark"] .hero {
    background: linear-gradient(135deg,
        var(--bg-primary) 0%,
        var(--bg-secondary) 30%,
        #1e3a5f 70%,
        #0f1629 100%);
}

/* Efectos de luz mejorados */
[data-theme="dark"] .hero::before {
    background-image:
        radial-gradient(circle at 25% 25%, rgba(14, 165, 233, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}

/* ------------------------------------------------------------------- */
/* 4. BOTONES MEJORADOS */
/* ------------------------------------------------------------------- */

/* Botón primario mejorado */
[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
}

/* Botón secundario mejorado */
[data-theme="dark"] .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--gray-300);
    transition: all 0.3s ease;
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Botón outline mejorado */
[data-theme="dark"] .btn-outline-primary {
    background: transparent;
    color: var(--primary-400);
    border: 2px solid var(--primary-400);
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

/* ------------------------------------------------------------------- */
/* 5. HEADER MEJORADO */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .header {
    background: var(--bg-primary);
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .header.scrolled {
    background: var(--header-scrolled-bg);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Mejorar logo en modo oscuro */
[data-theme="dark"] .logo-icon {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

[data-theme="dark"] .logo-text {
    background: linear-gradient(135deg, var(--primary-400), var(--secondary-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mejorar navegación en modo oscuro */
[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

[data-theme="dark"] .nav-link:hover {
    color: var(--primary-400);
}

[data-theme="dark"] .nav-link.active {
    color: var(--primary-400);
    font-weight: 600;
}

/* Corregir underline animation en modo oscuro */
[data-theme="dark"] .nav-link::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
}

[data-theme="dark"] .nav-link:hover::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
}

[data-theme="dark"] .nav-link.active::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
    width: 100%;
}

/* ------------------------------------------------------------------- */
/* 6. COMPONENTES MEJORADOS */
/* ------------------------------------------------------------------- */

/* Cards flotantes */
[data-theme="dark"] .floating-card,
[data-theme="dark"] .feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .floating-card:hover,
[data-theme="dark"] .feature-card:hover {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.2);
}

/* ------------------------------------------------------------------- */
/* 7. FORMULARIOS MEJORADOS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--gray-300);
    transition: all 0.3s ease;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] .form-control:focus {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    outline: none;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-tertiary);
}

/* Botón de modo oscuro mejorado */
[data-theme="dark"] #theme-toggle {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--gray-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] #theme-toggle:hover {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    color: var(--primary-400);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

/* Botones de acci\u00f3n en la navbar */
[data-theme="dark"] .nav-actions .btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--gray-300);
    transition: all 0.3s ease;
}

[data-theme="dark"] .nav-actions .btn:hover {
    background: var(--bg-dark);
    border-color: var(--primary-500);
    color: var(--text-primary);
}

/* Botón admin mejorado */
[data-theme="dark"] .btn-admin {
    color: var(--primary-400);
    border: 2px solid var(--primary-400);
    background: transparent;
    transition: all 0.3s ease;
}

[data-theme="dark"] .btn-admin:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    transform: translateY(-1px);
}

/* Usuario logueado - mejorar estilos */
[data-theme="dark"] .user-menu a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--gray-300) !important;
}

[data-theme="dark"] .user-menu a:hover {
    background: var(--bg-dark) !important;
    border-color: var(--primary-500) !important;
    color: var(--primary-400) !important;
}

/* ------------------------------------------------------------------- */
/* 7.5. MENÚ MÓVIL MEJORADO */
/* ------------------------------------------------------------------- */

/* Menú hamburguesa en modo oscuro */
[data-theme="dark"] .menu-toggle span {
    background: var(--primary-400);
}

[data-theme="dark"] .menu-toggle:hover span {
    background: var(--primary-300);
}

/* Menú lateral en modo oscuro */
[data-theme="dark"] .nav.active {
    background: var(--bg-primary);
    border-right: 1px solid var(--gray-300);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------- */
/* 8. PANEL ADMIN MEJORADO */
/* ------------------------------------------------------------------- */

/* Variables específicas del admin */
[data-theme="dark"] {
    --admin-bg: var(--bg-primary);
    --admin-surface: var(--bg-secondary);
    --admin-border: var(--gray-300);
    --admin-text: var(--text-primary);
    --admin-muted: var(--text-tertiary);
    --admin-accent: var(--primary-400);
    --admin-accent-600: var(--primary-500);
    --admin-success: var(--success-500);
    --admin-danger: var(--error-500);
    --admin-shadow: var(--shadow-xl);
}

/* Container principal */
[data-theme="dark"] .admin-panel {
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
}

/* Navegación de tabs mejorada */
[data-theme="dark"] .admin-tabs {
    background: var(--admin-surface);
    border-bottom: 2px solid var(--admin-border);
}

[data-theme="dark"] .tab-btn {
    background: transparent;
    color: var(--admin-muted);
    border: 2px solid transparent;
    border-bottom: none;
    transition: all 0.3s ease;
}

[data-theme="dark"] .tab-btn:hover {
    background: var(--admin-surface);
    color: var(--admin-text);
    border-color: var(--admin-accent);
}

[data-theme="dark"] .tab-btn.active {
    background: var(--admin-accent);
    color: white;
    border-color: var(--admin-accent);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

/* Paneles y contenido */
[data-theme="dark"] .tab-panel {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-lg);
}

/* ------------------------------------------------------------------- */
/* 9. TABLAS MEJORADAS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .admin-table,
[data-theme="dark"] .table {
    background: var(--admin-surface);
    color: var(--admin-text);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .admin-table thead th,
[data-theme="dark"] .table thead th {
    background: var(--admin-bg);
    color: var(--admin-text);
    border-color: var(--admin-border);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
}

[data-theme="dark"] .admin-table tbody td,
[data-theme="dark"] .table tbody td {
    background: var(--admin-surface);
    color: var(--admin-text);
    border-color: var(--admin-border);
    transition: background-color 0.2s ease;
}

[data-theme="dark"] .admin-table tbody tr:hover td,
[data-theme="dark"] .table tbody tr:hover td {
    background: var(--bg-dark);
}

/* ------------------------------------------------------------------- */
/* 10. ALERTAS Y ESTADOS MEJORADOS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .alert-success,
[data-theme="dark"] .alert {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-500);
    border-radius: var(--radius-md);
}

[data-theme="dark"] .alert-error,
[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-500);
    border-radius: var(--radius-md);
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-500);
    border-radius: var(--radius-md);
}

[data-theme="dark"] .alert-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: var(--primary-400);
    border-radius: var(--radius-md);
}

/* ------------------------------------------------------------------- */
/* 11. MODALES MEJORADOS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-content {
    background: var(--admin-surface);
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--admin-shadow);
}

/* ------------------------------------------------------------------- */
/* 12. BADGES Y ETIQUETAS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .badge-estado,
[data-theme="dark"] .badge,
[data-theme="dark"] [class*="badge-"] {
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .badge-success {
    background: var(--success-500);
}

[data-theme="dark"] .badge-error,
[data-theme="dark"] .badge-danger {
    background: var(--error-500);
}

[data-theme="dark"] .badge-warning {
    background: var(--warning-500);
}

[data-theme="dark"] .badge-info {
    background: var(--primary-500);
}

/* ------------------------------------------------------------------- */
/* 13. SUSCRIPCIONES Y PAGOS */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .admin-suscripciones-panel {
    background: var(--admin-bg);
    color: var(--admin-text);
}

/* Conversión de fondos blancos inline */
[data-theme="dark"] .admin-suscripciones-panel [style*="background: white"],
[data-theme="dark"] .admin-suscripciones-panel [style*="background:white"] {
    background: var(--admin-surface) !important;
    color: var(--admin-text) !important;
}

/* Tarjetas de pago mejoradas */
[data-theme="dark"] .pago-item {
    background: var(--admin-surface) !important;
    border: 1px solid var(--admin-border) !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.3s ease !important;
}

[data-theme="dark"] .pago-item:hover {
    background: var(--bg-dark) !important;
    border-color: var(--admin-accent) !important;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15) !important;
    transform: translateY(-2px) !important;
}

/* Códigos de suscripción */
[data-theme="dark"] [style*="font-family: 'Courier New'"][style*="background: white"] {
    background: var(--bg-dark) !important;
    border: 2px solid var(--admin-accent) !important;
    color: var(--admin-accent) !important;
    border-radius: var(--radius-md) !important;
}

/* ------------------------------------------------------------------- */
/* 14. FILTROS Y CONTROLES */
/* ------------------------------------------------------------------- */

[data-theme="dark"] .filter-btn {
    background: var(--admin-surface);
    color: var(--admin-muted);
    border: 2px solid var(--admin-border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

[data-theme="dark"] .filter-btn.active {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%) !important;
    color: white !important;
    border-color: var(--primary-500) !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2) !important;
}

[data-theme="dark"] .filter-btn:hover:not(.active) {
    background: var(--bg-dark);
    border-color: var(--admin-accent);
    color: var(--admin-text);
}

/* ------------------------------------------------------------------- */
/* 15. TIPOGRAFÍA MEJORADA */
/* ------------------------------------------------------------------- */

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-primary);
    font-weight: 700;
}

[data-theme="dark"] p {
    color: var(--text-secondary);
    line-height: 1.7;
}

[data-theme="dark"] .text-muted {
    color: var(--text-tertiary) !important;
}

/* Headers con gradiente mejorado */
[data-theme="dark"] [style*="background: linear-gradient(135deg, #667eea"] {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 100%) !important;
    color: white !important;
}

/* ------------------------------------------------------------------- */
/* 16. ELEMENTOS ESPECÍFICOS FINALES */
/* ------------------------------------------------------------------- */

/* Links mejorados */
[data-theme="dark"] a {
    color: var(--primary-400);
    transition: color 0.3s ease;
}

[data-theme="dark"] a:hover {
    color: var(--primary-300);
}

/* Separadores y divisores */
[data-theme="dark"] hr {
    border-color: var(--admin-border);
    opacity: 0.3;
}

/* Áreas con fondo específico */
[data-theme="dark"] [style*="background: rgba(249, 250, 251"] {
    background: var(--bg-dark) !important;
    border-radius: var(--radius-md) !important;
}

/* ------------------------------------------------------------------- */
/* 17. TRANSICIONES GLOBALES */
/* ------------------------------------------------------------------- */

[data-theme="dark"] * {
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optimización para rendimiento */
[data-theme="dark"] *,
[data-theme="dark"] *:before,
[data-theme="dark"] *:after {
    will-change: auto;
}

/* ------------------------------------------------------------------- */
/* 18. NAVEGACIÓN - ANIMACIONES Y COLORES */
/* ------------------------------------------------------------------- */

/* Header y navegación en modo oscuro */
[data-theme="dark"] .header {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--primary-800) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .logo-text {
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Enlaces de navegación - colores y animaciones */
[data-theme="dark"] .nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.3s ease !important;
}

[data-theme="dark"] .nav-link:hover {
    color: var(--primary-400) !important;
}

[data-theme="dark"] .nav-link.active {
    color: var(--primary-400) !important;
    font-weight: 600 !important;
}

/* Animación de subrayado - FORZAR COLORES */
[data-theme="dark"] .nav-link::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
    transition: width 0.3s ease !important;
}

[data-theme="dark"] .nav-link:hover::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
    width: 100% !important;
}

[data-theme="dark"] .nav-link.active::after {
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400)) !important;
    width: 100% !important;
}

/* ==========================================
   FIN DEL ARCHIVO DARK-MODE.CSS OPTIMIZADO
   ========================================== */

