/* ---- VARIABLES Y ESTILOS GENERALES ---- */
:root {
    --primary-blue: #1D3A8A;
    --primary-yellow: #FDC02F;
    --light-bg: #F8F9FA;
    --dark-text: #333;
    --tag-red: #E74C3C;
    --tag-blue: #3498DB;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    padding-top: 80px;
}

/* ---- SPINNER DE CARGA ---- */
#loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; visibility: hidden; opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}
#loader-overlay.show { visibility: visible; opacity: 1; }
.loader.spinner {
    width: 50px; aspect-ratio: 1; display: grid;
    border: 4px solid #0000; border-radius: 50%; border-color: #ccc #0000;
    animation: l16 1s infinite linear;
}
.loader.spinner::before, .loader.spinner::after {
    content: ""; grid-area: 1/1; margin: 2px;
    border: inherit; border-radius: 50%;
}
.loader.spinner::before {
    border-color: var(--primary-blue) #0000; animation: inherit;
    animation-duration: .5s; animation-direction: reverse;
}
.loader.spinner::after { margin: 8px; }
@keyframes l16 { 100%{transform: rotate(1turn)} }

/* ---- MENÚ DE NAVEGACIÓN ---- */
.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background-color 0.4s ease-in-out, opacity 0.4s ease-in-out;
}
.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
}

/* ---- CENTRADO MEJORADO DEL BRAND ---- */
.navbar-brand { 
    font-weight: 900; 
    font-size: 2.0rem; 
    color: var(--primary-blue); 
    /* CENTRADO MEJORADO - AJUSTAR ESTE VALOR PARA MOVER HACIA EL CENTRO */
    margin-left: 25%; /* NUEVA PROPIEDAD PARA CENTRAR MEJOR */
    position: relative;
    left: -20px; /* AJUSTE FINO DE POSICIÓN */
}

.nav-link { 
    font-weight: 600; 
    position: relative; 
    padding-bottom: 8px; 
    color: var(--dark-text);
    transition: color 0.3s ease;
}
.nav-link:hover {
    color: var(--primary-blue);
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: var(--primary-yellow);
    transition: width 0.3s ease-in-out;
}
.nav-link:hover::after { width: 100%; }

/* ---- CARRITO DE COMPRAS - POSICIÓN CORREGIDA Y MEJORADA ---- */

/* Contenedor del carrito para móviles - POSICIÓN ABSOLUTA INDEPENDIENTE */
.mobile-cart-container {
    position: absolute;
    /* SEPARACIÓN DEL BORDE DERECHO - AJUSTAR ESTE VALOR PARA ALEJAR MÁS EL CARRITO */
    right: 85px; /* VALOR ORIGINAL: 80px - INCREMENTADO PARA MÁS SEPARACIÓN */
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001; /* MAYOR z-index QUE EL MENÚ HAMBURGUESA */
}

.cart-icon-desktop,
.cart-icon-mobile {
    position: relative;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
    padding: 8px 12px !important;
}

.cart-icon-desktop:hover,
.cart-icon-mobile:hover {
    transform: scale(1.1);
}

.cart-icon-desktop i,
.cart-icon-mobile i {
    font-size: 1.3rem;
    color: var(--primary-blue);
}

/* BADGE DEL CARRITO - POSICIÓN CORREGIDA PARA NO OBSTACULIZAR */
.cart-icon-desktop .badge,
.cart-icon-mobile .badge {
    position: absolute;
    /* POSICIÓN DEL BADGE - AJUSTAR ESTOS VALORES PARA SEPARAR DEL ÍCONO DEL MENÚ */
    top: -2px;   /* VALOR ORIGINAL: -5px - ACERCADO AL ÍCONO */
    right: -2px; /* VALOR ORIGINAL: -5px - ACERCADO AL ÍCONO */
    font-size: 1.0rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-yellow) !important;
    color: var(--dark-text) !important;
    border: 2px solid white;
}

