/* =============================
   CATALOGO (App Delivery PRO)
   - Estilo tipo UberEats/Rappi
   - Respeta variables en variables.css
   ============================= */

:root{
  /* Fallbacks si variables.css no define */
  --primary: var(--color-primary, #ff6600);
  --secondary: var(--color-secondary, #f50057);
  --bg: var(--color-bg, #f6f7fb);
  --text: var(--color-text, #111827);
  --muted: var(--color-muted, #6b7280);
  --card: #ffffff;
  --stroke: rgba(17,24,39,.10);
  --shadow: 0 18px 50px rgba(17,24,39,.10);
  --shadow-soft: 0 10px 28px rgba(17,24,39,.08);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

/* ===== Page bg ===== */
body{
  background-color: var(--bg);
   background-image:
    linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
    url("/images/fondo_blancov3.png");
  /*background-image: url("/images/fondo_blancov3.png");*/
  background-size: cover;
  background-size: 220px 220px;
  background-repeat: repeat;
  background-position: 0 0;
}

/* ===== Navbar (app topbar) ===== */
.navbar{
  position: sticky;
  top: 0;
  z-index: 1040;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(17,24,39,.06);
  box-shadow: 0 8px 26px rgba(17,24,39,.06);
}

.navbar .navbar-brand img{
  height: 52px;
  width: auto;
  transition: transform .25s ease, height .25s ease;
}

.navbar.scrolled .navbar-brand img{
  height: 40px;
  transform: translateY(-1px);
}

#selectedSucursalInfo{
  margin-top: 6px;
  padding: 0 4px 10px 4px;
}

#selectedSucursalInfo small{ color: var(--muted) !important; }

/* ===== Hero carousel ===== */
#heroCarousel{
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 8px !important;
}

.carousel-inner{
  border-radius: var(--radius-xl);
}

.hero-banner{
  min-height: 260px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.hero-banner::after{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(900px 260px at 15% 20%, rgba(0,0,0,.18) 0%, rgba(0,0,0,.32) 55%, rgba(0,0,0,.40) 100%),
    linear-gradient(180deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.45) 100%);
}

.hero-content{
  position: relative;
  z-index: 2;
  padding: 22px 26px;
  max-width: 680px;
}

.hero-content h1{
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 10px 30px rgba(0,0,0,.45);
  margin: 0 0 6px 0;
}

.hero-content p{
  font-weight: 600;
  opacity: .95;
  text-shadow: 0 10px 24px rgba(0,0,0,.40);
  margin: 0;
}

#heroCarousel .carousel-control-prev,
#heroCarousel .carousel-control-next{
  width: 10%;
}

#heroCarousel .carousel-control-prev-icon,
#heroCarousel .carousel-control-next-icon{
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.30));
  transform: scale(1.1);
}

/* ===== Category pills (sticky secondary bar) ===== */
:root{ --nav-h: 64px; } /* recalculado por JS */

/* El contenedor real es #stickyFilters (HTML). No debe dejar espacios arriba. */
#stickyFilters{
  position: sticky;
  top: var(--nav-h, 0px); /* se calcula como altura VISIBLE del navbar */
  z-index: 1035;
  margin: -14px 0 0 0;
  padding: 0;
}

/* Panel con blur tipo app, sin separar del borde superior */
#stickyFilters .category-sticky{
  padding: 10px 12px 8px 12px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,.65);
  border-bottom: 1px solid rgba(17,24,39,.08);
  box-shadow: 0 16px 38px rgba(15,23,42,.12);
  border-radius: 0 0 18px 18px; /* arriba recto para quedar flush */
}

#categoryPills{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 2px 8px 2px;
  scroll-snap-type: x mandatory;
}
#categoryPills::-webkit-scrollbar{ display:none; }

.category-pill{
  scroll-snap-align: start;
  position: relative;
  border: 1px solid rgba(17,24,39,.10);
  background: rgba(255,255,255,.95);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: .2px;
  box-shadow: 0 10px 22px rgba(17,24,39,.08);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  white-space: nowrap;
}

.category-pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(17,24,39,.12);
  border-color: rgba(17,24,39,.18);
}

.category-pill.active{
  border-color: rgba(255,102,0,.35);
  box-shadow: 0 18px 38px rgba(255,102,0,.18);
}

.category-pill.active::after{
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -6px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* ===== Search + toggle view row ===== */
#toggleViewBtn{
  border-radius: 999px !important;
  border: 1px solid rgba(17,24,39,.10) !important;
  background: rgba(255,255,255,.90) !important;
  box-shadow: 0 12px 26px rgba(17,24,39,.08) !important;
}

