/* =========================================
   NEXUSCART DESIGN SYSTEM (Modo Quirúrgico)
   ========================================= */

:root {
    /* Paleta Nexus Modernizada */
    --primary: #0f172a;       /* Slate 900 (Textos oscuros, fondos oscuros) */
    --accent: #0ea5e9;        /* Sky 500 (El color "Nexus" principal) */
    --accent-dark: #0284c7;   /* Sky 600 (Hover) */
    
    --bg: #f8fafc;            /* Slate 50 (Fondo general) */
    --surface: #ffffff;       /* Blanco puro (Tarjetas) */
    
    --text: #334155;          /* Slate 700 */
    --text-light: #64748b;    /* Slate 500 */
    --border: #e2e8f0;        /* Slate 200 */
    
    --radius: 12px;           /* Radio moderno estándar */
    --radius-sm: 8px;
    
    /* Sombras Elevadas (Glass/Modern) */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --focus-ring: 0 0 0 3px rgba(14, 165, 233, 0.3); /* Anillo Sky Blue */
}

/* RESET & BASICS */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    padding-top: 80px; 
    padding-bottom: 80px; 
    min-height: 100vh; 
    font-size: 15px;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background 0.3s ease;
}

/* UTILIDADES */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* OVERLAY & BACKGROUNDS */
#bg-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.5); /* Más suave para el modo claro */
    backdrop-filter: blur(2px); /* Efecto sutil */
    z-index: -1; pointer-events: none;
}

/* TOP BAR */
.top-bar {
    position: fixed; top: 0; left: 0; width: 100%;
    background: var(--primary); color: white;
    text-align: center; padding: 8px 15px;
    font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em;
    z-index: 110; display: none;
}

/* HEADER GLASSMORPHISM */
.header { 
    position: fixed; top: 0; left: 0; width: 100%; height: 72px; 
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); 
    border-bottom: 1px solid rgba(226, 232, 240, 0.8); z-index: 100; 
    display: flex; align-items: center; transition: top 0.3s; 
}
.container { width: 92%; max-width: 1100px; margin: 0 auto; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); }
.logo img { height: 42px; object-fit: contain; }
.logo-text { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.4rem; letter-spacing: -0.5px; display: flex; align-items: center; gap: 5px; }

/* CART TRIGGER BUTTON */
.cart-trigger { 
    position: relative; background: var(--surface); border: 1px solid var(--border); 
    width: 44px; height: 44px; border-radius: 12px; 
    display: flex; align-items: center; justify-content: center; 
    color: var(--primary); box-shadow: var(--shadow-sm); 
    cursor: pointer; transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
}
.cart-trigger:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); color: var(--accent); }
.badge { 
    position: absolute; top: -6px; right: -6px; 
    background: var(--accent); color: white; 
    min-width: 20px; height: 20px; padding: 0 6px; 
    border-radius: 20px; font-size: 11px; font-weight: 700; 
    display: flex; align-items: center; justify-content: center; 
    border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

/* NAVIGATION PILLS */
.category-nav { 
    position: sticky; top: 72px; z-index: 90; 
    background: rgba(248, 250, 252, 0.95); backdrop-filter: blur(8px); 
    padding: 12px 0; border-bottom: 1px solid var(--border); 
    margin-bottom: 1.5rem; overflow-x: auto; white-space: nowrap; 
    -webkit-overflow-scrolling: touch; display: none; transition: top 0.3s; 
}
.category-nav::-webkit-scrollbar { height: 0px; background: transparent; }

.cat-pill { 
    display: inline-block; padding: 8px 18px; margin-right: 8px; 
    background: white; border: 1px solid var(--border); 
    border-radius: 50px; color: var(--text); 
    font-weight: 600; font-size: 0.9rem; cursor: pointer; 
    transition: all 0.2s ease; user-select: none; 
}
.cat-pill:hover { background: #f1f5f9; border-color: #cbd5e1; }
.cat-pill.active { 
    background: var(--accent); color: white; 
    border-color: var(--accent); 
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25); 
    transform: scale(1.02); 
}

/* SEARCH BAR */
.search-container { position: relative; margin-bottom: 25px; }
.search-input { 
    width: 100%; padding: 16px 16px 16px 48px; 
    border: 1px solid var(--border); border-radius: var(--radius); 
    background: white; font-size: 1rem; color: var(--primary); 
    transition: 0.2s; box-shadow: var(--shadow-sm); outline: none; 
}
.search-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 1.1rem; pointer-events: none; }