/* ---- MENÚ HAMBURGUESA - ASEGURAR QUE NO INTERFIERA ---- */
.navbar-toggler {
    position: relative;
    z-index: 1000; /* z-index ALTO PERO MENOR QUE EL CARRITO */
    border: none;
    padding: 4px 8px;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

/* ---- HEADER SECTION ---- */
.header-section {
    padding: 1.5rem 0; background-color: var(--primary-blue);
    border-radius: 20px; margin-bottom: 3rem;
    background-image: linear-gradient(45deg, var(--primary-blue), #3a5db0);
}
.header-content {
    display: flex;
    align-items: center; padding: 0 1.5rem;
}
.btn-header-categories {
    background: transparent; border: 2px solid var(--primary-yellow);
    color: var(--primary-yellow); font-weight: 600;
}
.header-title-container { text-align: center; color: white; position: relative; }
.main-title {
    font-weight: 900; font-size: clamp(2.5rem, 6vw, 4rem);
    text-transform: uppercase; letter-spacing: 2px; margin: 0;
}
.main-subtitle {
    font-family: 'Dancing Script', cursive; font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--primary-yellow); font-weight: 700;
}

/* ---- TARJETAS DE PRODUCTO ---- */
.product-card {
    background-color: white; border-radius: 20px; padding: 20px;
    text-align: center; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; overflow: hidden; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12); }
