/* ======================================================
     BASE STYLES (Frontend)

     Propósito:
     - Aquí van los estilos base que definen la estructura y
         componentes reutilizables del frontend público: reset,
         navbar (frontend), layout, footer, botones comunes y
         utilidades compartidas por varias vistas.

     Uso:
     - Debe cargarse DESPUÉS de `tokens.css` en todas las vistas
         públicas para que las variables estén disponibles.

     Recomendaciones para editores:
     - Mantener reglas generales y componentes que sean agnósticos
         a la vista. Evitar introducir estilos exclusivos del
         backoffice (usar `public/css/admin/` para eso).
     - Documentar secciones (ya marcadas con separadores) y agrupar
         por vista cuando los estilos sean específicos.
====================================================== */

/* =================================== RESET =================================== */
 * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
}
 html {
     scroll-behavior: smooth;
}
 body {
     font-family: var(--font-family);
     background: linear-gradient( 180deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100% );
     color: var(--text-dark);
}
/* Bootstrap cards en tema oscuro (solo vistas públicas cargan base.css) */
 .card {
     background: var(--light-bg);
     color: var(--text-dark);
     border-color: var(--border-color);
}
/* Textos secundarios legibles sobre el tema oscuro */
 .text-muted {
     color: var(--text-light) !important;
}
/* =================================== NAVBAR =================================== */
 .navbar-custom {
     background: linear-gradient( 180deg, rgba(10,10,12,.92), rgba(20,18,22,.92) );
     border-bottom: 1px solid var(--border-color);
     box-shadow: 0 6px 18px rgba(0,0,0,.6);
     padding: .5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
     width: 100%;
}
/* LOGO */
 .navbar-brand {
     font-family: var(--font-heading);
     color: var(--primary-color) !important;
     font-size: var(--font-size-xxl);
     text-decoration: none;
}
 .navbar-logo-container {
     width: var(--logo-size);
     height: var(--logo-size);
     border-radius: 50%;
     overflow: hidden;
     display: flex;
     align-items: center;
     justify-content: center;
}
 .navbar-logo {
     width: 100%;
     height: 100%;
     object-fit: cover;
     transform: scale(var(--logo-zoom));
}
/* NAV LINKS */
 .navbar-nav .nav-link {
     color: var(--text-dark) !important;
     font-weight: 600;
     transition: .2s ease;
}
 .navbar-nav .nav-link:hover {
     color: var(--primary-dark) !important;
}
/* =================================== TOGGLER =================================== */
 .navbar-toggler {
     border: none !important;
     background: transparent !important;
     width: 42px;
     height: 42px;
     display: flex;
     align-items: center;
     justify-content: center;
     box-shadow: none !important;
}
 .navbar-toggler:focus, .navbar-toggler:active {
     box-shadow: none !important;
}
 .navbar-toggler-icon {
     background-image: none !important;
     position: relative;
     width: 24px;
     height: 2px;
     background: var(--text-dark);
     transition: .25s ease;
 }
 .navbar-toggler-icon::before, .navbar-toggler-icon::after {
     content: '';
     position: absolute;
     left: 0;
     width: 24px;
     height: 2px;
     background: var(--text-dark);
     transition: .25s ease;
 }
 .navbar-toggler-icon::before {
     top: -7px;
}
 .navbar-toggler-icon::after {
     top: 7px;
}
 .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
     background: transparent;
}
 .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
     transform: rotate(45deg);
     top: 0;
}
 .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
     transform: rotate(-45deg);
     top: 0;
}
/* =================================== MEGA MENU DESKTOP =================================== */
 .mega-dropdown {
     position: relative;
}
 .mega-toggle {
     padding: 1rem;
}
 .mega-menu {
     position: absolute;
     top: 100%;
     right: 0;
     width: 900px;
     background: var(--light-bg);
     border-radius: 24px;
     padding: 1.5rem;
     box-shadow: 0 10px 30px rgba(0,0,0,.45);
     opacity: 0;
     visibility: hidden;
     transform: translateY(10px);
     transition: .25s ease;
     z-index: 999;
}
 .mega-dropdown:hover .mega-menu {
     opacity: 1;
     visibility: visible;
     transform: translateY(0);
}
 .mega-grid {
     display: grid;
     grid-template-columns: repeat(4,1fr);
     gap: 1rem;
}
/* =================================== CATEGORY CARDS =================================== */
 .category-nav-card {
     position: relative;
     display: block;
     height: 90px;
     border-radius: 20px;
     overflow: hidden;
     text-decoration: none;
     box-shadow: 0 6px 18px rgba(0,0,0,.10);
     transition: .3s ease;
}
 .category-nav-card img {
     width: 100%;
     height: 100%;
     object-fit: cover;
     transition: .4s ease;
}
 .category-nav-overlay {
     position: absolute;
     inset: 0;
     background: rgba(0,0,0,.28);
     display: flex;
     align-items: center;
     justify-content: center;
}
 .category-nav-overlay h6 {
     color: white;
     font-size: 1.1rem;
     font-weight: 700;
     margin: 0;
     text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
 .category-nav-card:hover {
     transform: translateY(-4px);
}
 .category-nav-card:hover img {
     transform: scale(1.06);
}
/* =================================== MOBILE CATEGORY GRID =================================== */
 .category-grid {
     display: none;
}
 @media (max-width: 991px) {
     .mega-menu {
         display: none !important;
    }
     .mega-dropdown {
         display: none !important;
    }
     .navbar-collapse.show .category-grid {
         display: grid !important;
         grid-template-columns: repeat(2,1fr);
         gap: 1rem;
         width: 100%;
         padding-top: 1rem;
    }
     .category-nav-card {
         height: 65px;
    }
     .category-nav-overlay h6 {
         font-size: 1rem;
    }
}
 @media (max-width: 480px) {
     .navbar-brand {
         font-size: 1.5rem;
    }
     .navbar-collapse.show .category-grid {
         gap: .75rem;
    }
     .category-nav-card {
         height: 55px;
    }
     .category-nav-overlay h6 {
         font-size: .95rem;
    }
}
/* =================================== MOBILE MENU LINKS =================================== */
/* Estilos para los botones del menú móvil (FAQ, Contacto, Categorías dinámicas) */
.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 0.75rem 0;
}
.mobile-menu-links .mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 12px;
    background: var(--light-bg);
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 700;
    box-shadow: var(--shadow-light);
}
.mobile-menu-links .mobile-menu-btn i {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--hero-bg-start), var(--hero-bg-end));
    color: var(--text-dark);
}
/* Cuando hay muchas categorías, permitir scroll dentro del colapsado */
.navbar-collapse .mobile-menu-links {
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* =================================== HERO =================================== */
 .hero-box {
     background: linear-gradient( 180deg, var(--hero-bg-start), var(--hero-bg-end) );
     margin: 1rem auto 2rem auto;
     max-width: 700px;
     border-radius: 24px;
     padding: 1.5rem;
     box-shadow: var(--shadow-light);
}
 .hero-box h1 {
     font-family: var(--font-heading);
     font-size: 2.5rem;
     color: var(--primary-color);
     margin: 0;
 }
/* =================================== FILTERS =================================== */
 .filters-section {
     background: var(--light-bg);
     padding: 1.2rem;
     border-radius: 20px;
     margin-bottom: 2rem;
     box-shadow: var(--shadow-light);
     position: relative;
     z-index: 3000;
 }
 .filters-section .form-select {
     border-radius: 12px;
     border: 1px solid var(--border-color);
}
/* =================================== PRODUCT CARDS =================================== */
 .product-card {
     height: 100%;
     border: 1px solid var(--border-color) !important;
     border-radius: 22px !important;
     overflow: hidden;
     background: var(--light-bg);
     box-shadow: var(--shadow-light);
     transition: .25s ease;
 }
 .product-card:hover {
     transform: translateY(-6px);
     box-shadow: var(--shadow-medium);
}
 .product-img {
     width: 100%;
     height: 240px;
     object-fit: cover;
}
 .product-card .card-body {
     padding: 1rem;
}
 .product-price {
     color: var(--primary-dark);
     font-size: 1.25rem;
     font-weight: 700;
     margin-bottom: .35rem;
}
 .product-title {
     color: var(--text-dark);
     font-size: .95rem;
     line-height: 1.4;
     margin: 0;
     min-height: 45px;
}
/* =================================== FOOTER =================================== */
 .footer-custom {
     margin-top: 4rem;
     padding: 2.5rem 0;
     background: linear-gradient( 180deg, rgba(11,11,13,.95), rgba(20,18,23,.95) );
     border-top: 1px solid var(--border-color);
 }
 .footer-logo {
     font-family: var(--font-heading);
     font-size: clamp(1.4rem, 3.6vw, 2.2rem);
     line-height: 1.25;
     word-break: break-word;
     color: var(--primary-color);
 }
 .footer-text, .footer-copy {
     color: var(--text-light);
     font-size: .9rem;
}
 .footer-socials {
     display: flex;
     justify-content: center;
     gap: 1rem;
}
 .footer-icon {
     width: 45px;
     height: 45px;
     border-radius: 50%;
     background: var(--light-bg);
     display: flex;
     align-items: center;
     justify-content: center;
     color: var(--primary-color);
     text-decoration: none;
     box-shadow: var(--shadow-light);
     transition: .25s ease;
 }
 .footer-icon:hover {
     background: var(--primary-color);
     color: white;
     transform: translateY(-4px);
}

/* BOTÓN SECUNDARIO PARA CARRITO: "Volver a la carta" */
.cart-secondary-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: .85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    color: var(--text-dark);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    margin-bottom: .75rem;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}
.cart-secondary-btn:hover{transform: translateY(-3px);background:var(--primary-color);color:var(--white)}

