/* =========================================
   1. VARIABLES & CONFIGURACIÓN BASE
   ========================================= */
:root {
    /* Paleta de Colores Moderna */
    --primary: #2563eb;
    /* Azul vibrante */
    --primary-dark: #1e40af;
    --primary-light: #eff6ff;
    --accent: #f59e0b;
    /* Naranja ofertas */
    --dark: #0f172a;
    --text-muted: #64748b;
    --bg-body: #f1f5f9;

    /* UI Elements */
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --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);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   2. HEADER & LOGO
   ========================================= */
.main-header {
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.logo-text {
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

/* Iconos del Header */
.btn-icon,
.btn-cart-trigger {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    transition: all 0.2s ease;
}

.btn-icon:hover,
.btn-cart-trigger:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* =========================================
   3. HERO & BANNERS
   ========================================= */
.carousel-item {
    height: 450px;
    /* Altura fija para evitar saltos */
    background-color: #e2e8f0;
    border-radius: var(--radius-lg);
}

.carousel-item img {
    height: 100%;
    object-fit: cover;
}

/* --- EFECTO IA PROFESIONAL (Deep Tech) --- */
.bg-move {
    /* Paleta: Azul Medianoche, Índigo sutil, Violeta Profundo y Cyan Eléctrico */
    background: linear-gradient(-45deg,
            #0f172a,
            /* Slate 900 */
            #1e3a8a,
            /* Blue 900 */
            #312e81,
            /* Indigo 950 */
            #1e40af,
            /* Blue 800 */
            #581c87,
            /* Purple 900 */
            #075985
            /* Cyan 800 */
        );

    background-size: 400% 400%;
    animation: aiGradientMove 12s ease infinite;

    width: 100%;
    height: 400px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


@keyframes aiGradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}


/* --- HERO / CAROUSEL RESPONSIVE --- */
.carousel-hero-layout {
    height: 450px;
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 1.5rem;
    overflow: hidden;
    /* Para que el gradiente no se salga */
}

/* El caption en móvil debe estar más abajo para no tapar el centro de la foto */
.carousel-caption {
    right: 5%;
    left: 5%;
    bottom: 2rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.floating-discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff0000;
    color: white;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 10px 20px rgba(255, 0, 0, 0.4);
    transform: rotate(-10deg);
    z-index: 10;
    border: 2px solid rgb(181, 179, 179);
}

/* --- AJUSTES PARA MÓVIL --- */
@media (max-width: 768px) {
    .carousel-hero-layout {
        height: 300px;
        /* Reducimos altura */
    }

    .carousel-caption {
        text-align: center !important;
        /* Centramos el texto en móvil para mejor equilibrio */
        margin-bottom: 30px;
    }

    .carousel-caption .d-flex {
        justify-content: center;
        /* Centramos precios */
    }

    .display-6 {
        font-size: 1.4rem;
        /* Título más pequeño */
    }

    .floating-discount-badge {
        width: 55px;
        height: 55px;
        top: 10px;
        right: 10px;
    }

    .floating-discount-badge .pct {
        font-size: 1.1rem;
    }
}

/* Soporte para pantallas extra pequeñas*/
@media (max-width: 400px) {
    .carousel-hero-layout {
        height: 320px;
    }

    .new-price {
        font-size: 1.2rem !important;
    }
}

/* --- ANIMACION: FADE MÁS SUAVE --- */
.carousel-fade .carousel-item {
    transition-duration: 0.8s;
    /* Duración del desvanecimiento entre slides */
}

/* --- ANIMACION: ENTRADA ESCALONADA DE TEXTOS --- */

/* 1. Estado base (oculto y ligeramente desplazado hacia abajo) */
.animate-in-1,
.animate-in-2,
.animate-in-3,
.animate-in-4 {
    opacity: 0;
    transform: translateY(25px);
    transition: all 0.7s cubic-bezier(0.2, 1, 0.2, 1);
    /* Curva pro para el efecto de "salto" */
    will-change: transform, opacity;
}

/* 2. Disparador: Cuando el carrusel activa el slide, animamos sus hijos */
.carousel-item.active .animate-in-1 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
    /* El título sale casi de inmediato */
}

.carousel-item.active .animate-in-2 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
    /* El precio sale un poco después */
}

.carousel-item.active .animate-in-3 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
    /* Los mensajes de stock salen después */
}

.carousel-item.active .animate-in-4 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.8s;
    /* El botón es lo último en llamar la atención */
}

