/* --- TOQUES FINALES GLOBALES --- */
html,
body {
    overflow-x: clip;
    width: 100%;
    position: relative;
}

html {
    scroll-behavior: smooth;
}

button,
a,
i,
input,
select,
textarea {
    transition: all 0.2s ease;
}

*:focus-visible {
    outline: 2px solid var(--color-primary, #004d40);
    outline-offset: 2px;
}

/* Scrollbar fina color verde/primario */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary, #004d40);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dorado, #ffd700);
}

/* --- NUEVO FOOTER --- */
.main-footer-new {
    background-color: var(--color-primary, #1E3A8A);
    color: #ffffff;
    padding: 40px 0 0 0;
    font-family: 'Poppins', sans-serif;
    margin-top: 40px;
}

.footer-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 0 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =======================================================
   ESTILOS DEL CARRITO Y MODALES DE PANTALLA COMPLETA
   ======================================================= */

@keyframes fadeInBg {
    from {
        background-color: transparent;
    }
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }

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

.modal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: var(--color-bg, #F9FAFB);
    z-index: 3000;
    display: none;
    flex-direction: column;
    animation: fadeInBg 0.25s ease-out forwards;
}

.modal-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: var(--color-bg, #F9FAFB);
    padding-bottom: 30px;
    animation: slideUpModal 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Ocultar la barra de scroll en el contenido del modal (móvil) */
.modal-content-wrapper {
    -ms-overflow-style: none;
    /* IE y Edge */
    scrollbar-width: none;
    /* Firefox */
}

.modal-content-wrapper::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari y Opera */
}

/* --- OPTIMIZACIÓN DE MODALES PARA PC --- */
@media (min-width: 768px) {
    .modal-fullscreen {
        background-color: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(5px);
        align-items: center;
        justify-content: center;
        padding: 40px;
    }

    .modal-content-wrapper {
        max-width: 650px;
        height: auto;
        max-height: 85vh;
        border-radius: var(--radius-lg, 16px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        padding-bottom: 20px;
        position: relative;
    }

    .cart-header {
        border-top-left-radius: var(--radius-lg, 16px);
        border-top-right-radius: var(--radius-lg, 16px);
    }
}

.cart-header {
    position: sticky;
    top: 0;
    background-color: var(--color-bg, #ffffff);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border, #E5E7EB);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.cart-header h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--color-text, #111827);
    letter-spacing: -0.5px;
}

.btn-trash {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-trash:hover {
    background: #EF4444;
    color: #ffffff;
}

#lista-carrito {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-card, #ffffff);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--color-border, #E5E7EB);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cart-item-img {
    width: 65px;
    height: 65px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--item-bg, #F3F4F6);
    padding: 5px;
    mix-blend-mode: multiply;
}

.cart-item-img-placeholder {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--item-bg, #F3F4F6);
    border-radius: 10px;
    color: var(--color-text-muted, #9CA3AF);
    font-size: 24px;
}

.cart-item-info-container {
    flex-grow: 1;
    min-width: 0;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text, #111827);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--color-primary, #1E3A8A);
    margin: 0;
}

.cart-item-price-bs {
    font-size: 12px;
    color: var(--color-text-muted, #6B7280);
    font-weight: 500;
}

.cart-stock-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 6px;
    margin-top: 4px;
}

.cart-stock-badge.limit {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.cart-stock-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.cart-stock-badge.info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
}

.cart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--item-bg, #F3F4F6);
    padding: 5px;
    border-radius: 20px;
}

.cart-btn {
    background: #ffffff;
    border: 1px solid var(--color-border, #E5E7EB);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    color: var(--color-text, #111827);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: 0.2s;
}

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

#checkout-sections {
    padding: 5px 20px 20px 20px;
}

.checkout-box {
    background: var(--color-card, #ffffff);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.box-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--color-text, #111827);
    margin-top: 0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box-title i {
    color: var(--color-primary, #1E3A8A);
}

.delivery-toggles,
.payment-toggles {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.delivery-toggles input[type="radio"],
.payment-toggles input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text, #4B5563);
    background: var(--item-bg, #F9FAFB);
    transition: all 0.2s;
}

.delivery-toggles input[type="radio"]:checked+.toggle-btn,
.payment-toggles input[type="radio"]:checked+.toggle-btn {
    background: var(--color-primary, #1E3A8A);
    color: #ffffff;
    border-color: var(--color-primary, #1E3A8A);
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.2);
}

/* --- BOTONES DE COPIAR DATOS DE PAGO --- */
.data-pago-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--item-bg, #F9FAFB);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border, #E5E7EB);
}

.data-pago-row span {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #111827);
    font-family: monospace;
    letter-spacing: 0.5px;
}

.btn-copy-pago {
    background: transparent;
    border: none;
    color: var(--color-primary, #1E3A8A);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-copy-pago:hover {
    background: rgba(30, 58, 138, 0.1);
}

.input-text,
.input-select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 10px;
    font-size: 14px;
    background: var(--item-bg, #F9FAFB);
    color: var(--color-text, #111827);
    outline: none;
    box-sizing: border-box;
    transition: 0.2s;
    font-family: inherit;
}

.input-text:focus,
.input-select:focus {
    border-color: var(--color-primary, #1E3A8A);
    background: #ffffff;
}

.btn-maps {
    width: 100%;
    padding: 12px;
    background: rgba(30, 58, 138, 0.1);
    color: var(--color-primary, #1E3A8A);
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-maps:hover {
    background: rgba(30, 58, 138, 0.15);
}

.vuelto-input {
    width: 120px;
    padding: 10px;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    background: var(--item-bg, #F9FAFB);
    color: var(--color-text, #111827);
    outline: none;
}

.vuelto-input:focus {
    border-color: var(--dorado, #F59E0B);
}

.total-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-card, #ffffff);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border, #E5E7EB);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.total-usd {
    font-size: 26px;
    font-weight: 900;
    color: var(--color-primary, #1E3A8A);
    text-align: right;
    line-height: 1;
}

.total-bs {
    font-size: 14px;
    color: var(--color-text-muted, #6B7280);
    text-align: right;
    margin-top: 6px;
    font-weight: 600;
}

/* --- MODO OSCURO (DARK MODE) DE LOS MODALES --- */
body.dark-mode .modal-fullscreen {
    background-color: #0B132B;
}

body.dark-mode .modal-content-wrapper {
    background-color: #0B132B;
}

body.dark-mode .cart-header {
    background-color: #121E3F;
    border-color: #1E293B;
}

body.dark-mode .cart-header h2 {
    color: #F9FAFB;
}

body.dark-mode .cart-item,
body.dark-mode .checkout-box,
body.dark-mode .total-container {
    background: #121E3F;
    border-color: #1E293B;
}

body.dark-mode .cart-stock-badge.limit {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
}

body.dark-mode .cart-stock-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
}

body.dark-mode .cart-stock-badge.info {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
}

body.dark-mode .historial-item button {
    background: rgba(96, 165, 250, 0.15) !important;
    color: #60A5FA !important;
}

body.dark-mode .cart-item-title,
body.dark-mode .box-title {
    color: #F9FAFB;
}

body.dark-mode .cart-item-price {
    color: #60A5FA;
}

body.dark-mode .cart-controls {
    background: #1E293B;
}

body.dark-mode .cart-btn {
    background: #121E3F;
    color: #F9FAFB;
    border-color: #334155;
}

body.dark-mode .toggle-btn,
body.dark-mode .input-text,
body.dark-mode .input-select,
body.dark-mode .vuelto-input {
    background: #1E293B;
    border-color: #334155;
    color: #F9FAFB;
}

body.dark-mode .cart-item-img,
body.dark-mode .cart-item-img-placeholder {
    background: #1E293B;
    mix-blend-mode: normal;
}

body.dark-mode .total-usd {
    color: #60A5FA;
}

.footer-col h3 {
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #ffffff;
}

.footer-col .footer-logo {
    max-width: 120px;
    margin-bottom: 15px;
}

.footer-desc {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #e0e0e0;
}

.footer-social-new {
    display: flex;
    gap: 10px;
}

.footer-social-new a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
}

.footer-social-new a:hover {
    background-color: var(--color-accent, #F59E0B);
    color: #000;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 13px;
}

.footer-col ul li a:hover {
    color: var(--color-accent, #F59E0B);
}

.footer-col p {
    font-size: 13px;
    color: #e0e0e0;
    margin-bottom: 15px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #bbb;
}

/* Ajuste para el contenedor de herramientas (filtros, etc.) */
.tools-container {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    min-height: auto !important;
}

#contenedorCategorias {
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 5px 15px !important;
    margin: 0 !important;
}

/* --- FILTROS HORIZONTALES (GRUPOS) --- */
.horizontal-filters {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 12px;
    padding: 10px 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: nowrap !important;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Momentum scroll nativo en iOS y Android */
    width: 100%;
    align-items: center;
}

.horizontal-filters::-webkit-scrollbar {
    display: none;
    /* Oculta scroll en Chrome/Safari/Webkit */
}

/* Convertir los viejos botones en píldoras (Sobreescribe responsive.css) */
.horizontal-filters .cat-btn {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    width: auto !important;
    white-space: nowrap !important;
    border-radius: 25px !important;
    /* Más redondeados */
    padding: 5px 10px !important;
    /* Aún más reducidos para observar más grupos */
    background: var(--item-bg, #fff);
    border: 1px solid var(--borde-color, #ddd) !important;
    color: var(--color-text, #333);
    font-weight: 600;
    font-size: 11px !important;
    transition: 0.2s ease;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 4px !important;
    /* Separación menor */
    cursor: pointer;
    user-select: none;
}

.horizontal-filters .cat-btn i {
    font-size: 12px !important;
}

.horizontal-filters .cat-btn:active {
    transform: scale(0.95);
    /* Efecto hundimiento al tocar */
}

.horizontal-filters .cat-btn.active {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    /* Sombra elegante al seleccionar */
}

/* --- JERARQUÍA VISUAL: SUBCATEGORÍAS --- */
#subcategoria-section-main {
    /* Controlado ahora inline y de forma dinámica desde el index.html */
}

#contenedorSubcategorias {
    padding: 5px 15px 5px 15px !important;
    margin: 0 !important;
}

.horizontal-filters .subcat-btn {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    width: auto !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
    /* Más cuadrados, menos de "píldora" */
    padding: 3px 8px !important;
    /* Mucho más pequeños */
    background: transparent;
    border: 1px solid var(--borde-color, #ddd) !important;
    color: var(--color-text-muted, #666);
    font-weight: 500;
    font-size: 10px !important;
    transition: 0.2s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
}

.horizontal-filters .subcat-btn.active {
    background: rgba(30, 58, 138, 0.08) !important;
    /* Un fondo muy suave */
    color: var(--color-primary, #1E3A8A) !important;
    border-color: var(--color-primary, #1E3A8A) !important;
    font-weight: 700;
    box-shadow: none;
    /* Sin sombra para no recargar la vista */
}

/* --- FLECHAS DE SCROLL (Solo PC) --- */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--item-bg, #fff);
    border: 1px solid var(--borde-color, #ddd);
    border-radius: 50%;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.scroll-arrow:hover {
    background: var(--color-primary);
    color: #fff;
}

.left-arrow {
    left: -16px;
}

.right-arrow {
    right: -16px;
}

/* Ocultar en dispositivos móviles y tablets pequeñas */
@media (max-width: 1024px) {
    .scroll-arrow {
        display: none !important;
    }
}

/* --- FADE GRADIENT (MÁSCARA DE SCROLL) --- */
.horizontal-scroll-wrapper {
    -webkit-mask-image: linear-gradient(to right, black, black);
    mask-image: linear-gradient(to right, black, black);
}

.horizontal-scroll-wrapper.is-scrollable-left.is-scrollable-right {
    -webkit-mask-image: linear-gradient(to right, transparent, black 30px, black calc(100% - 30px), transparent);
    mask-image: linear-gradient(to right, transparent, black 30px, black calc(100% - 30px), transparent);
}

.horizontal-scroll-wrapper.is-scrollable-left:not(.is-scrollable-right) {
    -webkit-mask-image: linear-gradient(to right, transparent, black 30px);
    mask-image: linear-gradient(to right, transparent, black 30px);
}

.horizontal-scroll-wrapper.is-scrollable-right:not(.is-scrollable-left) {
    -webkit-mask-image: linear-gradient(to left, transparent, black 30px);
    mask-image: linear-gradient(to left, transparent, black 30px);
}

/* --- SKELETON LOADER PARA GRUPOS --- */
@keyframes skeleton-pulse {
    0% {
        background-color: rgba(0, 0, 0, 0.05);
    }

    50% {
        background-color: rgba(0, 0, 0, 0.15);
    }

    100% {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

@keyframes skeleton-pulse-dark {
    0% {
        background-color: rgba(255, 255, 255, 0.05);
    }

    50% {
        background-color: rgba(255, 255, 255, 0.12);
    }

    100% {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

.skeleton-chip {
    flex: 0 0 auto !important;
    height: 42px;
    border-radius: 25px !important;
    background-color: rgba(0, 0, 0, 0.1);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
    border: 1px solid transparent !important;
}

.dark-mode .skeleton-chip {
    animation: skeleton-pulse-dark 1.5s infinite ease-in-out;
}

/* --- SKELETON GENÉRICO PARA PRODUCTOS --- */
.skeleton-box {
    background-color: rgba(0, 0, 0, 0.08);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

.dark-mode .skeleton-box {
    animation: skeleton-pulse-dark 1.5s infinite ease-in-out;
}

/* --- FULL-WIDTH EN PANTALLAS GRANDES --- */
@media (min-width: 1440px) {
    .footer-container {
        max-width: none;
        padding: 0 40px 40px;
    }
}

/* --- AJUSTES DE GRILLA Y PRODUCTOS (RESPONSIVE) --- */

/* Forzar 2 columnas en móviles con un espaciado adecuado */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 10px;
}

/* Adaptación progresiva para pantallas más grandes (Tablets y PC) */
@media (min-width: 768px) {
    .productos-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        padding: 20px;
    }
}

@media (min-width: 1024px) {
    .productos-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Evitar deformación de las tarjetas y hacerlas uniformes */
.producto-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* --- MEJORAS PROFESIONALES DE FICHA DE PRODUCTO (SOLO PC) --- */
@media (min-width: 1024px) {
    .producto-card {
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease;
        border-radius: 12px;
        background: var(--color-card, #ffffff);
        overflow: hidden;
        /* Evita que la imagen se salga al hacer zoom */
        will-change: transform;
    }

    .producto-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
        border-color: var(--color-primary, #1E3A8A);
        z-index: 2;
        /* Lo eleva sobre otras tarjetas */
    }

    /* Ajuste de sombra y borde para el Modo Oscuro */
    body.dark-mode .producto-card:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
        border-color: #60A5FA;
    }

    /* Efecto Zoom sutil en la imagen */
    .producto-card .product-img-container img {
        transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
        cursor: zoom-in;
    }

    .producto-card:hover .product-img-container img {
        transform: scale(1.08);
    }

    /* Ocultar el corazón hasta que se haga hover (salvo que ya sea favorito) */
    .producto-card .btn-fav:not(.active) {
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.3s ease;
    }

    .producto-card:hover .btn-fav {
        opacity: 1;
        transform: scale(1);
    }

    /* Resaltar dinámicamente el botón de agregar al carrito */
    .producto-card .btn-add-cart {
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .producto-card:hover .btn-add-cart {
        background-color: var(--color-primary, #1E3A8A);
        color: #ffffff;
        transform: scale(1.1);
    }

    body.dark-mode .producto-card:hover .btn-add-cart {
        background-color: #60A5FA;
        color: #0B132B;
    }
}

/* Aspecto de imagen cuadrado estricto para que se adapte sin deformarse */
.product-img-container {
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: auto !important;
    width: 100%;
}

/* Truncar textos de productos largos a un máximo de 2 líneas */
.producto-titulo {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    height: 34px !important;
    /* Alineación perfecta si un texto ocupa 1 línea y el del lado 2 líneas */
    margin-bottom: 4px !important;
    word-break: break-word !important;
}

/* --- AJUSTES PARA COMPACTAR HEADER EN MÓVIL --- */
@media (max-width: 767px) {

    /* Forzar al contenedor principal a no saltar de línea para que todo quepa en una fila */
    .header-main-container {
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding: 5px 12px !important;
        height: auto !important;
        min-height: 56px;
    }

    /* Ocultar el texto "Gran Catador" en móvil para dar espacio al buscador */
    .header-left .brand-text {
        display: none !important;
    }

    /* Hacer que el buscador ocupe el espacio sobrante y se ubique en el medio */
    .header-center {
        flex: 1 1 auto !important;
        order: 2 !important;
        margin: 0 !important;
        min-width: 0;
    }

    .header-right {
        order: 3 !important;
        gap: 8px !important;
    }

    /* Efectos full-bleed para scroll horizontal nativo en móvil */
    .horizontal-filters,
    #contenedorCategorias,
    #contenedorSubcategorias {
        margin: 0 -12px !important;
        padding: 5px 12px !important;
        width: auto !important;
    }
}

/* --- BOTÓN CARGAR MÁS PRODUCTOS VISIBLE --- */
.btn-cargar-mas {
    display: block;
    width: calc(100% - 40px);
    max-width: 350px;
    margin: 30px auto;
    padding: 14px 20px;
    background-color: var(--color-primary, #1E3A8A);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.25);
    transition: all 0.3s ease;
}

.btn-cargar-mas:active {
    transform: scale(0.95);
}

.btn-cargar-mas:hover {
    background-color: var(--color-accent, #F59E0B);
    color: #000000;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

/* --- LOADER DE BOTELLA MEJORADO --- */
.loader-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 400px;
}

/* Ocultar el spinner viejo si aún existe en el CSS */
.spinner {
    display: none !important;
}

.loader-container p {
    font-size: 13px !important;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-top: 25px;
    letter-spacing: 0.5px;
}

/* --- BOTÓN SCROLL HACIA ARRIBA --- */
.btn-scroll-top {
    position: fixed;
    bottom: 80px;
    /* Espacio para que no choque con el bottom-nav en móviles */
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--color-primary, #1E3A8A);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- BUSCADOR: LISTA FLOTANTE DE SUGERENCIAS --- */
.search-pill {
    position: relative;
}

#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-card, #ffffff);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: 350px;
    overflow-y: auto;
    z-index: 3000;
    display: none;
}

body.dark-mode #search-suggestions {
    background: #121E3F;
    border-color: #1E293B;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* --- LIGHTBOX UNIFICADO (Ficha de Producto) --- */
#image-lightbox-gc {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background-color: rgba(11, 19, 43, 0.92);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    cursor: zoom-out;
}

#lightbox-container-gc {
    width: 100%;
    max-width: 850px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-card-gc {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: var(--color-card, #ffffff);
    cursor: default;
}

#lightbox-img-wrapper-gc {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
}

#lightbox-img-gc {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#lightbox-info-panel-gc {
    flex: 1;
    max-width: 380px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#lightbox-close-btn-gc {
    position: absolute;
    top: 20px;
    right: 25px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 10000;
}

#lightbox-close-btn-gc:hover {
    background: rgba(239, 68, 68, 0.9);
}

/* --- LIGHTBOX RESPONSIVE (MÓVIL Y TABLET) --- */
@media (max-width: 992px) {
    #image-lightbox-gc {
        padding: 15px;
    }

    #lightbox-card-gc {
        flex-direction: column;
        max-height: 92vh;
        overflow-y: auto;
    }

    #lightbox-img-wrapper-gc {
        padding: 20px;
        height: 35vh;
        flex: none;
    }

    #lightbox-img-gc {
        max-height: 100%;
    }

    #lightbox-info-panel-gc {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        flex: none;
    }

    #lightbox-close-btn-gc {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}