/* ============================================================
   Comida Delivery — diseño con color, estilo app de delivery
   ============================================================ */
:root {
  --bg: #fff7f1;
  --surface: #ffffff;
  --surface-2: #fff3ea;
  --border: #f0e6dc;
  --border-2: #e7dccf;
  --text: #20140d;
  --muted: #8a7c70;
  --faint: #b6a99c;

  --accent: #f4511e;
  --accent-2: #ff7a3c;
  --accent-3: #ffb056;
  --accent-soft: #fff0e7;
  --accent-dark: #d63b0f;

  --wa: #25d366;
  --wa-dark: #128c4b;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --danger: #e11d48;
  --danger-soft: #ffe4e9;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(99, 52, 24, 0.06);
  --shadow: 0 6px 18px rgba(99, 52, 24, 0.10);
  --shadow-lg: 0 18px 48px rgba(99, 52, 24, 0.20);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { letter-spacing: -0.02em; }
h2 { font-size: clamp(20px, 4vw, 26px); }

/* ---------- Header con color ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(110deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent-3) 130%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 28px);
  box-shadow: 0 4px 18px rgba(244, 81, 30, 0.28);
}
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand strong {
  font-size: clamp(18px, 3.4vw, 21px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand strong::before { content: "🍔 "; }
.brand span { font-size: 12.5px; opacity: 0.92; }
.topbar .btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.3); }

.container { max-width: 980px; margin: 0 auto; padding: clamp(16px, 4vw, 28px); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(120deg, #fff1e7, #ffe2cf);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 34px);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "🍕🍣🌮";
  position: absolute;
  right: 14px; bottom: -6px;
  font-size: clamp(38px, 10vw, 64px);
  opacity: 0.18;
  letter-spacing: -8px;
}
.hero h1 { margin: 0 0 6px; font-size: clamp(22px, 5vw, 32px); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 80%; }

/* ---------- Tarjetas de restaurantes ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: fade-up 0.45s var(--ease) both;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card:active { transform: translateY(-1px); }
.card.closed .card-thumb { filter: grayscale(0.55) brightness(0.96); }

.card-thumb {
  position: relative;
  height: 156px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 46px; overflow: hidden;
}
.card-thumb::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent 50%);
  z-index: 1;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.card:hover .card-thumb img { transform: scale(1.08); }
.card-thumb .badge { position: absolute; top: 11px; right: 11px; z-index: 2; box-shadow: var(--shadow-sm); }

.card-body { padding: 15px 16px 17px; }
.card-body h3 { margin: 0 0 4px; font-size: 17.5px; }
.card-body p {
  margin: 0 0 9px; font-size: 13.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hours { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.open { background: #fff; color: var(--ok); }
.badge.open::before { background: var(--ok); animation: pulse 1.8s infinite; }
.badge.closed { background: #fff; color: var(--danger); }

/* ---------- Encabezado del menú ---------- */
.menu-head { margin-bottom: 14px; }
.menu-head h2 { margin: 0 0 6px; display: inline-block; margin-right: 10px; }
.menu-head .badge { vertical-align: middle; }
.menu-head p { margin: 6px 0 0; font-size: 13.5px; }

/* ---------- Menú ---------- */
.menu-cat {
  margin: 26px 0 12px; font-size: 12.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent);
}
.menu-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px; margin-bottom: 12px;
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
  animation: fade-up 0.4s var(--ease) both;
}
.menu-item:hover { box-shadow: var(--shadow); border-color: var(--accent-3); transform: translateY(-2px); }
.menu-item .item-thumb {
  width: 86px; height: 86px; object-fit: cover; border-radius: var(--radius-sm);
  flex-shrink: 0; background: var(--surface-2);
}
.menu-item .info { flex: 1; min-width: 0; }
.menu-item h4 { margin: 0 0 3px; font-size: 16px; }
.menu-item .desc { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.customize-hint {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; margin-bottom: 6px;
}
.menu-item .price { font-weight: 800; font-size: 16px; color: var(--text); }

/* ---------- Botones ---------- */
.btn {
  font: inherit; font-weight: 700; border: none; cursor: pointer;
  border-radius: var(--radius-sm); padding: 11px 18px;
  transition: transform 0.12s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; box-shadow: 0 8px 20px rgba(244, 81, 30, 0.32);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(244, 81, 30, 0.45); }
.btn-wa { background: linear-gradient(135deg, var(--wa), var(--wa-dark)); box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35); }
.btn-wa::before { content: "🟢 "; }
.btn-wa:hover { box-shadow: 0 10px 26px rgba(37, 211, 102, 0.5); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #ffd0da; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.add-btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; border: none; border-radius: 50%;
  width: 42px; height: 42px; font-size: 24px; line-height: 1; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(244, 81, 30, 0.32);
  transition: transform 0.15s var(--ease), box-shadow 0.18s var(--ease);
}
.add-btn:hover { transform: scale(1.12) rotate(90deg); }
.add-btn:active { transform: scale(0.9); }

/* ---------- Carrito flotante (CTA) ---------- */
.cart-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 30;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; border: none; border-radius: 999px;
  padding: 15px 24px; font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 0 12px 30px rgba(244, 81, 30, 0.5);
  display: inline-flex; align-items: center; gap: 10px;
  animation: fab-in 0.35s var(--ease) both; transition: transform 0.15s var(--ease);
}
.cart-fab:hover { transform: translateY(-2px) scale(1.03); }
.cart-fab:active { transform: scale(0.97); }
.cart-fab[hidden] { display: none; }
.cart-fab .count { background: rgba(255,255,255,0.28); border-radius: 999px; padding: 1px 10px; font-size: 13px; }

