/* ==========================
   DAL BAMBINO · MENÚ APP
   (Versión Definitiva: Fix Carrito Móvil + Modal Compacto)
========================== */

:root {
  --primary: #6B4F4B;
  --accent: #C79B61;
  --brand-blue: #6F8695;
  --header-blue: #8197A5;
  --bg-page: #FBF9F7;
  --ink: #2C2C2C;
  --muted: #666666;

  --radius-lg: 18px;
  --shadow-card: 0 14px 30px rgba(107,79,75,0.16);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  background:
    radial-gradient(circle at top, #f1e3d6 0, transparent 45%),
    radial-gradient(circle at bottom, #f7eee4 0, transparent 55%),
    var(--bg-page);
  display: flex;
  justify-content: center;
  padding: 20px 8px 40px;
  color: var(--ink);
}

.app-frame {
  width: 100%;
  max-width: 430px;
  background: #FFFFFF;
  border-radius: 26px;
  box-shadow: 0 26px 70px rgba(107,79,75,0.35);
  border: 1px solid rgba(255,255,255,0.85);
  overflow: visible; /* Permitir que elementos sticky funcionen */
}

/* 🔹 Sticky superior */
.app-header-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-blue);
  box-shadow: 0 18px 35px rgba(0,0,0,0.18);
  border-bottom-left-radius: 32px;
  border-bottom-right-radius: 32px;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  padding: 12px 16px 8px;
  background: var(--header-blue);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-mark img {
  display: block;
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.45));
}

/* ÁREA DE SESIÓN (LOGIN) */
#nav-auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#nav-auth a {
  text-decoration: none;
}

.auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-login-btn,
.auth-register-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.6);
  color: #ffffff;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.auth-register-btn {
  background: #ffffff;
  color: var(--primary);
  border-color: #ffffff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 18px;
  border-radius: 999px;
  background: rgba(199,155,97,0.32);
  border: 1px solid #C79B61;
  color: #ffffff;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  font-size: 0.85rem;
}

.auth-logout-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #ffffff;
}

/* BUSCADOR */
.search-wrap {
  background: var(--header-blue);
  padding: 10px 16px 14px;
}

.search-bar {
  background: #FBF9F7;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .9rem;
  outline: none;
}

/* CATEGORÍAS */
.categories-strip {
  padding: 10px 0;
  background: var(--header-blue);
  display: flex;
  align-items: center;
  position: relative;
  box-shadow: none !important;
}

.categories-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  background: transparent !important;
  box-shadow: none !important;
  padding-bottom: 5px; /* Espacio para el scroll si aparece */
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.cat-arrow {
  background: rgba(255,255,255,0.35);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 18px;
  border: none;
  display: none;
  cursor: pointer;
}

@media (min-width: 900px) {
  .cat-arrow { display: block; }
}

.cat-pill {
  padding: 8px 14px;
  background: #F3E6D9;
  border-radius: 999px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap; /* Evitar que el texto baje */
}

.cat-pill.active {
  background: var(--primary);
  color: #fff;
}

.content {
  background: var(--bg-page);
  padding: 12px 16px 20px;
}