.product-image { max-width: 90%; height: 250px; object-fit: contain; margin-bottom: 1rem; align-self: center; }
.product-name { font-size: 1.5rem; font-weight: 700; color: var(--dark-text); border-top: 1px solid #f0f0f0; padding-top: 1rem; margin-bottom: 0.25rem; }
.product-description { font-size: 0.9rem; color: #777; margin-bottom: 0.5rem; line-height: 1.3; }
.product-price { font-size: 2.5rem; font-weight: 900; color: var(--primary-blue); margin-bottom: 0.5rem; }
.btn-add-to-cart { background-color: var(--primary-yellow); color: var(--dark-text); border: none; border-radius: 50px; padding: 12px 30px; font-weight: 700; text-transform: uppercase; transition: background-color 0.3s ease; margin-top: auto; }
.btn-add-to-cart:hover { background-color: #eab128; }
.product-tag { position: absolute; top: 15px; left: -30px; transform: rotate(-45deg); padding: 5px 40px; color: white; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; }
.product-tag.new { background-color: var(--tag-blue); }
.product-tag.best { background-color: var(--tag-red); }

/* ---- LÍNEA DIVISORIA Y BOTÓN VER MÁS ---- */
.divider-line {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
    margin: 2rem auto;
    width: 80%;
    border: none;
}

.btn-load-more {
    border: 2px solid var(--primary-blue);
    color: var(--primary-blue);
    font-weight: 600;
    padding: 12px 35px;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: white;
}

.btn-load-more:hover {
    background-color: var(--primary-blue);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(29, 58, 138, 0.3);
}

/* ---- MODALES Y CARRITO ---- */
.login-modal-content { border-radius: 15px; border: none; }
.login-modal-header { background-color: var(--primary-blue); color: white; border-top-left-radius: 15px; border-top-right-radius: 15px; border-bottom: none; }
.btn-login { background-color: var(--primary-yellow); color: var(--dark-text); font-weight: 700; border: none; transition: background-color 0.3s; }
.btn-login:hover { background-color: #eab128; color: var(--dark-text); }
.login-link { color: var(--primary-blue); text-decoration: none; font-size: 0.9rem; }
.login-link:hover { text-decoration: underline; }
.cart-item { display: flex; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid #eee; padding-bottom: 1rem; }
.cart-item-image { width: 80px; height: 80px; object-fit: contain; margin-right: 1rem; }
.cart-item-details { flex-grow: 1; }
.cart-item-actions { display: flex; align-items: center; }
.cart-item-actions button { border: 1px solid #ccc; background-color: #f8f8f8; width: 30px; height: 30px; }
.cart-item-quantity { padding: 0 1rem; font-weight: bold; }
.btn-remove-item { color: var(--tag-red); background: none; border: none; font-size: 1.2rem; }

/* ---- FOOTER ---- */
.site-footer { background-color: var(--primary-blue); color: #a9bce8; padding: 40px 0 20px 0; margin-top: 4rem; }
.footer-container { display: flex; flex-wrap: wrap; justify-content: space-between; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-section { flex: 1; min-width: 220px; margin: 20px 10px; }
.footer-section h3 { color: var(--primary-yellow); font-size: 1.1rem; font-weight: 700; text-transform: uppercase; margin-bottom: 15px; }
.footer-section ul { list-style: none; padding: 0; }
.footer-section ul li a { color: white; text-decoration: none; transition: color 0.3s; line-height: 2; }
.footer-section ul li a:hover { color: var(--primary-yellow); }
.newsletter-form { display: flex; margin: 15px 0; }
.newsletter-form input { flex-grow: 1; border: none; padding: 10px; border-radius: 5px 0 0 5px; }
.newsletter-form button { background-color: var(--primary-yellow); color: var(--dark-text); border: none; padding: 10px 15px; border-radius: 0 5px 5px 0; cursor: pointer; font-weight: 600; }
.copyright { text-align: center; border-top: 1px solid #2e4a9e; padding-top: 20px; margin-top: 20px; font-size: 0.9rem; line-height: 1.6; max-width: 1200px; margin-left: auto; margin-right: auto; }
.copyright a { color: white; font-weight: 600; text-decoration: none; }
.copyright a:hover { color: var(--primary-yellow); text-decoration: underline; }

/* ---- AJUSTES DE RESPONSIVIDAD PARA MÓVILES ---- */
@media (max-width: 767px) {
    .header-content { padding: 0 1rem; }
    .main-title { font-size: 1.8rem; }
    .main-subtitle { font-size: 0.8rem; }
    
    /* Carrito móvil - POSICIÓN CORREGIDA Y SEPARADA */
    .mobile-cart-container {
        /* SEPARACIÓN INCREMENTADA EN MÓVIL - AJUSTAR SEGÚN NECESIDAD */
        right: 75px; /* VALOR ORIGINAL: 70px - INCREMENTADO */
    }
    
    /* Brand centrado en móviles */
    .navbar-brand {
        margin-left: 15%; /* CENTRADO RELATIVO EN MÓVIL */
        left: -15px; /* AJUSTE FINO PARA MÓVIL */
        font-size: 1.3rem; /* TAMAÑO AJUSTADO PARA MÓVIL */
    }
    
    .cart-icon-mobile i {
        font-size: 1.5rem;
    }
    
    .cart-icon-mobile .badge {
        font-size: 1.6rem;
        min-width: 16px;
        height: 20px;
        /* POSICIÓN DEL BADGE EN MÓVIL - AJUSTAR SI ES NECESARIO */
        top: -1px;
        right: -1px;
    }
    
    /* --- AJUSTES RESPONSIVOS DEL FOOTER --- */
    .site-footer {
        padding: 30px 0 15px 0;
    }
    .footer-container {
        padding: 0 10px;
    }
    .footer-section {
        flex-basis: 50%; 
        margin: 10px 0;
        padding: 0 10px;
    }
    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    .footer-section ul li a, .footer-section.newsletter p {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    .newsletter-form {
        display: block;
        margin-top: 10px;
    }
    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
        border-radius: 5px;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    .newsletter-form input {
        margin-bottom: 0.5rem;
    }
    .copyright {
        margin-top: 15px;
        padding-top: 15px;
    }
    
    /* Ajustes para botón ver más en móviles */
    .btn-load-more {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .mobile-cart-container {
        right: 70px; /* SEPARACIÓN ADICIONAL EN PANTALLAS MUY PEQUEÑAS */
    }
    
    .navbar-brand {
        margin-left: 12%; /* MÁS CENTRADO EN PANTALLAS PEQUEÑAS */
        left: -10px;
        font-size: 1.2rem;
    }
    
    .cart-icon-mobile i {
        font-size: 1.1rem;
    }
    
    .cart-icon-mobile .badge {
        font-size: 0.6rem;
        min-width: 16px;
        height: 16px;
    }
    
    .divider-line {
        width: 90%;
    }
}

@media (max-width: 400px) {
    .mobile-cart-container {
        right: 65px; /* SEPARACIÓN MÁXIMA EN PANTALLAS MUY PEQUEÑAS */
    }
    
    .navbar-brand {
        margin-left: 10%;
        left: -8px;
        font-size: 1.1rem;
    }
    
    .cart-icon-mobile i {
        font-size: 1rem;
    }
}