/* HERO SECTION */
.hero { 
    position: relative; height: 260px; border-radius: var(--radius); 
    overflow: hidden; margin-bottom: 2.5rem; 
    background: var(--primary); color: white; 
    display: flex; align-items: flex-end; padding: 2rem; 
    box-shadow: var(--shadow-md); 
}
.hero-bg { position: absolute; top:0; left:0; width:100%; height:100%; background-size: cover; background-position: center; opacity: 0.6; transition: 0.5s; mix-blend-mode: overlay; }
.hero-content { position: relative; z-index: 1; max-width: 600px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.hero h1 { font-family: 'Outfit'; font-weight: 800; font-size: 2.4rem; line-height: 1.1; margin-bottom: 0.5rem; letter-spacing: -1px; display: flex; align-items: center; gap: 10px; }

/* GRID & CARDS */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 1.2rem; }
@media(min-width: 768px) { .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2rem; } }

.skeleton { background: #e2e8f0; border-radius: var(--radius); position: relative; overflow: hidden; aspect-ratio: 3/4; }
.skeleton::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%); background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.4) 20%, rgba(255, 255, 255, 0.7) 60%, rgba(255, 255, 255, 0)); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

.card-pro { 
    position: relative; background: white; border-radius: var(--radius); 
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    overflow: hidden; display: flex; flex-direction: column; height: 100%; 
}
.card-pro:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--accent); }

.img-wrapper { aspect-ratio: 1/1; position: relative; background: #f1f5f9; overflow: hidden; }
.img-wrapper img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.card-pro:hover .img-wrapper img { transform: scale(1.08); }

.btn-add-float { 
    position: absolute; bottom: 12px; right: 12px; 
    width: 42px; height: 42px; border-radius: 12px; /* Cuadrado redondeado moderno */
    background: white; color: var(--primary); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    display: flex; align-items: center; justify-content: center; 
    font-size: 1.1rem; border: none; cursor: pointer; 
    transition: 0.2s; z-index: 20; opacity: 1; 
}
.btn-add-float:hover { background: var(--accent); color: white; transform: scale(1.05); box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4); }
.click-anim { animation: clickBounce 0.3s ease; }
@keyframes clickBounce { 0% { transform: scale(1); } 50% { transform: scale(0.85); } 100% { transform: scale(1); } }

.info { padding: 1.25rem; flex-grow: 1; display: flex; flex-direction: column; }
.info h3 { font-family: 'Outfit'; font-size: 1.1rem; margin-bottom: 6px; font-weight: 700; color: var(--primary); line-height: 1.35; }
.price { font-size: 1.3rem; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }

/* INPUTS EN PRODUCTOS (SELECT) */
.info select.input { background-image: none; font-size: 0.85rem; border-color: var(--border); }

/* CART SIDEBAR */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal.open { opacity: 1; pointer-events: auto; }

.sidebar { 
    position: absolute; right: 0; top: 0; width: 100%; max-width: 450px; height: 100vh; 
    background: white; transform: translateX(100%); transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); 
    display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,0.15); z-index: 3000; 
}
.modal.open .sidebar { transform: translateX(0); }

.cart-header { padding: 25px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background: #fff; }
.cart-header h3 { font-family: 'Outfit'; font-size: 1.6rem; font-weight: 800; margin: 0; color: var(--primary); }

.cart-items { flex: 1; overflow-y: auto; padding: 25px; min-height: 0; background: #fcfcfc; }

.cart-item { 
    display: flex; gap: 15px; margin-bottom: 15px; padding: 15px; 
    border: 1px solid var(--border); border-radius: var(--radius); 
    align-items: center; background: white; transition: 0.2s; box-shadow: var(--shadow-sm);
}
.cart-item:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.cart-item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }

.cart-footer { padding: 25px; background: white; border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(0,0,0,0.05); flex-shrink: 0; max-height: 65vh; overflow-y: auto; }

/* FORMS */
.form-section { margin-bottom: 20px; }
.form-label { font-size: 0.75rem; font-weight: 700; color: var(--text-light); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: 0.05em; }

.input-group { display: grid; gap: 12px; }
.input { 
    width: 100%; padding: 14px 16px; border: 1px solid var(--border); 
    border-radius: 10px; background: #f8fafc; font-size: 0.95rem; 
    color: var(--primary); transition: 0.2s; outline: none; 
}
.input:focus { background: white; border-color: var(--accent); box-shadow: var(--focus-ring); }

/* SHIPPING OPTIONS */
.shipping-grid { display: grid; gap: 10px; }
.shipping-opt { 
    cursor: pointer; border: 2px solid var(--border); padding: 14px; 
    border-radius: var(--radius); display: flex; align-items: center; 
    justify-content: space-between; transition: 0.2s; background: white; 
}
.shipping-opt:hover { border-color: #cbd5e1; background: #f8fafc; }
.shipping-opt.selected { border-color: var(--accent); background: #f0f9ff; box-shadow: 0 0 0 1px var(--accent); }
.ship-icon { width: 36px; height: 36px; background: #e0f2fe; color: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-right: 12px; }

.expandable { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease; opacity: 0; }
.expandable.show { max-height: 300px; opacity: 1; margin-top: 12px; }

/* CHECKOUT BUTTONS */
.total-row { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.5rem; margin: 20px 0; color: var(--primary); letter-spacing: -0.5px; }
.btn-wpp { 
    width: 100%; background: #10b981; color: white; border: none; 
    padding: 16px; border-radius: 50px; font-weight: 700; font-size: 1.05rem; 
    display: flex; justify-content: center; align-items: center; gap: 10px; 
    cursor: pointer; transition: 0.3s; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); 
}
.btn-wpp:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4); filter: brightness(1.05); }
.btn-wpp:active { transform: scale(0.98); }

/* LANDING & EXTRA */
#landing { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; overflow-y: auto; 
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); 
    color: white; z-index: 5000; padding: 0; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; 
}
.land-btn { 
    background: var(--accent); color: white; padding: 16px 40px; 
    border-radius: 50px; text-decoration: none; font-weight: 700; 
    font-size: 1.2rem; transition:0.3s; box-shadow: 0 0 30px rgba(14, 165, 233, 0.4); 
}
.land-btn:hover { transform: scale(1.05); box-shadow: 0 0 50px rgba(14, 165, 233, 0.6); }