.section-title {
  font-size: .75rem;
  color: #9A8676;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ==========================
   CARDS DE PLATOS
========================== */

.items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dish-card {
  display: flex;
  gap: 12px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(107,79,75,0.06);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.dish-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(107,79,75,0.25);
}

.dish-image {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  overflow: hidden;
  background: #6F8695;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dish-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-tag, .dish-category-label { display: none; }

.dish-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dish-top-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dish-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
}

.dish-desc {
  font-size: .78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dish-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dish-prices {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dish-price {
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary);
}

.dish-price-bs {
  font-size: .78rem;
  color: #9A8676;
}

.btn-add {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFF;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(199,155,97,0.55);
}

.empty-state {
  font-size: .8rem;
  color: var(--muted);
  padding: 20px 2px;
  text-align: center;
}

.app-footer {
  text-align: center;
  padding: 12px 16px 18px;
  font-size: .85rem;
  color: #AAA;
  background: #FBF9F7;
}

/* ==========================
   BOTÓN FLOTANTE CARRITO
========================== */
.fab-cart {
  position: fixed;
  bottom: 26px;
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 12px 32px rgba(107,79,75,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2002;
  transition: transform 0.2s;
}

.fab-cart:active { transform: scale(0.95); }

.fab-cart i { width: 22px; height: 22px; }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4d4f;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ==========================
   DRAWER DEL CARRITO (CORREGIDO PARA MÓVIL)
========================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
.drawer-overlay.active { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 86%;
  max-width: 420px;
  height: 100dvh; /* Altura dinámica para celulares */
  background: #fff;
  transform: translateX(100%);
  transition: transform .3s ease;
  z-index: 2001;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 50px rgba(0,0,0,0.15);
}
.drawer.active { transform: translateX(0); }

.drawer-header {
  padding: 22px 18px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  flex-shrink: 0;
}

.drawer-close { background: none; border: none; cursor: pointer; }

/* Cuerpo scrolleable */
.drawer-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
}

.cart-item {
  display: flex; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid #eee;
}

/* PIE DEL CARRITO (AQUÍ ESTÁ LA MAGIA) */
.drawer-footer {
  padding: 20px 20px 50px 20px; /* Más padding abajo para subir el botón */
  background: #fff; /* Fondo blanco para que no se trasluzca */
  border-top: 1px solid #eee;
  box-shadow: 0 -5px 15px rgba(0,0,0,0.08); /* Sombra hacia arriba para separar */
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.drawer-total-row {
  display: flex; justify-content: space-between;
  font-weight: 700; font-size: 1rem; margin-bottom: 15px; color: var(--primary);
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(107,79,75,0.25);
}

/* ==========================
   MODAL DE PRODUCTO
========================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2100;
  backdrop-filter: blur(3px);
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #fff;
  border-radius: 22px;
  max-width: 880px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.3fr 1.7fr;
  overflow: hidden; /* Importante para bordes */
  
  /* Sombra para profundidad */
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* COLUMNA DE IMAGEN */
.modal-img-col {
  position: relative;
  background: #000;
  height: 100%;
}

.modal-img-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.btn-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s;
}
.btn-close:hover { transform: scale(1.1); }

.btn-close i {
  color: #fff;
  width: 20px;
  height: 20px;
}

/* COLUMNA DE INFORMACIÓN */
.modal-info-col {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto; /* Scroll interno si es necesario */
  max-height: 80vh; /* Seguridad en escritorio */
}

.m-title {
  font-size: 1.5rem;
  font-family: "Playfair Display", serif;
  line-height: 1.1;
  color: var(--primary);
}

.m-desc {
  font-size: .95rem;
  color: var(--muted);
  line-height: 1.5;
}

.m-price-main {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.m-price-bs {
  font-size: .9rem;
  color: #9A8676;
}

.m-notes-area {
  margin-top: 10px;
}

.m-notes-area label {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

#m-notes {
  width: 100%;
  min-height: 70px;
  border-radius: 12px;
  border: 1px solid #ddd;
  padding: 10px;
  resize: none;
  font-family: inherit;
  font-size: 0.95rem;
}

/* ⬇️ ESTILOS MODAL COMPACTO ⬇️ */

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7f7f7;
    padding: 10px 15px;
    border-radius: 16px;
    margin-top: 10px;
    margin-bottom: 8px;
    border: 1px solid #eee;
}

.qty-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn-modal {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ccc;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.qty-display {
    font-size: 1.2rem;
    font-weight: 700;
    width: 25px;
    text-align: center;
}

.price-display {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.total-usd {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.total-bs {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
    font-weight: 600;
}

.btn-add-modal {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(199,155,97,0.55);
  font-size: 1rem;
  margin-top: 0;
}
.btn-add-modal:active { transform: scale(0.98); }


/* ==========================
   RESPONSIVE (SOLUCIÓN MÓVIL AL FINAL)
========================== */

@media (max-width: 768px) {
  body {
    padding: 0;
    background: var(--bg-page);
  }

  .app-frame {
    border-radius: 0;
    max-width: 100%;
    box-shadow: none;
    border: none;
    min-height: 100vh;
  }
  
  .items-list {
    display: flex;
    flex-direction: column;
  }

  /* MODAL: Imagen Arriba / Info Abajo */
  .modal-card {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    max-height: 85vh; /* Evita que se salga de pantalla */
    position: relative;
  }

  .modal-img-col {
    height: 180px; 
    flex-shrink: 0;
  }
  
  .btn-close {
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7); 
  }

  .modal-info-col {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .btn-add-modal {
    margin-top: auto;
  }
}

@media (min-width: 960px) {
  .app-frame {
    max-width: 1100px;
    border-radius: 24px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .content {
    padding: 24px 32px;
  }

  .items-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .dish-image {
    width: 120px;
    height: 120px;
  }

  .topbar,
  .search-wrap,
  .categories-strip {
    padding-left: 32px;
    padding-right: 32px;
  }
}