/* Acordeón FAQ: estilos simples para mantener look consistente */
.accordion-button {
    font-weight: 700;
    color: var(--text-dark);
    background: linear-gradient(90deg, var(--light-bg), var(--light-bg));
}
.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--hero-bg-start), var(--hero-bg-end));
    color: var(--text-dark);
}
.accordion-body{color:var(--text-light)}

/* FAQ: tarjetas informativas y bloque de stock */
.faq-stock-card {
    background: transparent;
}
.stock-option {
    display: flex;
    gap: 1rem;
    align-items: center;
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}
.stock-icon{
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--hero-bg-start), var(--hero-bg-end));
    color: var(--text-dark);
    font-size: 1.4rem;
    box-shadow: var(--shadow-light);
}

.faq-info-card{
    background: var(--light-bg);
    padding: 1.25rem;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.faq-info-header{
    display:flex;
    gap: .75rem;
    align-items:center;
    margin-bottom: .75rem;
}
.faq-info-icon{
    width:48px;
    height:48px;
    border-radius:12px;
    display:flex;
    align-items:center;
    justify-content:center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    box-shadow: var(--shadow-light);
}
.faq-info-title{font-weight:700;color:var(--text-dark)}
.faq-info-text{color:var(--text-light);margin-bottom:.75rem}
.faq-example-box{background:linear-gradient(180deg, var(--light-bg), var(--dark-bg));padding: .85rem;border-radius:12px;border:1px solid var(--border-color)}

/* ===================================
   CART BUTTON
=================================== */

.cart-btn {

    position: relative;

    display: flex;

    align-items: center;

    gap: .7rem;

    background: var(--light-bg);

    padding: .8rem 1.1rem;

    border-radius: 999px;

    text-decoration: none;

    color: var(--text-dark);

    font-weight: 700;

    box-shadow: 0 4px 14px rgba(0,0,0,0.35);

    transition: all .25s ease;
}

.cart-btn:hover {

    transform: translateY(-2px);

    background: var(--dark-bg);

    color: var(--primary-color);
}

.cart-btn i {

    font-size: 1rem;
}

.cart-badge {

    min-width: 22px;

    height: 22px;

    padding: 0 .45rem;

    border-radius: 999px;

    background: #ff6b6b;

    color: white;

    font-size: .75rem;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 700;
}

/* ===================================
   MOBILE CART
=================================== */

.mobile-cart-btn {

    margin-top: 1rem;

    width: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: .7rem;

    background: var(--light-bg);

    padding: 1rem;

    border-radius: 18px;

    text-decoration: none;

    color: var(--text-dark);

    font-weight: 700;

    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* ===================================
   FLOATING WHATSAPP
=================================== */

.floating-whatsapp {

    position: fixed;

    right: 22px;

    bottom: 22px;

    width: 64px;

    height: 64px;

    border-radius: 50%;

    background: #25D366;

    color: white;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 2rem;

    text-decoration: none;

    z-index: 9999;

    box-shadow:
        0 10px 30px rgba(37,211,102,0.35);

    transition: all .25s ease;

    animation: whatsappPulse 2s infinite;

}

.floating-whatsapp:hover {

    transform: scale(1.08);

    color: white;

    box-shadow:
        0 14px 35px rgba(37,211,102,0.45);

}

@keyframes whatsappPulse {

    0% {

        box-shadow:

            0 0 0 0 rgba(37,211,102,0.45);

    }

    70% {

        box-shadow:

            0 0 0 18px rgba(37,211,102,0);

    }

    100% {

        box-shadow:

            0 0 0 0 rgba(37,211,102,0);

    }

}

/* ===================================
   FLOATING ORDER BUTTON (PILL)
=================================== */
.floating-order-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.45rem;
  border-radius: 999px;
  background: var(--dark-bg);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 1.08rem;
  text-decoration: none;
  box-shadow: var(--shadow-light);
  opacity: .55;                          /* estado vacío: apagado */
  transition: all .25s ease;
}
.floating-order-btn i { font-size: 1.2rem; }
.floating-order-btn .floating-order-text { white-space: nowrap; }
.floating-order-btn .floating-order-badge {
  min-width: 30px; height: 30px; padding: 0 .5rem;
  border-radius: 999px;
  background: var(--white); color: var(--dark-bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 800;
  transition: transform .2s ease;
}
/* Activo (hay productos): color de marca + glow + pulso del badge */
.floating-order-btn.is-active {
  background: linear-gradient(135deg, var(--general-color), var(--general-color-dark));
  color: var(--white);
  border-color: transparent;
  opacity: 1;
  box-shadow: 0 10px 30px rgba(0,0,0,.4), 0 0 0 4px rgba(0,0,0,.08);
}
.floating-order-btn.is-active:hover { transform: translateY(-2px); }
/* Animación constante: llama la atención del cliente (mobile-first) */
.floating-order-btn.is-active {
  animation: floatingBtnAttention 2.2s ease-in-out infinite;
}
@keyframes floatingBtnAttention {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 10px 30px rgba(0,0,0,.4), 0 0 0 4px rgba(0,0,0,.08);
  }
  50% {
    transform: translateY(-10px);
    box-shadow: 0 18px 40px rgba(0,0,0,.55), 0 0 0 9px rgba(0,0,0,.14);
  }
}
/* Pulso al cambiar cantidad */
.floating-order-btn.pulse .floating-order-badge { animation: badgePop .35s ease; }
@keyframes badgePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.7); }
  100% { transform: scale(1); }
}
/* Aparición fade+slide al agregar el primer producto */
.floating-order-btn.appear { animation: orderBtnIn .4s ease; }
@keyframes orderBtnIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 576px) {
  .floating-order-btn { right: 16px; bottom: 16px; padding: .85rem 1.15rem; }
  /* el texto SIEMPRE se muestra (pedido: que la gente quiera tocarlo) */
  .floating-order-btn .floating-order-text { display: inline; }
}

