/* ========================================================= */
/* ===   1. SISTEMA DE DISEÑO (VARIABLES GLOBALES)       === */
/* ========================================================= */

:root {
    --bg-body: #0f1115;       /* Fondo Principal */
    --bg-surface: #181b21;    /* Fondo de Tarjetas/Modales */
    --bg-element: #232730;    /* Fondo de Inputs/Botones secundarios */
    --primary: #FF0000;       /* Azul Vibrante (Acción) */
    --primary-hover: #8b0000;
    --accent: #10b981;        /* Esmeralda (Dinero/Éxito) */
    --accent-hover: #059669;
    --danger: #ef4444;        /* Rojo (Error/Logout) */
    --text-main: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}
/* ========================================================= */
/* ===   2. RESET Y BASES                                === */
/* ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.floating-particles { display: none; }
[x-cloak] { display: none !important; }
/* ========================================================= */
/* ===   3. HEADER GENERAL                               === */
/* ========================================================= */

.header {
    background-color: rgba(15, 17, 21, 0.95);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    text-transform: uppercase;
}
.logo span { color: rgb(255, 0, 0); }

/* ========================================================= */
/* ===   4. HEADER DESKTOP (Pantallas Grandes > 900px)   === */
/* ========================================================= */
@media (min-width: 901px) {
    .mobile-view { display: none; } /* Ocultar móvil */
    .desktop-view {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 70px;
        width: 100%;
    }
    .desktop-menu {
        display: flex;
        align-items: center;
        gap: 20px;
    }
    .nav-links { display: flex; gap: 20px; }
    .nav-link {
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.9rem;
        transition: color 0.2s;
        font-weight: 500;
    }
    .nav-link:hover { color: white; }
    .nav-link.highlight { color: var(--primary); }
    .divider {
        width: 1px; height: 25px;
        background-color: rgba(255, 255, 255, 0.1);
    }
    .user-identity {
        display: flex;
        align-items: center;
        gap: 15px;
        background: rgba(255, 255, 255, 0.03);
        padding: 6px 12px;
        border-radius: 30px;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    .user-details {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        line-height: 1.2;
    }
    .greeting { font-size: 0.8rem; color: #aaa; }
    .greeting b { color: white; }
    .balance-pill {
        font-size: 0.85rem;
        color: var(--accent);
        font-weight: 700;
    }
    .btn-logout-icon {
        color: var(--text-muted);
        transition: color 0.2s;
        display: flex;
        padding: 5px;
    }
    .btn-logout-icon:hover { color: var(--danger); transform: scale(1.1); }
    .login-form-desktop { 
        display: flex; 
        gap: 10px; 
        align-items: center;
    }
    .login-form-desktop input {
        background: var(--bg-element);
        border: 1px solid var(--border-color);
        color: white;
        padding: 10px 15px;
        border-radius: var(--radius-sm);
        font-size: 0.9rem;
        outline: none;
        transition: border-color 0.3s, background-color 0.3s;
        width: 200px;
    }
    .login-form-desktop input:focus {
        border-color: var(--primary);
        background-color: #2a2f3a;
    }
    .login-form-desktop input::placeholder { color: var(--text-muted); }
}
/* ========================================================= */
/* ===   5. HEADER MÓVIL (Pantallas Pequeñas <= 900px)   === */
/* ========================================================= */

@media (max-width: 900px) {
    .desktop-view { display: none; } 
    .header-content { padding: 0; }
    .mobile-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.8rem 1.5rem;
        background: rgba(15, 17, 21, 0.98);
        position: relative;
        z-index: 50;
    }
    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    .mobile-balance {
        background: rgba(16, 185, 129, 0.15);
        color: #10b981;
        border: 1px solid rgba(16, 185, 129, 0.3);
        padding: 5px 12px;
        border-radius: 20px;
        font-weight: 800;
        font-size: 0.9rem;
    }

    .menu-toggle {
        background: none; border: none;
        color: white; cursor: pointer;
    }

    /* Dropdown Menú */
    .mobile-dropdown {
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }
    
    .mobile-dropdown.is-open {
        max-height: 400px;
        padding-bottom: 20px;
    }

    .mobile-menu-content {
        display: flex;
        flex-direction: column;
        padding: 0 1.5rem;
    }

    .user-greeting-mobile {
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        margin-bottom: 10px;
        color: var(--text-secondary);
        text-align: center;
    }

    .mobile-link {
        padding: 12px 0;
        color: white;
        text-decoration: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        font-size: 1rem;
    }
    .mobile-link.highlight { color: var(--primary); font-weight: bold; }
    .mobile-link.logout { color: var(--danger); border-bottom: none; margin-top: 10px; }
    /* Login Móvil */
    .mobile-login-container { padding: 20px; }
    .mobile-login-form { display: flex; flex-direction: column; gap: 10px; }
    .mobile-login-form input {
        background: var(--bg-element);
        border: 1px solid var(--border-color);
        color: white;
        padding: 10px;
        border-radius: var(--radius-sm);
    }
    .full-width { width: 100%; }
}
/* ========================================================= */
/* ===   6. CARRUSEL Y LAYOUT                            === */
/* ========================================================= */
.carousel-container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.carousel-wrapper {
    width: 100%;
    aspect-ratio: 21 / 9;
    border-radius: 15px;
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
}
.carousel-slide, .carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}
.carousel-slide { display: none; }
.carousel-slide.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.tienda-container {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
}