/* TOAST */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast { 
    background: white; color: var(--primary); padding: 14px 24px; 
    border-radius: 12px; box-shadow: var(--shadow-lg); 
    border-left: 5px solid var(--accent); font-weight: 600; 
    animation: slideIn 0.3s forwards; display: flex; align-items: center; gap: 10px; 
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* STICKY CART BAR */
.sticky-cart-bar { 
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); 
    width: 92%; max-width: 450px; background: var(--primary); 
    color: white; padding: 16px 24px; border-radius: 50px; 
    display: flex; justify-content: space-between; align-items: center; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 1900; 
    cursor: pointer; transition: 0.3s; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
    border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px);
}
.sticky-cart-bar:active { transform: translateX(-50%) scale(0.98); }
@keyframes slideUp { from { transform: translate(-50%, 100%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* WHATSAPP FLOAT */
.wpp-float { 
    position:fixed; bottom:20px; right:20px; background:#25D366; 
    color:white; width:60px; height:60px; border-radius:50%; 
    display:flex; align-items:center; justify-content:center; 
    font-size:30px; box-shadow:0 4px 15px rgba(0,0,0,0.3); 
    z-index:2000; transition:0.3s; text-decoration:none; 
}
.wpp-float:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5); }

/* =========================================
   MODO APP NATIVA (SOLO MÓVIL)
   Transformación a Bottom Sheets
   ========================================= */

@media (max-width: 768px) {

    /* 1. TRANSFORMACIÓN DEL CARRITO (SIDEBAR -> BOTTOM SHEET) */
    .sidebar {
        top: auto !important;     /* Ya no arriba */
        bottom: 0 !important;     /* Pegado abajo */
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 85vh !important;  /* Ocupa el 85% de la altura (deja ver fondo) */
        
        /* Estética App */
        border-radius: 20px 20px 0 0; /* Bordes redondos solo arriba */
        transform: translateY(100%);  /* Escondido abajo */
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); /* Animación suave iOS */
    }

    /* Override para mostrarlo */
    .modal.open .sidebar {
        transform: translateY(0) !important;
    }

    /* Agregamos la "Barrita" (Handle) visual para que parezca arrastrable */
    .sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        background: #e2e8f0;
        margin: 10px auto 5px auto; /* Centrado arriba */
        border-radius: 10px;
    }

    /* Ajuste del Header del Carrito para que no choque con la barrita */
    .cart-header {
        padding-top: 5px; 
        border-bottom: none; /* Más limpio */
    }

    /* 2. TRANSFORMACIÓN DE MODALES DE INFO (CENTER -> BOTTOM SHEET) */
    .info-modal {
        align-items: flex-end; /* Alinear al fondo en vez del centro */
        padding: 0;
    }

    .info-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0; /* Look App */
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        padding-bottom: 40px; /* Espacio extra abajo para iPhones modernos */
    }

    .info-modal.open .info-content {
        transform: translateY(0);
    }
    
    /* Barrita Handle también para los modales de info */
    .info-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        background: #e2e8f0;
        margin: -10px auto 15px auto; /* Posición ajustada */
        border-radius: 10px;
    }
    
    /* 3. AJUSTE DEL BOTÓN CERRAR (X) */
    /* Lo hacemos más grande y táctil */
    .cart-header button, .close-info {
        background: #f1f5f9 !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
    }
}