/* ---------- Overlay / Drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(32, 20, 13, 0.5);
  z-index: 40; display: flex; justify-content: flex-end;
  animation: fade-in 0.2s ease both;
}
.overlay[hidden] { display: none; }
.drawer {
  background: var(--surface); width: 100%; max-width: 440px; height: 100%;
  display: flex; flex-direction: column; padding: 22px; overflow-y: auto;
  animation: slide-in 0.32s var(--ease) both;
}
.drawer header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-shrink: 0; }
.drawer header h2 { margin: 0; font-size: 20px; }
.close-x {
  background: var(--surface-2); border: 1px solid var(--border); width: 36px; height: 36px;
  border-radius: 50%; font-size: 21px; line-height: 1; cursor: pointer; color: var(--muted);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.close-x:hover { background: var(--danger-soft); color: var(--danger); }

/* Drawer del carrito: lista con scroll + totales fijos */
.cart-drawer { overflow: hidden; }
.cart-drawer #cart-lines { flex: 1 1 auto; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }

.cart-line {
  display: flex; gap: 12px; align-items: flex-start;
  border-bottom: 1px solid var(--border); padding: 14px 0;
  animation: fade-up 0.3s var(--ease) both;
}
.cart-line .line-thumb { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.cart-line .line-main { flex: 1; min-width: 0; }
.cart-line .top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.cart-line .line-price { font-weight: 800; white-space: nowrap; }
.cart-line .line-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.cart-line .line-tag {
  font-size: 11.5px; color: var(--accent-dark); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px;
}
.cart-line .line-note { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 4px; }
.cart-line .qty { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cart-line .qty button {
  width: 30px; height: 30px; border: 1px solid var(--border-2); background: var(--surface);
  border-radius: 8px; cursor: pointer; font-size: 17px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.cart-line .qty button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cart-line .line-del {
  margin-left: auto; background: none; border: none; color: var(--danger);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.cart-line .line-del:hover { text-decoration: underline; }

.totals { flex-shrink: 0; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px; }
.totals .row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.totals .row.total { font-size: 21px; font-weight: 800; margin: 10px 0 4px; }
.sched { margin-bottom: 12px; }
.sched > label { margin: 0 0 6px; }
.schedopt {
  display: flex; align-items: center; gap: 9px; font-weight: 500; margin: 6px 0;
  padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.schedopt:hover { border-color: var(--accent); background: var(--accent-soft); }
.schedopt input { width: auto; }

/* ---------- Modal de personalización ---------- */
.item-hero { width: 100%; height: 180px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px; }
.ing-list { display: flex; flex-direction: column; gap: 8px; }
.ing-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.ing-row:hover { border-color: var(--accent-3); background: var(--surface-2); }
.ing-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.ing-row .ing-name { flex: 1; display: flex; flex-direction: column; line-height: 1.25; font-weight: 600; }
.ing-row .ing-name small { font-size: 11px; color: var(--faint); font-weight: 500; }
.ing-row .ing-extra { font-weight: 800; color: var(--accent); white-space: nowrap; }

.modal-footer {
  position: sticky; bottom: -22px; background: var(--surface);
  display: flex; gap: 12px; align-items: center; margin-top: 18px;
  padding: 14px 0 4px; border-top: 1px solid var(--border);
}
.qty-stepper { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 4px; }
.qty-stepper button {
  width: 34px; height: 34px; border: none; background: var(--surface-2); border-radius: 8px;
  font-size: 19px; cursor: pointer; color: var(--accent); font-weight: 700;
  transition: background 0.15s var(--ease);
}
.qty-stepper button:hover { background: var(--accent-soft); }
.qty-stepper span { min-width: 26px; text-align: center; font-weight: 700; }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 13px 0 5px; }
input, textarea, select {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 64px; }
.row-2 { display: flex; gap: 12px; }
.row-2 > div { flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 15px; line-height: 2; }
.muted { color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 999px;
  z-index: 60; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease) both;
}

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-nav button.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(244, 81, 30, 0.3);
}
.list-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 11px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  animation: fade-up 0.35s var(--ease) both; transition: box-shadow 0.2s var(--ease);
}
.list-row:hover { box-shadow: var(--shadow); }
.list-row .actions { display: flex; gap: 6px; flex-shrink: 0; }
.login-box { max-width: 360px; margin: 76px auto; }
.card.login-box, .login-box.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tag { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tag.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.off { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Editor de ingredientes (admin) */
.ing-edit-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ing-edit-row .ing-name { flex: 1; margin: 0; }
.ing-edit-row .ing-extra { width: 92px; margin: 0; }
.ing-edit-row .ing-inc { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; margin: 0; white-space: nowrap; }
.ing-edit-row .ing-inc input { width: auto; }
.ing-edit-row .ing-del {
  background: var(--danger-soft); color: var(--danger); border: none; border-radius: 8px;
  width: 34px; height: 36px; cursor: pointer; font-size: 14px; flex-shrink: 0;
}

/* ---------- Animaciones ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fab-in { from { opacity: 0; transform: translateY(20px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21,128,61,0.5); } 70% { box-shadow: 0 0 0 6px rgba(21,128,61,0); } 100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); } }

.card:nth-child(2), .menu-item:nth-child(2), .list-row:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3), .menu-item:nth-child(3), .list-row:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4), .menu-item:nth-child(4), .list-row:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5), .menu-item:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(6), .menu-item:nth-child(6) { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Responsivo ---------- */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card-thumb { height: 172px; }
  .hero p { max-width: 100%; }
  .menu-item { padding: 12px; gap: 12px; }
  .menu-item .item-thumb { width: 70px; height: 70px; }
  .drawer { max-width: 100%; padding: 18px; }
  .cart-fab { left: 16px; right: 16px; bottom: 16px; justify-content: center; }
  .modal-footer { bottom: -18px; }
}
