/* ============================
   RESET BÁSICO
============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  background: #0e0f14;
  color: #fdfdfd;
}

/* WRAPPER TIPO APP MOBILE (centra en pantallas grandes) */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top left, #ff0055 0, #1b1c22 40%, #05060a 100%);
  position: relative;
  padding-bottom: 64px; /* espacio para bottom nav */
}

/* ============================
   NAVBAR SUPERIOR
============================ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(5, 5, 10, 0.88), rgba(5, 5, 10, 0.4));
  position: sticky;
  top: 0;
  z-index: 20;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  font-size: 1.2rem;
}

.logo-text {
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 1.05rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fdfdfd;
  position: relative;
}

.icon-btn:active {
  transform: scale(0.96);
}

/* BADGE CARRITO */
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff0055;
  color: white;
  font-size: 0.65rem;
  border-radius: 999px;
  padding: 2px 4px;
  min-width: 16px;
  text-align: center;
}

/* ============================
   PANEL SUPERIOR: DIRECCION + BUSQUEDA
============================ */
.top-panel {
  padding: 8px 14px 4px;
}

.address-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.address-label {
  font-size: 0.75rem;
  opacity: 0.75;
}

.address-value {
  border: none;
  background: none;
  color: #ffdede;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.address-value::after {
  content: "✏️";
  font-size: 0.7rem;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(7, 7, 12, 0.9);
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.search-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #fdfdfd;
  font-size: 0.9rem;
}

/* ============================
   CATEGORÍAS
============================ */
.categories-section {
  padding: 4px 0 0;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 14px 4px;
  margin: 8px 0 4px;
  opacity: 0.9;
}

.categories-scroll {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
  overflow-x: auto;
}

.categories-scroll::-webkit-scrollbar {
  height: 0;
}

.category-chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(14, 15, 20, 0.9);
  color: #fdfdfd;
  cursor: pointer;
  white-space: nowrap;
}

.category-chip--active {
  background: #ff0055;
  border-color: #ff0055;
}

/* ============================
   PRODUCTOS
============================ */
.products-section {
  padding: 4px 14px 80px; /* bottom extra por nav */
}

.products-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(7, 7, 12, 0.92);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.product-image-wrapper {
  flex: 0 0 92px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.product-image-wrapper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-promo-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(255, 0, 85, 0.92);
  color: #fff;
  font-size: 0.65rem;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 600;
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.product-restaurant {
  font-size: 0.75rem;
  opacity: 0.8;
}

.product-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  opacity: 0.85;
}

.product-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.product-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 0.9rem;
  font-weight: 600;
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* BOTÓN PRIMARIO */
.primary-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: #ff0055;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:active {
  transform: scale(0.97);
}

/* BOTÓN +/- CANTIDAD */
.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 6px;
}

.qty-btn {
  border: none;
  background: transparent;
  color: #fff;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qty-value {
  min-width: 18px;
  text-align: center;
  font-size: 0.8rem;
}

/* ============================
   FAB CARRITO (MOBILE)
============================ */
.fab-cart {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 72px;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #ff0055;
  color: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  z-index: 30;
}

.fab-cart-text {
  font-size: 0.85rem;
  font-weight: 600;
}

.fab-cart-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Ocultar si carrito vacío (se maneja con JS, pero por defecto off) */
.fab-cart--hidden {
  display: none;
}

/* ============================
   NAVBAR INFERIOR
============================ */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  padding: 6px 10px env(safe-area-inset-bottom);
  background: rgba(5, 5, 10, 0.98);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 25;
}

.bottom-nav-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #aaa;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0;
  cursor: pointer;
}

.bottom-nav-btn span.material-symbols {
  font-size: 1.2rem;
}

.bottom-nav-btn--active {
  color: #ff0055;
}

/* ============================
   CARRITO LATERAL + OVERLAY
============================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 40;
}

.overlay--visible {
  opacity: 1;
  pointer-events: all;
}

.cart-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: #090a10;
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.cart-drawer--open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-header h2 {
  margin: 0;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(16, 16, 24, 0.96);
}

.cart-item-img {
  flex: 0 0 56px;
  border-radius: 10px;
  overflow: hidden;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
}

.cart-item-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.cart-item-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.8rem;
}

.cart-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 4px;
}

.cart-note {
  font-size: 0.68rem;
  opacity: 0.6;
  margin: 0;
}

/* ============================
   TOAST
============================ */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  bottom: 80px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 60;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================
   RESPONSIVE DESKTOP
============================ */
@media (min-width: 768px) {
  .products-grid {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .product-card {
    width: calc(50% - 8px);
    flex-direction: column;
  }

  .product-image-wrapper {
    width: 100%;
    height: 160px;
  }
}