/* Estado vacío: visible pero NO clickeable */
.floating-order-btn.is-empty { pointer-events: none; cursor: default; }

/* ===================================
   TOPBAR ICON BUTTON
=================================== */
.topbar-icon-btn {
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--light-bg);
    color: var(--text-dark);
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    text-decoration: none;
    transition: transform .25s ease, background .25s ease, color .25s ease;
}
.topbar-icon-btn:hover { transform: translateY(-2px); color: var(--primary-color); }

/* ===================================
   FILTERS SECTION
=================================== */

.filters-section {

    background: rgba(11,11,13,0.9);

    backdrop-filter: blur(10px);

    padding: 1.5rem;

    border-radius: 24px;

    border: 1px solid var(--border-color);

    box-shadow:
        0 8px 24px rgba(0,0,0,0.35);

    margin-bottom: 2rem;

}

/* LABEL */

.filters-section .form-label {

    color: var(--text-dark);

    font-size: .95rem;

    margin-bottom: .55rem;

    letter-spacing: .2px;
}
/* ===================================
   CUSTOM FILTER DROPDOWN
=================================== */

.custom-filter-dropdown {

    position: relative;

    z-index: 3000;

}

/* BOTON */

.filter-dropdown-btn {

    width: 100%;

    height: 56px;

    border: 1px solid var(--border-color);

    border-radius: 18px;

    background:

        linear-gradient(

            180deg,

            var(--light-bg) 0%,

            var(--dark-bg) 100%

        );

    color: var(--text-dark);

    font-weight: 600;

    padding: 0 1.2rem;

    text-align: left;

    box-shadow:

        0 4px 14px rgba(0,0,0,.35);

    transition: all .25s ease;

}