#toggleViewBtn:hover{ transform: translateY(-1px); }

.pro-input{
  border-radius: 999px !important;
  border: 2px solid rgba(255,102,0,.22);
  padding: 12px 44px 12px 16px;
  box-shadow: 0 10px 22px rgba(17,24,39,.06);
  transition: box-shadow .18s ease, border-color .18s ease;
}

.pro-input:focus{
  border-color: rgba(255,102,0,.55);
  box-shadow: 0 16px 34px rgba(255,102,0,.14);
}

.icon-right{
  position:absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,102,0,.95);
  opacity: .95;
}

/* ===== Product cards ===== */
.product-card{
  border: 1px solid rgba(17,24,39,.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.product-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255,102,0,.28);
}

.product-image-wrapper{
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f1f2f6;
}

.product-card .card-img-top{
  width: 100%;
  height: 240px;
  object-fit: cover;
  display:block;
  border-radius: 0;
}
.product-image-wrapper{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.product-image-wrapper img{
  max-width:90%;
  max-height:100%;
  object-fit:contain;
}

/* Badges */
.badge-preparado{
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .2px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(17,24,39,.10);
  box-shadow: 0 12px 22px rgba(17,24,39,.10);
  color: rgba(255,102,0,.95);
}

.badge-preparado .material-symbols-rounded{ font-size: 18px; }

.discount-badge{
  position:absolute;
  top: 12px;
  right: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .80rem;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color:#fff;
  box-shadow: 0 16px 30px rgba(245,0,87,.25);
}

.sin-stock-badge{
  position:absolute;
  bottom: 12px;
  left: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .78rem;
  background: rgba(17,24,39,.85);
  color:#fff;
  border: 1px solid rgba(255,255,255,.18);
}

.btn-detail{
  position:absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(17,24,39,.10);
  background: rgba(255,255,255,.92);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 14px 26px rgba(17,24,39,.10);
  transition: transform .18s ease, box-shadow .18s ease;
}

.btn-detail:hover{
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(17,24,39,.14);
}

.btn-detail .material-symbols-rounded{
  font-size: 22px;
  color: rgba(17,24,39,.78);
}

.product-card .card-body{
  padding: 14px 14px 16px 14px;
}

.product-card .card-title{
  font-weight: 900;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 6px;
}

.price-old{
  color: var(--muted);
  text-decoration: line-through;
  font-weight: 700;
  margin-right: 8px;
}

.price{
  color: var(--primary);
  font-weight: 900;
  font-size: 1.08rem;
}

/* Formatos (packs) */
.formatos-container{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:center;
}
.formato-opcion{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:.78rem;
  color:#1f2937;
  background:rgba(255,255,255,.9);
  border:1px solid rgba(17,24,39,.10);
  box-shadow:0 8px 16px rgba(17,24,39,.06);
}

/* Qty controls (app style) */
.qty-controls{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  margin-top: 10px;
}

.qty-controls button{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(17,24,39,.10);
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 20px rgba(17,24,39,.08);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  color: rgba(17,24,39,.86);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.qty-controls button:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(17,24,39,.12);
  border-color: rgba(255,102,0,.25);
}

.qty-controls .btn-increase{
  background: linear-gradient(135deg, rgba(255,102,0,.88) 0%, var(--primary) 100%);
  color: #fff;
  border-color: rgba(255,102,0,.55);
}

.qty-controls .qty{
  min-width: 28px;
  text-align:center;
  font-weight: 900;
  color: var(--text);
}

/* Out of stock card style */
.card-outofstock{
  opacity: .92;
  filter: grayscale(.10);
}

.card-outofstock .product-image-wrapper::before{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 70%, rgba(255,255,255,.75) 100%);
  z-index: 1;
  pointer-events: none;
}

.card-outofstock .card-img-top{ filter: grayscale(.35) contrast(.95); }
.card-outofstock .btn-detail{ z-index: 2; }
.btn-detail{
  z-index: 3;
}

/* ===== Cart bar (Uber-like) ===== */
.cart-bar{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, rgba(245,0,87,.35) 100%);
  color:#fff;
  box-shadow: 0 22px 60px rgba(255,102,0,.30);
  border: 1px solid rgba(255,255,255,.18);
  max-width: min(560px, calc(100vw - 36px));
}

.cart-bar.hide{ display:none; }
.cart-bar.show{ display:flex; }

#cartSummary{
  font-weight: 900;
  letter-spacing: -0.2px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.cart-bar .btn{
  border-radius: 999px;
  padding: 10px 14px;
  border: 0;
  background: rgba(255,255,255,.18);
  color:#fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0,0,0,.14);
}

