/* =================================================================
   ESTILOS ORIGINALES (MANTENIDOS AL 100% - RESPETO TOTAL)
   ================================================================= */
    body {
        font-family: 'Inter', sans-serif;
        background-color: #000000;
        background-image: linear-gradient(rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.94)), url('https://raw.githubusercontent.com/vikingo-44/Software-Gym/main/wallpaper.png');
        background-size: cover;
        background-position: center;
        background-attachment: fixed;
        color: #ffffff;
        overflow: hidden; /* Se sobreescribe en móvil más abajo */
        touch-action: pan-x pan-y; /* Permite scroll pero ayuda a mitigar zoom accidental */
        -webkit-text-size-adjust: 100%; /* Evita que iOS cambie el tamaño de letra al rotar */
    }

    /* .bebas-neue-regular {
        font-family: "Bebas Neue", sans-serif;
        font-weight: 400;
        font-style: normal;
        } */
            
    .viking-red { color: #FF0000; }
    .viking-bg-red { background-color: #FF0000; }

    .glass-sidebar {
        background: rgba(8, 8, 8, 0.98);
        backdrop-filter: blur(40px);
        border-right: 1px solid rgba(255, 0, 0, 0.15);
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s ease;
    }

    .glass-card {
        /* Cambiamos el 0.03 por 0.1 o 0.15 para que sea más blanco */
        background: rgba(255, 255, 255, 0.12); 
        
        /* Bajamos el desenfoque para que el fondo no oscurezca tanto el blanco */
        backdrop-filter: blur(12px); 
        
        /* Hacemos el borde un poquito más visible */
        border: 1px solid rgba(255, 255, 255, 0.2); 
        
        transition: all 0.3s ease;
    }
    .glass-card:hover { border-color: rgba(255, 0, 0, 0.3); background: rgba(255, 255, 255, 0.05); }

    .logo-viking-glow {
        filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.6));
        animation: pulse-glow 3s infinite alternate;
    }
    @keyframes pulse-glow {
        from { filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.4)); transform: scale(1); }
        to { filter: drop-shadow(0 0 25px rgba(255, 0, 0, 0.8)); transform: scale(1.05); }
    }

    .nav-item { 
        display: flex !important;
        align-items: center !important;
        gap: 1.25rem !important; 
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
        position: relative; 
        white-space: nowrap; 
        text-align: left !important;
    }
    .nav-item:hover, .nav-item.active { 
        color: #FF0000; 
        background: linear-gradient(90deg, rgba(255, 0, 0, 0.1) 0%, transparent 100%);
    }
    .nav-item.active::before {
        content: ''; position: absolute; left: 0; top: 25%; height: 50%; width: 4px;
        background: #FF0000; box-shadow: 0 0 15px #FF0000;
    }

    .view-content { display: none; flex-direction: column; height: 100%; }
    .view-content.active { display: flex; }

    #login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center !important;
    justify-content: flex-end !important; /* ESTO es lo que empuja tu recuadro a la derecha */
    }

    .custom-scrollbar::-webkit-scrollbar { width: 4px; }
    .custom-scrollbar::-webkit-scrollbar-thumb { background: #FF0000; border-radius: 10px; }

    .viking-table-row { border-bottom: 1px solid rgba(255, 255, 255, 0.03); transition: background 0.2s; }
    .viking-table-row:hover { background: rgba(255, 0, 0, 0.02); }

    /* SECCIÓN CALENDARIO CORREGIDA - ESTILO PROFESIONAL COMPACTO (40PX) */
    .calendar-container {
        display: grid; 
        grid-template-columns: 80px repeat(6, 1fr);
        background: #000000; 
        border-radius: 24px; 
        overflow-y: auto;
        border: 1px solid rgba(255, 255, 255, 0.1);
        grid-auto-rows: 40px !important;
        gap: 0 !important; /* Sin gap para que el sticky sea bloque sólido */
    }
    .cal-header { 
        background: #000000 !important; 
        padding: 0 4px; 
        height: 40px;
        display: flex !important;
        flex-direction: row !important; /* Forzado horizontal */
        align-items: center; 
        justify-content: center; 
        font-weight: 900; 
        font-size: 10px; 
        border-right: 1px solid rgba(255,255,255,0.1); 
        border-bottom: 3px solid #FF0000 !important; 
        text-transform: uppercase;
        letter-spacing: 0.5px;
        z-index: 50 !important; /* Superior a las clases para taparlas al scrollear */
        position: sticky;
        top: 0;
        white-space: nowrap; /* Evita saltos de línea */
    }
    .cal-cell { 
        border-right: 1px solid rgba(255,255,255,0.05); 
        border-bottom: 1px solid rgba(255,255,255,0.05); 
        height: 40px !important; 
        min-height: 40px !important; 
        position: relative; 
    }
    .cal-cell-closed {
        background: repeating-linear-gradient(45deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px);
        opacity: 0.3;
    }

    /* Lógica Sidebar Colapsada PC (Sagrado) */
    .sidebar-collapsed { width: 80px !important; }
    .sidebar-collapsed .brand-text, 
    .sidebar-collapsed .user-details, 
    .sidebar-collapsed .nav-text, 
    .sidebar-collapsed .nav-section-title,
    .sidebar-collapsed .chevron-icon { display: none; }
    .sidebar-collapsed .nav-item { justify-content: center !important; padding-left: 0; padding-right: 0; gap: 0 !important; }
    
    .sidebar-collapsed #user-avatar-container {
        width: 40px !important;
        height: 40px !important;
        margin-bottom: 10px !important;
    }
    .sidebar-collapsed #user-initials { font-size: 14px !important; }
    .sidebar-collapsed .user-profile-block {
        padding-left: 0 !important;
        padding-right: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .viking-input {
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 1rem;
        padding: 0.85rem 1.25rem;
        width: 100%;
        outline: none;
        font-weight: 700;
        font-size: 0.95rem;
        color: white;
        transition: all 0.2s;
    }
    .viking-input:focus { border-color: #FF0000; box-shadow: 0 0 10px rgba(255, 0, 0, 0.1); }
    select.viking-input option { background: #0a0a0a; color: white; }

    .viking-modal {
        position: fixed; inset: 0; z-index: 1000;
        background: rgba(0,0,0,0.9); backdrop-filter: blur(15px);
        display: none; align-items: center; justify-content: center;
        padding: 20px;
    }

    .metodo-chip.active {
        background: rgba(255, 0, 0, 0.1);
        border-color: rgba(255, 0, 0, 0.4);
        color: #ff0000;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.1);
    }

    /* BADGE DE CLASE REFINADO - ESTÉTICA PREMIUM MEJORADA (COMPACTO) */
    .class-badge {
        color: white !important; 
        font-weight: 900;
        padding: 4px 6px; 
        text-transform: uppercase; 
        font-style: italic;
        cursor: pointer;
        display: flex; 
        flex-direction: column; 
        justify-content: center; 
        align-items: center;
        text-align: center; 
        /* Ocupa 2 filas (1 hora) menos el margen para 40px slots */
        height: calc(200% - 6px) !important; 
        width: calc(100% - 6px);
        margin: 3px;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.25);
        box-shadow: 0 6px 20px rgba(0,0,0,0.6);
        position: absolute;
        top: 0; 
        left: 0; 
        z-index: 20;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        /* MEJORA: Asegurar que no se rompa el layout */
        box-sizing: border-box;
    }
    .class-badge:hover { 
        transform: translateY(-2px) scale(0.98); 
        z-index: 30; 
        filter: brightness(1.15);
        box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    }

    /* Jerarquía Tipográfica dentro del Badge */
    .badge-title {
        font-size: 11px;
        line-height: 1;
        font-weight: 900;
        margin-bottom: 2px;
        display: block;
        width: 100%;
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .badge-coach {
        font-size: 9px;
        opacity: 0.8;
        font-weight: 700;
        margin-bottom: 4px;
        text-transform: lowercase;
        letter-spacing: 0.3px;
    }
    .badge-capacity {
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(4px);
        padding: 1px 8px;
        border-radius: 99px;
        font-size: 10px;
        border: 1px solid rgba(255,255,255,0.15);
    }

    /* BOTÓN FLOTANTE WHATSAPP */
    .whatsapp-float {
        position: fixed;
        width: 50px;
        height: 50px;
        bottom: 25px;
        right: 25px; 
        background-color: #25d366;
        color: #FFF;
        border-radius: 50px;
        text-align: center;
        box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
        z-index: 1000; 
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }
    .whatsapp-float:hover {
        transform: scale(1.1);
        background-color: #128c7e;
    }

    .filter-btn {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #999;
        padding: 8px 16px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
        font-style: italic;
        transition: all 0.3s;
    }
    .filter-btn.active { background: #FF0000; color: #000; border-color: #FF0000; }

    .payment-method-btn {
        border: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(255, 255, 255, 0.02);
        transition: all 0.2s;
    }
    .payment-method-btn.active {
        border-color: #FF0000;
        background: rgba(255, 0, 0, 0.1);
        color: #FF0000;
    }

    .cobrar-tab {
        padding: 12px 24px;
        font-weight: 900;
        font-size: 11px;
        text-transform: uppercase;
        font-style: italic;
        border-bottom: 2px solid transparent;
        color: #666;
        transition: all 0.3s;
    }
    .cobrar-tab.active { border-bottom-color: #FF0000; color: #FF0000; }

    .notification-toast {
        position: fixed; bottom: 30px; right: 30px;
        background: #FF0000; color: black;
        padding: 20px 40px; border-radius: 20px;
        font-weight: 900; text-transform: uppercase; font-style: italic;
        z-index: 2000; transform: translateY(150%);
        transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: 0 10px 40px rgba(255, 0, 0, 0.4);
    }
    .notification-toast.show { transform: translateY(0); }

    .multi-select-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        background: rgba(255,255,255,0.05);
        padding: 15px;
        border-radius: 15px;
        max-height: 150px;
        overflow-y: auto;
    }
    .multi-option {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 10px;
        font-weight: 900;
        text-transform: uppercase;
        cursor: pointer;
        padding: 8px;
        border-radius: 8px;
        background: rgba(0,0,0,0.3);
        border: 1px solid rgba(255,255,255,0.05);
    }
    .multi-option input { display: none; }
    .multi-option:has(input:checked) {
        border-color: #FF0000;
        background: rgba(255,0,0,0.1);
        color: #FF0000;
    }

    .rutina-dia-card {
        background: rgba(255,255,255,0.02);
        border: 1px solid rgba(255,255,255,0.05);
        padding: 1.5rem;
        border-radius: 1.5rem;
        position: relative;
    }
    .exercise-grid {
        display: grid;
        grid-template-columns: 2.5fr 0.8fr 0.8fr 0.8fr 1fr 40px;
        gap: 12px;
        align-items: center;
    }

    .scanner-mask { box-shadow: 0 0 0 9999px rgb(0, 0, 0); }
    @keyframes scan-line {
        0% { top: 0%; opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { top: 100%; opacity: 0; }
    }
    .animate-scan-line { animation: scan-line 2.5s linear infinite; }

    #filtro-clases-sucursal option {
        background-color: #09090b; /* zinc-950 */
        color: white;
        padding: 10px;
    }

    /* =================================================================
    PARCHE DE ADAPTABILIDAD MOBILE (PRIORIDAD 2 - APP-STYLE)
    ================================================================= */
    @media (max-width: 1024px) {
        body {
            overflow-y: auto !important; 
            overflow-x: hidden !important; 
        }

        #sidebar {
            position: fixed;
            left: -100%; 
            top: 0;
            bottom: 0;
            z-index: 100;
            width: 280px !important;
            display: flex !important;
            transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }

        #sidebar.mobile-open {
            left: 0;
            box-shadow: 20px 0 50px rgba(0,0,0,0.9);
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.85);
            backdrop-filter: blur(4px);
            z-index: 90;
        }
        .sidebar-overlay.active { display: block; }

        main {
            margin-left: 0 !important;
            width: 100% !important;
            padding-bottom: 100px;
            overflow-x: hidden !important;
        }

        .view-content {
            width: 100% !important;
            padding: 0.75rem !important;
            overflow-x: hidden !important;
        }

        header {
            padding-left: 1rem !important; 
            padding-right: 1rem !important;
            height: 70px !important;
            justify-content: flex-start !important;
            gap: 12px;
        }

        .grid-cols-2, .grid-cols-3, .grid-cols-4, .exercise-grid {
            grid-template-columns: 1fr !important;
            gap: 0.75rem !important;
        }

        .viking-input, input, select, textarea {
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        .calendar-container {
            grid-template-columns: 1fr !important;
            height: auto !important;
            gap: 0 !important;
        }

        .cal-header {
            position: sticky;
            top: 69px; 
            z-index: 30;
            border-right: none !important;
            font-size: 11px !important;
            background: black !important;
            border-bottom: 6px solid #FF0000 !important;
        }

        .cal-cell {
            height: auto !important;
            min-height: 50px;
            border-right: none !important;
        }

        .class-badge {
            position: relative;
            height: auto !important;
            min-height: 60px;
            width: calc(100% - 12px);
            margin: 6px;
        }

        .viking-table-row {
            display: flex;
            flex-direction: column;
            padding: 1.25rem;
            margin-bottom: 0.75rem;
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 1.25rem;
            background: rgba(255,255,255,0.02);
            width: 100% !important;
            box-sizing: border-box;
        }

        .viking-modal > div {
            width: 95% !important;
            max-width: 95% !important;
            margin: 10px;
            border-radius: 2rem !important;
            padding: 1.5rem !important;
        }

        button, .nav-item, .filter-btn, .payment-method-btn {
            min-height: 40px !important; 
            padding-top: 0.4rem !important;
            padding-bottom: 0.4rem !important;
            font-size: 0.85rem !important;
            border-radius: 0.85rem !important;
        }

        .nav-item i {
            width: 18px !important;
            height: 18px !important;
        }

        .sidebar-collapsed { width: 0 !important; overflow: hidden; }

        .mobile-menu-trigger {
            display: flex !important;
            width: 44px;
            height: 44px;
            background: rgba(255, 0, 0, 0.1);
            border: 1px solid rgba(255, 0, 0, 0.25);
            border-radius: 12px;
            color: #FF0000;
            z-index: 50;
        }
        .mobile-menu-trigger i { width: 22px; height: 22px; }
    }

    @media (min-width: 1025px) {
        .mobile-menu-trigger { display: none !important; }
    }

    /* =================================================================
       MEJORA: MODO CLARO (LIGHT MODE) - SOLUCIÓN DEFINITIVA A CAJAS NEGRAS
       ================================================================= */
    body.light-mode {
        background-color: #f0f0f0;
        background-image: linear-gradient(rgba(245, 245, 245, 0.88), rgba(245, 245, 245, 0.88)), url('https://raw.githubusercontent.com/vikingo-44/Software-Gym/main/wallpaper.png') !important;
        color: #000000 !important;
    }

    /* MANTENEMOS EL TEXTO NEGRO, PERO CUIDANDO EXCEPCIONES */
    body.light-mode *:not(.viking-red):not(.filter-btn.active):not(.nav-item.active):not(.nav-item.active i):not(.class-badge):not(.class-badge *) {
        color: #000000 !important;
    }

    /* EXCEPCIONES DE COLOR */
    body.light-mode .viking-red, 
    body.light-mode .whatsapp-float,
    body.light-mode .whatsapp-float i,
    body.light-mode .metodo-chip.active,
    body.light-mode .payment-method-btn.active,
    body.light-mode .nav-item:hover,
    body.light-mode .nav-item:hover i,
    body.light-mode .nav-item.active,
    body.light-mode .nav-item.active i,
    body.light-mode .filter-btn.active,
    body.light-mode .cobrar-tab.active {
        color: #FF0000 !important;
    }
    
    body.light-mode .class-badge,
    body.light-mode .class-badge *,
    body.light-mode .filter-btn.active,
    body.light-mode .whatsapp-float i {
        color: #ffffff !important; 
    }

    /* MARTILLO DEFINITIVO PARA CAJAS NEGRAS (WIZARD, TARJETAS, MODALES) */
    body.light-mode #rutina-editor-body,
    body.light-mode .rutina-dia-card,
    body.light-mode .viking-modal > div,
    body.light-mode [class*="bg-zinc-"], 
    body.light-mode [class*="bg-black"], 
    body.light-mode [class*="bg-neutral-"],
    body.light-mode [class*="bg-white/5"] {
        background-color: #ffffff !important;
        border: 1px solid #cccccc !important;
        color: #000000 !important;
    }

    /* FILTROS Y SELECTS */
    body.light-mode select,
    body.light-mode select option,
    body.light-mode #filtro-clases-sucursal,
    body.light-mode #filtro-clases-sucursal option {
        background-color: #ffffff !important;
        color: #000000 !important;
        border: 1px solid rgba(0,0,0,0.2) !important;
    }

    body.light-mode .filter-btn {
        background: rgba(0, 0, 0, 0.05) !important;
        border: 1px solid rgba(0, 0, 0, 0.2) !important;
        color: #444444 !important;
    }
    body.light-mode .filter-btn.active {
        background: #FF0000 !important;
        border-color: #FF0000 !important;
        color: #ffffff !important;
    }

    /* CALENDARIO */
    body.light-mode .calendar-container { 
        background: #ffffff !important; 
        border: 1px solid #ddd !important; 
    }
    body.light-mode .cal-header { 
        background: #f8f8f8 !important; 
        border-right: 1px solid #ddd !important; 
        border-bottom: 3px solid #FF0000 !important; 
        color: #000000 !important; 
    }
    body.light-mode .cal-cell {
         border-right: 1px solid #eee !important;
         border-bottom: 1px solid #eee !important; 
         background: #ffffff !important; 
    }

    /* INPUTS */
    body.light-mode .viking-input,
    body.light-mode input[type="text"],
    body.light-mode input[type="date"],
    body.light-mode textarea {
        background-color: #ffffff !important;
        border: 1px solid #cccccc !important;
        color: #000000 !important;
    }

    /* ESTRUCTURA */
    body.light-mode .glass-sidebar { 
        background: rgba(240, 240, 240, 0.95) !important; 
        border-right: 1px solid #cccccc !important; 
    }
    body.light-mode .glass-card { 
        background: rgba(255, 255, 255, 0.85) !important; 
        border: 1px solid #cccccc !important; 
    }
    body.light-mode .viking-table-row { 
        border-bottom: 1px solid #cccccc !important; 
        background: #ffffff !important; 
    }
    body.light-mode .viking-table-row:hover { 
        background: #f0f0f0 !important; 
    }

    /* BOTONES */
    body.light-mode .glass-card button { 
        background: #f4f4f4 !important; 
        border: 1px solid #cccccc !important; 
        color: #000000 !important; 
    }
    body.light-mode .glass-card button:hover { 
        background: #e5e5e5 !important; 
        color: #FF0000 !important; 
        border-color: #FF0000 !important; 
    }

    /* =================================================================
       AJUSTE ESPECÍFICO PARA MODAL ALUMNOS (LIGHT MODE)
       ================================================================= */
    body.light-mode #modal-alumno .glass-card {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        color: #000000 !important;
    }

    body.light-mode #modal-alumno h3,
    body.light-mode #modal-alumno p,
    body.light-mode #modal-alumno span {
        color: #000000 !important;
    }

    /* Ajuste para el fondo interno del formulario */
    body.light-mode #modal-alumno .bg-zinc-950\/50,
    body.light-mode #modal-alumno .bg-zinc-900 {
        background-color: #f9f9f9 !important;
        border: 1px solid #eeeeee !important;
    }

    /* Ajuste para los botones de las pestañas */
    body.light-mode #modal-alumno .alumno-tab-btn {
        color: #999999 !important; /* Color gris para pestañas inactivas */
    }
    body.light-mode #modal-alumno .alumno-tab-btn.border-red-600 {
        color: #FF0000 !important; /* Color rojo para pestaña activa */
        border-color: #FF0000 !important;
    }

    /* AJUSTE FINO DE PESTAÑAS (TABS) */
    .alumno-tab-btn {
        padding: 12px 20px !important;
        border-radius: 16px !important;
        transition: all 0.3s ease !important;
        background: transparent !important;
        border: 1px solid transparent !important;
    }

    /* Estado Inactivo */
    .alumno-tab-btn.opacity-50 {
        background: rgba(128, 128, 128, 0.1) !important;
        color: #666666 !important;
    }

    /* Estado Activo */
    .alumno-tab-btn.opacity-100 {
        background: rgba(255, 0, 0, 0.1) !important;
        border: 1px solid rgba(255, 0, 0, 0.3) !important;
        color: #FF0000 !important;
    }