/* ============================================
   ESTILOS PARA DESCUENTOS DINÁMICOS
   Sistema de badges y precios con descuento
   ============================================ */

/* BADGE DE DESCUENTO DINÁMICO */
.discount-badge-dynamic {
    position: absolute;
    top: 10px;
    left: 10px;
    right: auto;
    background: linear-gradient(135deg, #E31837 0%, #b71c24 100%) !important;
    color: white;
    padding: 10px 16px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(227, 24, 55, 0.45), 
                0 0 0 3px rgba(255, 255, 255, 0.8),
                inset 0 2px 4px rgba(255, 255, 255, 0.25) !important;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 75px;
    border: none !important;
    animation: none !important;
    transform: none !important;
    will-change: auto !important;
}

@keyframes subtle-bg-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes soft-bright {
    0%, 100% {
        filter: brightness(1);
        box-shadow: 0 8px 25px rgba(255, 23, 68, 0.45), 0 0 0 3px rgba(255,255,255,0.8), inset 0 2px 4px rgba(255,255,255,0.25);
    }
    50% {
        filter: brightness(1.08);
        box-shadow: 0 10px 30px rgba(255, 23, 68, 0.55), 0 0 6px rgba(255,255,255,0.9), inset 0 3px 6px rgba(255,255,255,0.3);
    }
}

.discount-badge-percent {
    font-size: 28px !important;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.5px;
}

.discount-badge-text {
    font-size: 11px !important;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* CONTENEDOR DE PRECIOS CON DESCUENTO */
.price-container-discount {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

/* PRECIO ORIGINAL (TACHADO) */
.price-original {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: #ef4444;
}

/* PRECIO CON DESCUENTO (DESTACADO) */
.price-discounted {
    color: #dc2626;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}

/* TEXTO DE AHORRO - Variante en amarillo */
.price-savings {
    color: #92400e; /* texto oscuro sobre amarillo */
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff7ed 0%, #fff3bf 100%); /* tonos suaves amarillos */
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #f59e0b; /* borde ámbar */
    display: inline-block;
}

.price-savings::before {
    content: '💰 ';
    margin-right: 2px;
}

/* INTEGRACIÓN CON TARJETAS DE PRODUCTO */
.product-card .discount-badge-dynamic {
    top: 8px;
    right: 8px;
}

.offer-card .discount-badge-dynamic {
    top: 12px;
    right: 12px;
}

/* AJUSTES PARA VISTA DE LISTA */
.product-list .product-item .price-container-discount {
    margin-top: 8px;
}

/* AJUSTES PARA VISTA DE GRID */
.products-grid .product-card .price-container-discount {
    margin-top: 10px;
}

/* HOVER EFFECTS - SIN MOVIMIENTO, SOLO BRILLO */
.product-card:hover .discount-badge-dynamic,
.offer-card:hover .discount-badge-dynamic {
    box-shadow: 0 10px 30px rgba(255, 23, 68, 0.55), 
                0 0 0 3px rgba(255, 255, 255, 0.9),
                inset 0 2px 5px rgba(255, 255, 255, 0.35) !important;
    filter: brightness(1.1) !important;
    transform: none !important;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .discount-badge-dynamic {
        padding: 6px 10px;
        min-width: 55px;
        top: 8px;
        left: 8px;
        right: auto;
    }

    .discount-badge-percent {
        font-size: 18px;
    }

    .discount-badge-text {
        font-size: 9px;
    }

    .price-discounted {
        font-size: 20px;
    }

    .price-original {
        font-size: 12px;
    }

    .price-savings {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Ajustes para badges de oferta en móvil */
    .offer-badge, .offer-badge.discount {
        font-size: 0.85rem !important;
        padding: 5px 10px !important;
        border-radius: 14px !important;
    }
}

/* ===== FORCE OVERRIDES: asegurar que los badges de descuento sean ESTÁTICOS ===== */
.offer-badge.discount,
.offer-badge.discount *,
.discount-badge,
.discount-badge-dynamic,
.discount-badge-percent,
.discount-badge-text {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    will-change: auto !important;
}

/* Permitir solo un brillo muy sutil en hover (sin mover ni escalar) */
.offer-badge.discount:hover,
.discount-badge:hover,
.discount-badge-dynamic:hover {
    filter: brightness(1.06) !important;
    box-shadow: 0 10px 26px rgba(255, 23, 68, 0.42) !important;
}

/* Pseudo-elementos por si hubiera ::before / ::after aplicados */
.offer-badge.discount::before,
.offer-badge.discount::after,
.discount-badge::before,
.discount-badge::after {
    animation: none !important;
    transform: none !important;
    display: block !important;
}

/* VARIANTE PEQUEÑA PARA BADGES EN CARRUSEL - ESTÁTICO Y ROJO INTENSO */
.offer-card .offer-badge.discount, .offer-badge.discount {
    background: linear-gradient(135deg, #E31837 0%, #b71c24 100%) !important;
    color: #ffffff !important;
    background-size: auto !important;
    padding: 6px 12px !important;
    border-radius: 18px !important;
    font-weight: 800 !important;
    font-size: 0.9rem !important;
    box-shadow: 0 8px 22px rgba(227, 24, 55, 0.48) !important;
    border: none !important;
    animation: none !important; /* Sin animaciones */
    transform: none !important; /* Sin rotaciones ni escalas */
    opacity: 1 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25) !important;
}

/* ESTILOS PARA PRECIOS EN CARRUSEL CON DESCUENTO */
.offer-price .price-original {
    display: block;
    margin-bottom: 4px;
}

.offer-price .price-current {
    font-size: 22px;
    font-weight: 900;
    color: #dc2626;
}

/* INDICADOR DE DESCUENTO ACTIVO EN TODA LA TARJETA */
.product-card.has-discount,
.offer-card.has-discount {
    border: 2px solid #fecaca;
    background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
}

.product-card.has-discount::before,
.offer-card.has-discount::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #dc2626 100%);
    background-size: 200% 100%;
    animation: shimmer-discount 3s linear infinite;
}

@keyframes shimmer-discount {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ETIQUETA FLOTANTE DE "EN OFERTA" */
.discount-tag-floating {
    position: absolute;
    top: -8px;
    left: 10px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    z-index: 45;
    border: 2px solid #fef3c7;
}

.discount-tag-floating::before {
    content: '🔥 ';
    margin-right: 2px;
}

/* Static intense-red badge used in all-products.js */
.discount-ribbon-badge {
    background: linear-gradient(135deg, #E31837 0%, #b71c24 100%);
    color: #fff;
    animation: none !important;
    transform: none !important;
    transition: none !important;
    /* Tamaño más grande */
    padding: 10px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 900 !important;
    border-radius: 9999px !important;
    letter-spacing: 0.3px;
    /* Brillo/halo más intenso */
    text-shadow: 0 2px 6px rgba(0,0,0,0.35);
    box-shadow:
        0 12px 28px rgba(227, 24, 55, 0.45),
        0 0 0 2px rgba(255, 255, 255, 0.85),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.15);
    position: relative;
}

/* Brillo superior sutil (sin animación) */
.discount-ribbon-badge::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    height: 45%;
    border-radius: 9999px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(255,255,255,0));
}

/* Patrón diagonal muy tenue para textura */
.discount-ribbon-badge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    pointer-events: none;
    background-image: repeating-linear-gradient(45deg,
        rgba(255,255,255,0.06) 0px,
        rgba(255,255,255,0.06) 8px,
        rgba(255,255,255,0.0) 8px,
        rgba(255,255,255,0.0) 16px
    );
}

@media (max-width: 768px) {
    .discount-ribbon-badge {
        padding: 8px 12px !important;
        font-size: 0.9rem !important;
    }
}