.cart-bar .btn:hover{ background: rgba(255,255,255,.24); }

/* ===== Floating buttons ===== */
#btnCambiarTiendaIcono{
  position: fixed;
  right: 18px;
  bottom: 92px; /* arriba del cart bar */
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(17,24,39,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(17,24,39,.14);
  z-index: 1201;
  display:flex;
  align-items:center;
  justify-content:center;
}

#btnCambiarTiendaIcono .material-symbols-rounded{
  font-size: 26px;
  color: var(--primary);
}

.fab{
  position: fixed;
  right: 18px;
  bottom: 156px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(17,24,39,.10);
  box-shadow: 0 18px 46px rgba(17,24,39,.14);
  z-index: 1201;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  user-select:none;
  color: var(--primary);
  font-weight: 900;
}

/* ===== Product modal ===== */
#productModal .modal-content{
  border: 0;
  border-radius: var(--radius-xl);
  overflow:hidden;
  box-shadow: 0 22px 70px rgba(17,24,39,.18);
}

#productModal .modal-header{
  border: 0;
  background: rgba(246,247,251,.9);
}

#productModal #modalProductImage{
  border-radius: var(--radius-lg);
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #f1f2f6;
}

/* ===== Sucursal modal ===== */
#sucursalModal .modal-content{
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fc 100%);
  position: relative;
}

.suc-logo{
  max-height: 120px;
  width: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  animation: sucLogoPop 700ms ease forwards;
}
.suc-title{
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}
.suc-subtitle{
  font-size: .95rem;
  color: rgba(17,24,39,.65);
}

@keyframes sucLogoPop{
  0%{ transform: scale(1.15); opacity: 0; }
  70%{ transform: scale(1.02); opacity: 1; }
  100%{ transform: scale(1); }
}

.tienda-btn{
  border-radius: 18px !important;
  border: 1px solid rgba(17,24,39,.10) !important;
  background: rgba(255,255,255,.96) !important;
  box-shadow: 0 10px 24px rgba(17,24,39,.08) !important;
  padding: 16px 16px 16px 16px !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  text-align: left;
  position: relative;
}

.tienda-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(17,24,39,.14) !important;
  border-color: rgba(255,102,0,.25) !important;
}

.tienda-btn.active{
  border-color: rgba(255,102,0,.45) !important;
  box-shadow: 0 22px 60px rgba(255,102,0,.18) !important;
}
.tienda-btn::after{
  content: 'chevron_right';
  font-family: 'Material Symbols Rounded';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: rgba(17,24,39,.35);
}
.tienda-btn.active::after{
  color: var(--primary);
}
.tienda-btn strong{
  font-size: 1.05rem;
}
.tienda-btn small{
  display: block;
  color: rgba(17,24,39,.65);
}
.tienda-btn span.text-success,
.tienda-btn span.text-danger{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .85rem;
  background: rgba(16,185,129,.12);
}
.tienda-btn span.text-danger{
  background: rgba(239,68,68,.12);
}

@media (max-width: 576px){
  #sucursalModal .modal-dialog{
    margin: 0;
    max-width: 100%;
    height: 100%;
  }
  #sucursalModal .modal-content{
    border-radius: 24px 24px 0 0;
    min-height: 100%;
  }
  #sucursalModal .modal-header{
    padding: 22px 18px 10px;
  }
  #sucursalModal .modal-body{
    padding: 10px 18px 24px;
  }
  .suc-logo{ max-height: 120px; }
  .suc-title{ font-size: 1.2rem; }
  .suc-subtitle{ font-size: .9rem; }
  #sucursalModal .modal-content::before{
    content:'';
    position:absolute;
    top:10px;
    left:50%;
    transform: translateX(-50%);
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: rgba(17,24,39,.18);
  }
  .tienda-btn{
    padding: 14px 48px 14px 14px !important;
  }
}

/* Reduce bootstrap .row gutters for tighter app look */
#productsGrid{ margin-top: 6px; }

/* Utils */
.text-orange{ color: var(--primary) !important; }

/* Prevent overlap: body spacing handled by JS too */
@media (max-width: 576px){
  #btnCambiarTiendaIcono{ bottom: 98px; width: 52px; height: 52px; border-radius: 16px; }
  .fab{ bottom: 160px; }
}

/* Ocultar FABs mientras el modal de sucursal está abierto */
body.modal-open #toTop,
body.modal-open #btnCambiarTiendaIcono{
  display: none !important;
}

/* Mantener FABs por debajo de alerts/SweetAlert */
#toTop,
#btnCambiarTiendaIcono{
  z-index: 900;
}