.tienda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.tienda-header h2 { font-size: 1.5rem; font-weight: 700; }
.epic-filter-container { display: flex; align-items: center; gap: 12px; }
.filter-text { font-size: 0.9rem; color: var(--text-muted); }
.filter-text.active { color: var(--primary); font-weight: 600; }

.epic-filter { position: relative; width: 50px; height: 26px; }
.toggle-label {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-element);
    border-radius: 30px; cursor: pointer;
    transition: 0.3s; border: 1px solid var(--border-color);
}
.toggle-ball {
    position: absolute; height: 20px; width: 20px;
    left: 3px; bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%; transition: 0.3s;
}
.toggle-checkbox:checked + .toggle-label { background-color: var(--primary); border-color: var(--primary); }
.toggle-checkbox:checked + .toggle-label .toggle-ball { transform: translateX(24px); background-color: white; }
.available-icon, .unavailable-icon, .toggle-ball-pulse, .toggle-ball-glow { display: none; }

/* ========================================================= */
/* ===   7. GRILLA DE PRODUCTOS                          === */
/* ========================================================= */

.productos-container {
    display: grid;
    /* Mínimo 155px para que entren 2 en móviles */
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 1.5rem;
}
@media (min-width: 1100px) {
    .productos-container {
        /* Aquí forzamos exactamente 4 columnas */
        grid-template-columns: repeat(4, 1fr);
    }
}
.producto-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.producto-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* Banner Producto */
.producto-banner {
    background-color: #0a0a0a;
    aspect-ratio: 16 / 9;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.producto-banner img {
    width: 100%; height: 100%;
    object-fit: contain; /* IMPORTANTE: No recortar */
    object-position: center;
    transition: transform 0.5s ease;
}
.producto-item:hover .producto-banner img { transform: scale(1.05); }

/* Badges y Etiquetas */
.producto-stock {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.7); color: var(--accent);
    padding: 4px 8px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; backdrop-filter: blur(4px);
}
.producto-stock.agotado { color: var(--danger); }
.promo-tag {
    position: absolute; bottom: 10px; left: 10px;
    background: var(--primary); color: white;
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}

/* Info Producto */
.producto-content {
    padding: 1rem; display: flex; flex-direction: column; flex-grow: 1;
}
.producto-titulo {
    font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem;
    line-height: 1.4; height: 2.8em;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Badges Entrega */
.producto-badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.badge-entrega {
    font-size: 0.7rem; font-weight: 700; padding: 4px 8px;
    border-radius: 4px; display: inline-flex; align-items: center; gap: 5px;
}
.badge-auto {
    background: rgba(16, 185, 129, 0.15); color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-pedido {
    background: rgba(245, 158, 11, 0.15); color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-icon { width: 12px; height: 12px; fill: currentColor; }

/* Precios */
.precio-renovacion {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: var(--text-secondary);
    margin-top: auto; padding-top: 10px;
}
.precio-compra {
   margin-top: auto; text-align: center;
    background: var(--bg-element); padding: 8px;
    border-radius: var(--radius-sm);
}
.precio-valor-principal { font-size: 1.25rem; font-weight: 700; }
.precio-promo { color: var(--accent); }

/* ========================================================= */
/* ===   8. MODALES Y FORMULARIOS                        === */
/* ========================================================= */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}

.modal-content {
    background: var(--bg-surface); width: 90%; max-width: 420px;
    padding: 2rem; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); position: relative;
}

.modal-close {
    position: absolute; top: 15px; right: 15px;
    background: none; border: none;
    color: var(--text-secondary); font-size: 1.5rem; cursor: pointer;
}

.modal-content input:not([type="checkbox"]), .modal-content select {
    width: 100%; padding: 12px 16px; margin-bottom: 1rem;
    background: var(--bg-element); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: white;
    font-size: 1rem; outline: none;
}
.modal-content input:focus { border-color: var(--primary); }

.phone-input-group { display: flex !important; gap: 10px; margin-bottom: 1rem; }
.phone-input-group select { width: 110px !important; margin-bottom: 0 !important; }
.phone-input-group input { flex-grow: 1; margin-bottom: 0 !important; }

/* Botones Generales */
.btn-ingresar {
    background: transparent; border: 1px solid var(--primary); color: var(--primary);
    padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600;
}
.btn-ingresar:hover { background: rgba(59, 130, 246, 0.1); }

.btn-registro, .btn-confirmar-registro {
    background: var(--primary); color: white;
    padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600;
}
.btn-registro:hover, .btn-confirmar-registro:hover { background: var(--primary-hover); }

.btn-confirmar-registro { width: 100%; padding: 12px; margin-top: 10px; }

/* Botones Pago */
.metodos-botones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.btn-metodo-pago {
    background: var(--bg-element); border: 1px solid var(--border-color);
    color: var(--text-secondary); padding: 8px 16px; border-radius: var(--radius-sm);
}
.btn-metodo-pago.active { background: rgba(59, 130, 246, 0.15); border-color: var(--primary); color: var(--primary); }

/* ========================================================= */
/* ===   9. FOOTER Y AJUSTES RESPONSIVOS EXTRA           === */
/* ========================================================= */

.footer {
    text-align: center; padding: 2rem;
    color: var(--text-muted); font-size: 0.9rem;
    border-top: 1px solid var(--border-color); margin-top: auto;
}

/* Centrado de filtros en móviles */
@media (max-width: 768px) {
    .tienda-header {
        flex-direction: column; align-items: center; text-align: center; gap: 15px;
    }
    .epic-filter-container, .epic-filter-label {
        justify-content: center; width: 100%;
    }
    .epic-filter-label { margin-bottom: 5px; display: flex; gap: 10px; }
    
    .carousel-container { padding: 0 1rem; margin: 1.5rem auto !important; }
    .carousel-wrapper { aspect-ratio: 16 / 9; }
    
    .productos-container { gap: 1rem; }
}

@media (max-width: 600px) {
    .producto-titulo { font-size: 0.9rem; }
    .precio-valor-principal { font-size: 1.1rem; }
    .badge-entrega { font-size: 0.6rem; padding: 2px 4px; }
}
/* ========================================================= */
/* ===   10. PERSONALIZACIÓN SWEETALERT2 (DARK THEME)    === */
/* ========================================================= */


div:where(.swal2-container) div:where(.swal2-popup) {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main) !important;
}