/* HOVER */

.filter-dropdown-btn:hover {

    border-color: var(--primary-dark);

    transform: translateY(-1px);

}

/* FOCUS */

.filter-dropdown-btn:focus {

    border-color: var(--primary-dark);

    box-shadow:

        0 0 0 4px rgba(197,169,214,.18);

}

/* MENU */

.custom-dropdown-menu {

    width: 100%;

    margin-top: .7rem;

    border: none;

    border-radius: 22px;

    padding: .55rem;

    background: var(--light-bg);

    z-index: 3000 !important;

    box-shadow:

        0 14px 34px rgba(0,0,0,.5);

    overflow: hidden;

    animation: dropdownFade .18s ease;

}

/* ITEMS */

.custom-dropdown-menu .dropdown-item {

    border-radius: 16px;

    padding: .9rem 1rem;

    font-weight: 600;

    color: var(--text-dark);

    transition: all .2s ease;

}

/* HOVER ITEM */

.custom-dropdown-menu .dropdown-item:hover {

    background: var(--border-color);

    color: var(--primary-color);

    transform: translateX(2px);

}

/* ACTIVE */

.custom-dropdown-menu .dropdown-item.active {

    background:

        linear-gradient(

            135deg,

            var(--primary-color),

            var(--primary-dark)

        );

    color: white;

}

