:root {
    /* Color Principal ROJO */
    --primary: #ff0000;
    --primary-dark: #cc0000;
    --primary-light: #ffcccc;
    
    --bg: #f5f5f5;
    --white: #ffffff;
    --text-dark: #333;
    --text-light: #666;
}

body {
    font-family: sans-serif;
    background-color: var(--bg);
    margin: 0;
    padding: 0;
}

/* --- HEADER --- */
.main-header {
    background: var(--white);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- BARRA DE BÚSQUEDA --- */
.search-bar {
    flex-grow: 1;
    max-width: 600px;
    margin: 0 20px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    padding-right: 40px;
    border: 2px solid #eee;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    background-color: #f5f5f5;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.1);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
}

.search-btn:hover {
    background-color: #eee;
}

/* --- GRID DE PRODUCTOS --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    padding: 10px;
}

.product-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
    cursor: pointer;
    position: relative; /* Para posicionar el btn rápido */
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.card-image img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-info {
    padding: 10px;
}

.product-title {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.price {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.stock-tag {
    font-size: 0.7rem;
    color: var(--text-light);
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- BOTÓN DE COMPRA RÁPIDA (+) --- */
.btn-quick-add {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 10;
}

.product-card:hover .btn-quick-add {
    opacity: 1;
    transform: translateY(0);
}

.btn-quick-add:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* --- BOTÓN DE FAVORITOS (CORAZÓN) --- */
.btn-wishlist {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
    color: #ccc;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-wishlist:hover {
    transform: scale(1.1);
}

.btn-wishlist.active {
    color: var(--primary); /* Corazón rojo */
}

/* --- LOADER --- */
.loader {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    opacity: 0;
}
.loader.show { opacity: 1; }

/* --- TOAST (NOTIFICACIÓN) --- */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 2px;
    padding: 16px;
    position: fixed;
    z-index: 100;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    bottom: 80px !important;
    width: 80%;
}
.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* --- BARRA DE CATEGORÍAS (SCROLL HORIZONTAL) --- */
.category-bar-container {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 70px;
    z-index: 90;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.category-bar {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.category-bar::-webkit-scrollbar { display: none; }

.cat-pill {
    display: inline-block;
    padding: 6px 15px;
    background: #f5f5f5;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.cat-pill:hover {
    background: #e0e0e0;
}

.cat-pill.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: bold;
}

/* --- MENÚ PC --- */
.desktop-user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-header {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: 0.2s;
}

.btn-header:hover {
    background-color: #f0f0f0;
    color: var(--primary);
}

.highlight-btn {
    background-color: var(--primary);
    color: white !important;
}
.highlight-btn:hover {
    background-color: var(--primary-dark);
}

.logout { color: #999; }
.welcome-text { font-size: 0.9rem; color: #555; margin-right: 5px; }


/* --- MENÚ MÓVIL (BOTTOM NAV) --- */
.mobile-nav {
    display: none;
}

/* --- ESTRELLAS (RATING) --- */
.stars-outer { display: inline-block; position: relative; font-family: FontAwesome, sans-serif; color: #ddd; }
.stars-inner { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; width: 0; color: #f8c102; }

.star-rating-form {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}
.star-rating-form input { display: none; }
.star-rating-form label { font-size: 2rem; color: #ddd; cursor: pointer; }
.star-rating-form input:checked ~ label,
.star-rating-form label:hover,
.star-rating-form label:hover ~ label { color: #f8c102; }

.review-item { border-bottom: 1px solid #eee; padding: 15px 0; }
.review-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
.review-user { font-weight: bold; }
.review-date { color: #999; font-size: 0.8rem; }


/* --- ESTILOS CHECKOUT --- */
.checkout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    align-items: flex-start;
}

.checkout-form { flex: 3; min-width: 300px; }
.checkout-summary-wrapper { flex: 2; min-width: 300px; position: sticky; top: 90px; }

.section-title {
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
    font-size: 1.3rem;
    color: #333;
}

.form-row { display: flex; gap: 20px; }
.form-row .form-group { flex: 1; }
.form-group label { font-size: 0.9rem; color: #555; margin-bottom: 6px; display: block; font-weight: bold;}
.form-group input { 
    background: #f9f9f9; 
    border: 1px solid #e0e0e0; 
    transition: all 0.2s; 
    font-size: 1rem; 
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    box-sizing: border-box;
}
.form-group input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.payment-option {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 15px;
    cursor: pointer;
    transition: 0.2s;
}
.payment-option:hover {
    border-color: var(--primary);
    background: #fff5eb;
}
.payment-option label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }

.btn-confirm {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 18px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.3);
    transition: 0.2s;
}
.btn-confirm:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.checkout-summary {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

.items-list { max-height: 250px; overflow-y: auto; margin-bottom: 20px; padding-right: 5px; }
.item-preview { display: flex; gap: 15px; margin-bottom: 15px; align-items: center; }
.item-img { position: relative; width: 60px; height: 60px; }
.item-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid #eee; }
.item-qty {
    position: absolute; top: -8px; right: -8px; background: #666; color: white;
    width: 20px; height: 20px; border-radius: 50%; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
}
.item-details { flex: 1; }
.item-name { font-size: 0.9rem; font-weight: 500; line-height: 1.2; margin-bottom: 4px; }

.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; color: #666; font-size: 0.95rem; }
.discount-row { color: #2e7d32; background: #e8f5e9; padding: 8px; border-radius: 5px; font-weight: bold; }
.summary-divider { border-top: 2px dashed #eee; margin: 15px 0; }
.total-row { font-size: 1.4rem; color: #333; font-weight: 800; align-items: baseline; }
.total-row span:last-child { color: var(--primary); }
.security-badge { margin-top: 20px; text-align: center; font-size: 0.8rem; color: #888; background: #f5f5f5; padding: 10px; border-radius: 5px; }


/* --- RESPONSIVE / MOBILE --- */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 5px;
    }

    .btn-quick-add {
        opacity: 1 !important;
        transform: translateY(0) !important;
        width: 35px; height: 35px; font-size: 1.2rem;
        bottom: 5px; right: 5px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .product-title { font-size: 0.8rem; }
    .price { font-size: 1rem; }

    .main-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        align-items: stretch;
    }
    .main-header h1 { text-align: center; margin-bottom: 5px; }

    .search-bar { width: 100%; max-width: none; margin: 0; order: 2; }

    body { padding-bottom: 70px; }

    .desktop-user-menu { display: none; }

    /* Mobile Nav */
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0; left: 0; width: 100%;
        background: white;
        border-top: 1px solid #eee;
        padding: 8px 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .nav-item {
        text-decoration: none; color: #666;
        display: flex; flex-direction: column; align-items: center;
        font-size: 0.75rem;
    }
    .nav-item span { font-size: 1.4rem; margin-bottom: 2px; }
    .nav-item:hover, .nav-item:active { color: var(--primary); }

    .category-bar-container { top: 110px; }

    /* Checkout Mobile */
    .checkout-container { flex-direction: column-reverse; }
    .checkout-summary-wrapper { position: static; width: 100%; }
    .checkout-form { width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
}



@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

/* =========================================
   HEADER ESTILO TEMU (PC & MÓVIL)
   ========================================= */

:root {
    --temu-red: #cc0000;       /* Rojo Principal */
    --temu-dark-red: #a80000;  /* Rojo Oscuro (Submenú) */
    --temu-orange: #fb7701;    /* Logo */
    --temu-bg-mobile: #ffffff;
    --header-height-pc: 110px; /* Altura total PC (Main + Sub) */
    --header-height-mob: 60px; /* Altura Móvil */
}

/* Reset básico para asegurar que el header pegue al borde */
body { margin: 0; padding: 0; }

/* --- CONTENEDOR PRINCIPAL HEADER (FIJO) --- */
.temu-header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* --- NIVEL 1: BARRA PRINCIPAL --- */
.main-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    height: 60px;
    box-sizing: border-box;
    background-color: var(--temu-red); /* PC: Rojo */
    color: white;
    transition: background-color 0.3s;
}

/* Logo */
.nav-logo {
    text-decoration: none;
    margin-right: 20px;
    display: flex;
    align-items: center;
}
.logo-text {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: white; /* PC: Texto blanco */
}

/* Buscador Central */
.nav-search {
    flex: 1;
    max-width: 700px;
    position: relative;
    margin: 0 20px;
}
.search-input {
    width: auto;
    padding: 10px 40px 10px 15px;
    border-radius: 20px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: white; /* PC: Fondo blanco */
}
.search-icon-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Iconos Derecha (PC) */
.nav-actions-pc {
    display: flex;
    align-items: center;
    gap: 25px;
}
.nav-item-link {
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    position: relative;
}
.nav-item-link span { font-size: 1.4rem; margin-bottom: 2px; }
.nav-item-link strong { font-size: 0.85rem; }

/* Badge Carrito */
.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: white;
    color: var(--temu-red);
    font-weight: bold;
    border-radius: 50%;
    padding: 1px 5px;
    font-size: 0.7rem;
}

/* --- NIVEL 2: SUBMENÚ CATEGORÍAS (Solo PC) --- */
.sub-nav-bar {
    background-color: var(--temu-dark-red);
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.9rem;
}
.sub-nav-links {
    display: flex;
    gap: 20px;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
}
.sub-link {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    font-weight: 500;
}
.sub-link:hover { opacity: 1; text-decoration: underline; }

/* --- RESPONSIVE: MÓVIL (Cambio drástico de estilo) --- */
@media (max-width: 768px) {
    /* Ocultar Submenú en móvil */
    .sub-nav-bar { display: none; }
    
    /* Ocultar Iconos PC */
    .nav-actions-pc { display: none; }

    /* Estilo Barra Principal en Móvil */
    .main-nav-bar {
        background-color: var(--temu-bg-mobile); /* Móvil: Blanco */
        border-bottom: 1px solid #eee;
        padding: 10px;
        gap: 10px;
    }

    /* Logo Móvil (Naranja) */
    .logo-text {
        color: var(--temu-orange); 
        font-size: 1.5rem;
    }

    /* Buscador Móvil (Gris) */
    .nav-search { margin: 0; }
    .search-input {
        background-color: #f0f0f0; /* Input Gris */
        padding: 8px 15px;
    }
    
    /* Iconos Móvil (Derecha del header) */
    .nav-actions-mobile {
        display: flex;
        gap: 15px;
    }
    .mob-icon {
        font-size: 1.4rem;
        color: #333;
        text-decoration: none;
    }
}

/* AJUSTE PARA EL HOME: Espaciador automático */
body.has-fixed-header {
    padding-top: var(--header-height-pc);
}
@media (max-width: 768px) {
    body.has-fixed-header {
        padding-top: var(--header-height-mob);
    }
}
/* =========================================
   HEADER INTEGRADO CON CATEGORÍAS
   ========================================= */

/* --- SUBMENÚ PC (Barra Roja Oscura) --- */
.sub-nav-bar {
    background-color: #a80000; /* Rojo oscuro */
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.sub-nav-links {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 25px;
}

.sub-link {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}
.sub-link:hover { opacity: 1; text-decoration: underline; }


/* --- BARRA MÓVIL DESLIZABLE (Debajo del header blanco) --- */
.mobile-cat-bar {
    background-color: white;
    border-bottom: 1px solid #eee;
    padding: 10px 15px;
    display: flex;
    gap: 10px;
    overflow-x: auto; /* Scroll horizontal */
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Suavizado en iOS */
}
/* Ocultar barra de scroll fea */
.mobile-cat-bar::-webkit-scrollbar { display: none; }

.mob-cat-pill {
    display: inline-block;
    padding: 6px 15px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.mob-cat-pill.active {
    background: #fff0e0;
    color: #fb7701;
    border-color: #fb7701;
    font-weight: bold;
}

/* --- AJUSTE DE ESPACIADO DEL CUERPO --- */
/* Como el header ahora tiene altura variable (PC vs Movil), ajustamos el padding */

/* EN PC (Header Alto = Main + Submenu) */
body.has-fixed-header {
    padding-top: 100px; 
}

/* EN MÓVIL (Header Medio = Main + Scrollbar) */
@media (max-width: 768px) {
    body.has-fixed-header {
        padding-top: 115px; /* 60px (Header) + 55px (Barra Categorias) */
    }
}

/* --- ESTILOS DEL TOP HEADER PROMOCIONAL --- */

/*.top-promo-bar {

    USAR EN CASO DE PONER IMAGEN DE FONDO

     Ejemplo para usar una imagen 
    background-image: url('../img/navidad.jpg');
    background-size: cover;
    background-position: center;
   
}*/

.top-promo-bar {
    background-color: #1a1a1a; /* Fondo oscuro elegante */
    color: #ffffff;
    width: auto;
    padding: 8px 15px;
    position: relative;
    z-index: 2000; /* Por encima del menú principal */
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex; /* Flexbox para centrar contenido */
    justify-content: center;
    align-items: center;
    transition: margin-top 0.3s ease;
}

/* Contenido centrado */
.promo-content {
    display: flex;
    align-items: center;
    gap: 10px; /* Espacio entre icono, texto y botón */
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

/* Icono animado */
.promo-icon {
    font-size: 1.1rem;
    animation: bounce 2s infinite;
}

/* Link de acción (botón pequeño) */
.promo-link {
    color: #fff;
    text-decoration: underline;
    font-weight: bold;
    font-size: 0.8rem;
    margin-left: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
}
.promo-link:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Botón X para cerrar */
.promo-close-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}
.promo-close-btn:hover {
    color: #fff;
}

/* Animación simple para el icono */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* AJUSTE MOVIL: Que no ocupe mucho espacio */
@media (max-width: 600px) {
    .top-promo-bar {
        padding: 6px 30px 6px 10px; /* Espacio extra a la derecha para la X */
        font-size: 0.75rem;
        width: auto;
    }
    .promo-content {
        gap: 5px;
    }
}