div:where(.swal2-container) h2:where(.swal2-title) {
    color: var(--text-main) !important;
    font-family: 'Inter', sans-serif;
}

div:where(.swal2-container) div:where(.swal2-html-container) {
    color: var(--text-secondary) !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm {
    background-color: var(--primary) !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5) !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel,
div:where(.swal2-container) button:where(.swal2-styled).swal2-deny {
    background-color: var(--bg-element) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
}
div:where(.swal2-icon).swal2-success { border-color: var(--accent) !important; color: var(--accent) !important; }
div:where(.swal2-icon).swal2-success [class^='swal2-success-line'] { background-color: var(--accent) !important; }
div:where(.swal2-icon).swal2-success .swal2-success-ring { border: 4px solid rgba(16, 185, 129, 0.3) !important; }

div:where(.swal2-icon).swal2-error { border-color: var(--danger) !important; color: var(--danger) !important; }
div:where(.swal2-icon).swal2-error [class^='swal2-x-mark-line'] { background-color: var(--danger) !important; }

div:where(.swal2-icon).swal2-warning { border-color: #f59e0b !important; color: #f59e0b !important; }

.tabs-container {
    display: flex;
    background: #0f1115;
    padding: 5px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--bg-element);
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 20px;
}

.monto-input-lg {
    font-size: 1.5rem !important;
    text-align: center;
    padding: 15px !important;
    font-weight: bold;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.btn-primary-lg {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}
.btn-primary-lg:hover { background: var(--primary-hover); }

.secure-text {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    margin-top: 10px;
}
.bancos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.btn-banco {
    background: var(--bg-element);
    border: 1px solid var(--border-color);
    color: #ccc;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-banco:hover { border-color: white; }
.btn-banco.active {
    background: white;
    color: black;
    border-color: white;
    font-weight: bold;
}

.datos-banco-box {
    background: #252a33;
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed #555;
    margin-bottom: 15px;
}

.qr-img {
    max-width: 150px;
    display: block;
    margin: 0 auto 15px;
    border-radius: 8px;
}

.dato-fila {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 5px 0;
    font-size: 0.9rem;
}
.dato-label { color: #aaa; }
.dato-valor { color: white; font-family: monospace; }

.btn-whatsapp {
    width: 100%;
    background: #25D366;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}
.btn-whatsapp:hover { background: #1ebc57; }
/* ========================================================= */
/* ===   MODO STREAM (CTRL + Q) Y AUTO-ENFOQUE           === */
/* ========================================================= */
body.stream-mode-active .header,
body.stream-mode-active .carousel-container,
body.stream-mode-active .tienda-header,
body.stream-mode-active .footer {
    filter: blur(8px);
    opacity: 0.3;
    transition: all 0.4s ease;
    pointer-events: none; 
}
body.stream-mode-active .productos-container .producto-item {
    filter: blur(12px) grayscale(60%);
    opacity: 0.4;
    transform: scale(0.95);
    transition: all 0.3s ease;
}
body.stream-mode-active .productos-container .producto-item:hover {
    filter: blur(0) grayscale(0%);
    opacity: 1;
    transform: scale(1.10);
    z-index: 50; 
    box-shadow: 0 15px 35px rgba(255, 0, 0, 0.5); 
    border-color: var(--primary);
    cursor: pointer;
}
.header, .carousel-container, .tienda-header, .footer, .producto-item {
    transition: all 0.4s ease;
}