/* PRODUCT CARDS */

.product-card {

    overflow: visible !important;

    z-index: 1500;

}

/* CONTAINERS */

.container,
.row,
.col-lg-3,
.col-md-4 {

    overflow: visible !important;

}

/* ANIMATION */

@keyframes dropdownFade {

    from {

        opacity: 0;

        transform: translateY(8px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}

/* MOBILE */

@media(max-width: 768px) {

    .filters-section {

        padding: 1rem;

        border-radius: 20px;

    }

    .filter-dropdown-btn {

        height: 52px;

    }

}

/* ===================================
   TOPBAR OFFSET
=================================== */

.topbar-offset { padding-top: 6rem; }
@media (max-width: 576px) { .topbar-offset { padding-top: 7.5rem; } }

/* ===================================
   MODALES
   =================================== */

/* El topbar es position:fixed con z-index:10000, muy por encima del z-index
   por defecto de Bootstrap (modal 1055 / backdrop 1050). Por eso el topbar
   tapaba la parte superior de todos los modales, incluida la cruz de cerrar.
   Subimos modal y backdrop por encima del topbar para que nada los tape, y
   además los bajamos un poco del borde superior para que el header del modal
   (y su cruz) no queden pegados al topbar en pantallas bajas. */
.modal {
    z-index: 10050;
    padding-top: 4rem;
}
.modal-backdrop { z-index: 10040; }
@media (max-width: 576px) { .modal { padding-top: 5rem; } }

/* La cruz de cerrar siempre visible: los headers de los modales son oscuros
   (admin-theme.css fuerza fondo oscuro) y la .btn-close por defecto es oscura,
   así que quedaba invisible sobre ese fondo. La variante .btn-close-white ya
   trae el ícono claro, así que se excluye para no invertirla a negro. */
.modal-header .btn-close:not(.btn-close-white) {
    filter: invert(1) grayscale(100%);
    opacity: 1;
}

/* ===================================
   TIPOGRAFÍA PÚBLICA (Fase 6.2)
   Mejora la legibilidad sin alterar el layout existente.
=================================== */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: .1px;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-dark);
}
p, li, label, td, th, input, textarea, select, button {
  font-family: var(--font-family);
}
.tenant-hero-title,
.hero-title {
  letter-spacing: .5px;
}
.text-muted { color: var(--text-light) !important; opacity: .75; }

