/* =========================================
   WIDGET CARRITO PREMIUM APP LOOK (ULTRA UI)
   ========================================= */

.premium-cart-dropdown {
    position: absolute;
    top: calc(100% + 20px);
    right: 0;
    width: 380px;
    /* Cristalizado Apple: Más transparente, pero con mayor saturación y desenfoque */
    background: #fff !important;
    backdrop-filter: blur(32px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(32px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 32px !important;
    box-shadow: 
        0 40px 80px -15px rgba(0,0,0,0.12), 
        0 10px 25px -5px rgba(0,0,0,0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6) !important; /* Brillo interno */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: top right;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    box-sizing: border-box;
}

.premium-cart-dropdown.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Soporte para Modo Oscuro (Efecto Neón/Glow) */
html[data-theme="dark"] .premium-cart-dropdown {
    background: rgb(15 23 42) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 
        0 40px 100px -15px rgba(0,0,0,0.8), 
        0 10px 30px -5px rgba(0,0,0,0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

/* =========================================
   ANIMACIÓN HÁPTICA / VIBRACIÓN (Botón Header)
   ========================================= */
@keyframes addCartVibrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    15% { transform: scale(1.1) rotate(-8deg); background: var(--color-primary); box-shadow: 0 15px 25px rgba(14, 165, 233, 0.5); }
    30% { transform: scale(1.1) rotate(8deg); }
    45% { transform: scale(1.1) rotate(-6deg); }
    60% { transform: scale(1.1) rotate(6deg); }
    75% { transform: scale(1.1) rotate(-3deg); }
    85% { transform: scale(1.1) rotate(3deg); background: var(--color-primary); }
}

.cart-widget.is-animating {
    animation: addCartVibrate 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.cart-widget.is-animating .cart-label, 
.cart-widget.is-animating .icon-cart,
.cart-widget.is-animating .cart-count {
    color: #ffffff !important;
}

/* Cabecera del Dropdown */
.premium-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background: transparent;
}
html[data-theme="dark"] .premium-cart-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Título con Gradiente Moderno */
.premium-cart-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary, #0ea5e9) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
html[data-theme="dark"] .premium-cart-header h3 {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.close-cart {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--header-text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.close-cart:hover {
    background: #fecaca;
    color: #ef4444;
    transform: rotate(90deg) scale(1.1);
}
html[data-theme="dark"] .close-cart { 
    background: rgba(255, 255, 255, 0.05); 
    color: #94a3b8;
}
html[data-theme="dark"] .close-cart:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Cuerpo y Lista de Productos */
.premium-cart-body {
    max-height: 42vh;
    overflow-y: auto;
    padding: 10px 16px;
}
.premium-cart-body::-webkit-scrollbar { width: 4px; }
.premium-cart-body::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 10px; }

.premium-cart-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.premium-cart-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.premium-cart-item:hover { 
    background: rgba(0, 0, 0, 0.02); 
    transform: translateX(4px); 
    border-color: rgba(0, 0, 0, 0.03);
}
html[data-theme="dark"] .premium-cart-item:hover { 
    background: rgba(255, 255, 255, 0.03); 
    border-color: rgba(255, 255, 255, 0.05);
}

/* Imágenes con sombras suaves */
.item-img img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1);
    border: 1px solid rgba(0, 0, 0, 0.04);
    background: #fff; /* Fondo blanco forzado para PNGs transparentes */
}
html[data-theme="dark"] .item-img img {
    border-color: rgba(255, 255, 255, 0.1);
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--header-text-main);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.premium-cart-item:hover .item-name {
    color: var(--color-primary, #0ea5e9);
}
html[data-theme="dark"] .premium-cart-item:hover .item-name {
    color: #38bdf8;
}

.item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.item-qty {
    font-size: 11px;
    color: var(--header-text-main);
    font-weight: 800;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
}
html[data-theme="dark"] .item-qty { 
    background: rgba(255, 255, 255, 0.1); 
    color: #e2e8f0;
}
.item-price {
    font-size: 16px;
    font-weight: 900;
    color: var(--color-primary);
}
html[data-theme="dark"] .item-price {
    color: #38bdf8;
    text-shadow: 0 2px 10px rgba(56, 189, 248, 0.3); /* Resplandor neón en precio */
}

/* Estado Vacío Animado */
@keyframes floatEmpty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.premium-cart-empty {
    text-align: center;
    padding: 50px 0;
    color: var(--header-text-muted);
}
.empty-icon {
    font-size: 54px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.8;
    animation: floatEmpty 3s ease-in-out infinite;
}

/* Footer y Totales */
.premium-cart-footer {
    padding: 24px 28px 36px 28px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}
html[data-theme="dark"] .premium-cart-footer {
    background: linear-gradient(to bottom, rgba(15,23,42,0) 0%, rgba(15,23,42,0.6) 100%);
    border-top-color: rgba(255, 255, 255, 0.05);
}

.premium-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 15px;
    color: var(--header-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.premium-cart-total strong {
    font-size: 26px;
    color: var(--header-text-main);
    font-weight: 900;
    letter-spacing: -0.5px;
}
html[data-theme="dark"] .premium-cart-total strong {
    color: #ffffff;
    text-shadow: 0 2px 15px rgba(255, 255, 255, 0.2);
}

/* =========================================
   BOTÓN VER PEDIDO (CON REFLEJO SHINE)
   ========================================= */
.premium-cart-actions {
    display: flex;
    flex-direction: column;
}

.btn-cart {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 18px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    background: linear-gradient(135deg, var(--color-primary, #0ea5e9) 0%, #4f46e5 100%);
    color: #ffffff !important;
    width: 100%;
    box-shadow: 0 12px 25px -8px rgba(79, 70, 229, 0.5);
    box-sizing: border-box; 
    display: block;
}

html[data-theme="dark"] .btn-cart { 
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    box-shadow: 0 12px 25px -8px rgba(14, 165, 233, 0.6);
}

/* Efecto Reflejo (Shine) al pasar el cursor */
.btn-cart::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: all 0.7s ease;
}
.btn-cart:hover::after {
    left: 150%;
}

.btn-cart:hover {
    box-shadow: 0 20px 35px -8px rgba(79, 70, 229, 0.7);
    transform: translateY(-3px);
}

/* =========================================
   BLOQUEO ESTRICTO DE SCROLL (Solución iOS)
   ========================================= */
html.cart-open-mobile,
body.cart-open-mobile {
    overflow: hidden !important;
    height: 100vh !important;
    overscroll-behavior: none !important;
    touch-action: none !important; 
}

/* =========================================
   RESPONSIVE MOBILE (Estilo Modal App)
   ========================================= */
@media (max-width: 768px) {
    .premium-cart-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 36px 36px 0 0 !important;
        transform: translateY(100%) !important;
        border-bottom: none !important;
        box-shadow: 0 -20px 60px rgba(0,0,0,0.15) !important;
        z-index: 2147483647 !important; 
        touch-action: auto !important; 
    }
    
    html[data-theme="dark"] .premium-cart-dropdown {
        box-shadow: 0 -20px 60px rgba(0,0,0,0.6) !important;
    }
    
    .premium-cart-dropdown.is-active {
        transform: translateY(0) !important;
    }
    
    .premium-cart-body {
        max-height: 48vh !important; 
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important; 
        overscroll-behavior: contain !important; 
        padding: 10px 20px !important;
    }
    
    .premium-cart-footer {
        padding-bottom: 24px !important; 
    }
    
    body.cart-open-mobile::after {
        content: '';
        position: fixed !important;
        top: 0 !important; 
        left: 0 !important; 
        width: 100% !important; 
        height: 100% !important;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 2147483646 !important; 
        animation: fadeIn 0.3s forwards;
    }
}