/* 3. Reset para evitar que los elementos parpadeen al salir del slide */
.carousel-item:not(.active) .animate-in-1,
.carousel-item:not(.active) .animate-in-2,
.carousel-item:not(.active) .animate-in-3,
.carousel-item:not(.active) .animate-in-4 {
    opacity: 0;
    transform: translateY(25px);
    transition: none;
    /* Sin transición al ocultar para que el efecto sea limpio al volver */
}

.promo-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #172554 100%);
    position: relative;
    overflow: hidden;
}

.promo-banner::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

/* =========================================
   4. FILTROS 
   ========================================= */
.glass-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
}

/* Sticky top con margen superior cuando se pega */
.sticky-md-top {
    z-index: 1020;
    transition: top 0.3s;
}
/*BTN RETROCESO EN DETALLES*/
.btn-back-custom {
    background-color: #f1f5f9; /* Gris muy suave */
    color: #334155; /* Gris oscuro elegante */
    border-radius: 50px; /* Bordes totalmente redondos */
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.btn-back-custom:hover {
    background-color: #e2e8f0; /* Gris un poco más oscuro */
    color: #0f172a; /* Casi negro */
    transform: translateX(-5px); /* Pequeño movimiento a la izquierda */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-back-custom i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

/* =========================================
   5. CARD DE PRODUCTO
   ========================================= */
.product-card {
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.product-card:hover {
    transform: translateY(-5px);
    border: 1px solid #ffae00;
}

.product-img-wrapper {
    position: relative;
    padding-top: 100%;
    background: white;
    overflow: hidden;
}

.product-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 1.5rem;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.05);
}

/* Badge de Oferta */
.badge-offer {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cuerpo de la tarjeta */
.card-body-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
    /* Fija altura para 2 líneas */
}

.price-tag {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.price-old {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* =========================================
   6. CARRITO & OFFCANVAS
   ========================================= */
.cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid #e2e8f0;
}

.btn-qty {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
}

/* Botón flotante solo en mobile */
.btn-cart-float {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: var(--dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1050;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-cart-float:active {
    transform: scale(0.9);
}

/* Vendedores */
.vendor-item {
    transition: background 0.2s;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem;
}

.vendor-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* =========================================
   7. RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .carousel-item {
        height: 220px;
    }

    .promo-banner {
        margin-top: 1rem;
        height: auto;
        padding: 1.5rem !important;
    }

    .main-header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* =========================================
   VER DETALLE DEL PRODUCTO
   ========================================= */
.product-detail-img img {
    height: 500px;
    object-fit: contain;
    background: #fff;
}

@media (max-width: 768px) {
    .product-detail-img img {
        height: 300px;
    }
}

.breadcrumb-item a {
    text-decoration: none;
    color: var(--primary);
}

#product-detail-view {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   8. PAGINACION COMPACTA
   ========================================= */
.pagination-modern .page-item {
    margin: 0 3px;
}

.pagination-modern .page-link {
    border: none;
    color: #475569;
    border-radius: 8px !important;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.pagination-modern .page-item.active .page-link {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.pagination-modern .page-link:hover:not(.active) {
    background-color: #e2e8f0;
    color: var(--primary);
}

.pagination-modern .disabled .page-link {
    background: transparent;
    color: #cbd5e1;
    cursor: not-allowed;
}

/* Ajuste para móvil: botones más compactos */
@media (max-width: 576px) {
    .pagination-modern .page-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* =========================================
   9. FOOTER
   ========================================= */
.main-footer {
    background-color: #1e293b !important;
    /* Slate 800 */
}

.hover-white {
    transition: color 0.2s ease;
}

.hover-white:hover {
    color: white !important;
}

/* =========================================
   9. AJUSTES OFFCANVAS & MOBILE
   ========================================= */
/* Asegura que el offcanvas de filtros no sea muy ancho en mobile */
#offcanvasFiltros {
    max-width: 85vw;
}

/* Evitar que el botón flotante tape el footer */
.btn-cart-float {
    bottom: 25px;
}

/*Boton agregado*/
.transition-btn {
    transition: all 0.5s ease-in-out;
}

/*EFECTO CURSOR DE ESCRITURA EN HEADER*/
.cursor-blink {
    animation: blink 1s infinite;
    color: var(--primary);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}


/* =========================================
   ANUNCIOS - TOP BAR DINÁMICO & ANIMADO
   ========================================= */

.top-bar {
    padding: 10px 0 !important;
    font-size: 0.9rem !important;
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- TEMA 1: NAVIDAD / INVIERNO (Efecto Nieve) --- */
.theme-christmas {
    background: linear-gradient(to right, #b91c1c, #991b1b);
    color: white;
}

/* El truco de la nieve con CSS */
.theme-christmas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(4px 4px at 20% 30%, rgba(255, 255, 255, 0.8) 50%, transparent 50%),
        radial-gradient(4px 4px at 40% 70%, rgba(255, 255, 255, 0.8) 50%, transparent 50%),
        radial-gradient(4px 4px at 60% 40%, rgba(255, 255, 255, 0.8) 50%, transparent 50%),
        radial-gradient(4px 4px at 80% 80%, rgba(255, 255, 255, 0.8) 50%, transparent 50%);
    background-size: 200px 200px;
    animation: snowFall 10s linear infinite;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes snowFall {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 20px 200px;
    }

}

/* --- TEMA 2: VERANO (Sol en movimiento) --- */
.theme-summer {
    background: linear-gradient(45deg, #f59e0b, #ea580c);
    /* Naranja veraniego */
    color: white;
    position: relative;
    overflow: hidden;
}

.theme-summer::before {
    content: '☀️';
    position: absolute;
    top: 50%;
    /* Inicia fuera de la pantalla */
    left: -10%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    opacity: 0.8;
    z-index: 1;
    /* Animación: se mueve lento de izquierda a derecha */
    animation: sunMove 20s linear infinite;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

@keyframes sunMove {
    0% {
        left: -10%;
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        /* Cruza toda la barra hasta salir */
        left: 110%;
        /* El sol gira sobre sí mismo mientras viaja */
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Ajuste para que el texto dinámico no sea tapado por el sol */
#dynamic-announcement {
    position: relative;
    z-index: 2;
    /* El texto por encima del sol */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- TEMA 3: BLACK FRIDAY / ELEGANTE --- */
.theme-black-friday {
    background: #000;
    color: #fca5a5;
    border-bottom: 2px solid #ef4444;
}

.theme-black-friday::after {
    content: 'SALE';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    opacity: 0.1;
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 5px;
}

/* --- TEMA 4: DEFAULT (Azul Corporativo) --- */
.theme-default {
    background: #111827;
    /* Gris muy oscuro */
    color: white;
}

/* --- TEMA 5: REYES MAGOS (Mágico/Nocturno) --- */
.theme-reyes {
    background: linear-gradient(135deg, #4c1d95, #d97706);
    /* Púrpura y Dorado */
    color: #ffffff;
}

.theme-reyes::before {
    content: '🐫 🫅 ✦  ✨  ✦  ✨ ✦ ';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-30%);
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 1.2rem;
    color: rgba(255, 217, 0, 0.266);
    animation: twinkle 2s infinite alternate;
}

@keyframes twinkle {
    from {
        opacity: 0.2;
    }

    to {
        opacity: 1;
    }
}

/* --- TEMA 6: SAN VALENTÍN / MADRE  --- */
.theme-love {
    background: linear-gradient(to right, #be123c, #fb7185);
    color: #fff;
}

.theme-love::before {
    content: '❤';
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.2);
    font-size: 1.5rem;
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% {
        transform: translateY(-50%) scale(1);
    }

    15% {
        transform: translateY(-50%) scale(1.3);
    }

    30% {
        transform: translateY(-50%) scale(1);
    }

    45% {
        transform: translateY(-50%) scale(1.3);
    }

    100% {
        transform: translateY(-50%) scale(1);
    }
}

/* --- TEMA 7: OTOÑO (Cálido/Marrón) --- */
.theme-autumn {
    background: linear-gradient(to right, #9a3412, #ea580c);
    color: #fff;
}

/* --- TEMA 8: INVIERNO / AMISTAD (Frío/Azulado) --- */
.theme-winter {
    background: linear-gradient(to right, #1e3a8a, #3b82f6);
    color: #fff;
}

/* --- TEMA 9: DÍA DEL NIÑO (Colorido/Divertido) --- */
.theme-kids {
    background: linear-gradient(90deg, #ef4444, #eab308, #3b82f6);
    background-size: 200% 200%;
    color: #fff;
    animation: rainbowMove 5s alternate infinite;
}

@keyframes rainbowMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- TEMA: PRIMAVERA (Fresco/Verde) --- */
.theme-spring {
    background: linear-gradient(to right, #15803d, #84cc16);
    color: #ffffff;
}

.theme-spring::before {
    content: '✿';
    position: absolute;
    left: 5%;
    top: 2px;
    font-size: 1.2rem;
    opacity: 0.4;
    animation: spinSlow 10s linear infinite;
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* Animación suave de entrada de texto */
.fade-text-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

