/* ============================================================
   MenuDash — variables y reset
   ============================================================ */
:root {
  --accent: #d35400;
  --accent-dark: #a84200;
  --accent-on-dark: #e08b3e;
  --cream: #fdf8f0;
  --cream-2: #f7ede0;
  --ink: #2b2320;
  --ink-soft: #6b5f57;
  --line: #ecdfd0;
  --white: #ffffff;
  --success: #2e7d32;
  --danger: #c0392b;
  --warn: #b8860b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 18px rgba(43,35,32,.08);
  --shadow-lg: 0 12px 32px rgba(43,35,32,.14);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .4em; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flashes { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; width: 92%; max-width: 420px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: .92rem; font-weight: 500; }
.flash-success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }
.flash-error { background: #fdecea; color: var(--danger); border: 1px solid #f5b7b1; }
.flash-action { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: .82rem; font-weight: 700; }
.flash-action:hover { background: var(--accent-dark); }

/* ============================================================
   STOREFRONT — header / hero
   ============================================================ */
.sf-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.sf-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; max-width: 1080px; margin: 0 auto; }
.sf-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.sf-brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.sf-brand .logo-fallback { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.sf-header-actions { display: flex; align-items: center; gap: 10px; }
.sf-cart-btn { position: relative; background: var(--accent); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; }
.sf-cart-btn .badge { background: #fff; color: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: .8rem; font-weight: 700; }
.sf-wa-btn { background: #25d366; color: #fff; border-radius: 50%; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center; }

.sf-hero { position: relative; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff;
  padding: 42px 20px 34px; text-align: center; background-size: cover; background-position: center; }
.sf-hero.has-cover { background-blend-mode: multiply; }
.sf-hero h1 { font-size: 2rem; margin-bottom: 6px; }
.sf-hero p { opacity: .92; max-width: 520px; margin: 0 auto; font-size: .96rem; }

/* ============================================================
   STOREFRONT — nav de categorías
   ============================================================ */
.cat-nav { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 65px;
  z-index: 40; box-shadow: 0 2px 10px rgba(43,35,32,.05); }
.cat-nav-inner { display: flex; gap: 6px; overflow-x: auto; padding: 0 20px; max-width: 1080px; margin: 0 auto;
  scrollbar-width: none; }
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav-inner a { flex: 0 0 auto; padding: 15px 16px 13px; font-weight: 700; font-size: .74rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; border-bottom: 2px solid transparent; }
.cat-nav-inner a:hover { color: var(--accent); }
.cat-nav-inner a.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.icon-svg { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }

/* ============================================================
   STOREFRONT — grilla de platillos
   ============================================================ */
.menu-section { padding: 30px 20px 8px; max-width: 1080px; margin: 0 auto; }
.menu-section h2 { font-size: 1.4rem; border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 4px; margin-bottom: 18px; }
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 10px; }
.dish-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.dish-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dish-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--cream-2); }
.dish-photo-fallback { width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; background: linear-gradient(135deg, var(--cream-2), #ecd9c0); color: var(--accent); }
.dish-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.dish-name { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; }
.dish-desc { font-size: .85rem; color: var(--ink-soft); flex: 1; }
.dish-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.dish-price { font-weight: 700; color: var(--accent-dark); font-size: 1.05rem; }
.dish-badge-off { background: #eee; color: #666; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.dish-card.agotado { opacity: .55; }
.dish-card.agotado .dish-photo, .dish-card.agotado .dish-photo-fallback { filter: grayscale(60%); }
.btn-add { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-weight: 600;
  font-size: .85rem; cursor: pointer; }
.btn-add:hover { background: var(--accent-dark); }

/* ============================================================
   STOREFRONT — estilo "texto plano" (sin fotos por platillo)
   ============================================================ */
.menu-text-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 40px;
  max-width: 1080px; margin: 30px auto; padding: 0 20px; }
.menu-text-category h2 { font-size: 1.3rem; border-bottom: 2px solid var(--accent); display: inline-block;
  padding-bottom: 4px; margin-bottom: 14px; }
.menu-text-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px dashed var(--line); }
.menu-text-row:last-child { border-bottom: none; }
.menu-text-row .dish-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.menu-text-row .dish-desc { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }
.menu-text-row .dish-price { flex-shrink: 0; font-weight: 700; color: var(--accent-dark); }
.menu-text-info { flex: 1; min-width: 0; }
.menu-text-row.agotado { opacity: .5; }
.menu-text-row.agotado .dish-price { display: none; }

/* ============================================================
   STOREFRONT — detalle de platillo / opciones
   ============================================================ */
.dish-detail { max-width: 640px; margin: 0 auto; padding: 20px 20px 60px; }
.dish-detail-photo { border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.option-group { margin-bottom: 20px; }
.option-group h3 { font-size: 1rem; margin-bottom: 10px; }
.option-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; background: var(--white); }
.option-row:hover { border-color: var(--accent); }
.option-row input { accent-color: var(--accent); }
.option-row .label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.option-row .price-add { color: var(--ink-soft); font-size: .85rem; }
.qty-stepper { display: flex; align-items: center; gap: 12px; }
.qty-stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--white);
  font-size: 1.2rem; cursor: pointer; }
.notes-field { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; resize: vertical; min-height: 60px; }
.sticky-cta { position: sticky; bottom: 0; background: var(--white); padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; margin: 0 -20px; }
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 13px 26px;
  font-weight: 700; font-size: .95rem; cursor: pointer; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   STOREFRONT — carrito / checkout
   ============================================================ */
.cart-page, .checkout-page { max-width: 640px; margin: 0 auto; padding: 24px 20px 80px; }
.cart-line { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line img, .cart-line .ph { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.cart-line .ph { display: flex; align-items: center; justify-content: center; background: var(--cream-2); font-size: 1.4rem; color: var(--accent); }
.cart-line-info { flex: 1; }
.cart-line-info .meta { font-size: .8rem; color: var(--ink-soft); }
.cart-line-price { font-weight: 700; white-space: nowrap; }
.cart-remove { color: var(--danger); font-size: .78rem; background: none; border: none; cursor: pointer; padding: 0; margin-top: 4px; }
.cart-total-row { display: flex; justify-content: space-between; padding: 16px 0; font-size: 1.15rem; font-weight: 700; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state .icon { font-size: 3rem; margin-bottom: 10px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--white); }
.form-hint { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }
.pay-method { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; }
.pay-method input[disabled] + span { color: #aaa; }
.bank-card { background: var(--cream-2); border-radius: var(--radius-sm); padding: 14px; margin-top: 10px; font-size: .88rem; }

.confirm-box { text-align: center; padding: 40px 20px; }
.confirm-box .icon { font-size: 3.2rem; margin-bottom: 10px; }
.check-badge { width: 60px; height: 60px; border-radius: 50%; background: var(--success);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.check-badge svg { width: 30px; height: 30px; }
.order-number-chip { display: inline-block; background: var(--cream-2); color: var(--accent-dark); font-weight: 700;
  padding: 6px 16px; border-radius: 999px; margin: 10px 0; }
.wa-btn { background: #25d366; color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 700; display: inline-block; margin-top: 14px; }

.sf-footer { background: var(--ink); color: #a89a8a; margin-top: 50px; }
.sf-footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 20px; font-size: .85rem; max-width: 720px; margin: 0 auto; }
.sf-footer-inner a { color: var(--accent); font-weight: 700; }
@media (max-width: 560px) {
  .sf-footer-inner { flex-direction: column; gap: 6px; text-align: center; }
}

/* ============================================================
   ADMIN — layout
   ============================================================ */
.admin-body { background: #f4f1ec; min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 224px; background: #2b2320; color: #f4ece0; flex-shrink: 0; padding: 20px 0; }
.admin-sidebar .brand { padding: 0 20px 20px; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px; }
.admin-sidebar .brand img { height: 26px; width: 26px; border-radius: 7px; display: block; }
.admin-sidebar .brand .brand-text span { color: var(--accent-on-dark); }
.admin-nav a { display: block; padding: 11px 20px; color: #d8ccc0; font-size: .9rem; font-weight: 500; border-left: 3px solid transparent; }
.admin-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.admin-nav a.active { background: rgba(224,139,62,.15); color: var(--accent-on-dark); border-left-color: var(--accent-on-dark); }
.admin-nav .badge-count { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: .72rem; margin-left: 6px; }
.admin-main { flex: 1; padding: 26px 32px 60px; max-width: 1100px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-topbar h1 { font-size: 1.5rem; margin: 0; }
.admin-topbar .actions { display: flex; gap: 10px; }

.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.8rem; font-weight: 700; font-family: var(--font-display); }
.stat-card .label { color: var(--ink-soft); font-size: .84rem; }

table.data-table { width: 100%; border-collapse: collapse; min-width: 540px; }
table.data-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-soft); padding: 10px 12px; border-bottom: 2px solid var(--line); }
table.data-table td { padding: 12px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
.thumb-sm { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.thumb-sm-fallback { width: 44px; height: 44px; border-radius: 8px; background: var(--cream-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm); padding: 9px 16px;
  font-weight: 600; font-size: .86rem; cursor: pointer; border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: #f0c4bd; }
.btn-danger-ghost:hover { background: #fdecea; border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }

.badge-status { padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700; display: inline-block; }
.badge-nuevo { background: #fdecea; color: var(--danger); }
.badge-preparacion { background: #fff6e0; color: var(--warn); }
.badge-listo { background: #e3f2fd; color: #1565c0; }
.badge-entregado { background: #e8f5e9; color: var(--success); }
.badge-cancelado { background: #eee; color: #666; }
.badge-agotado { background: #eee; color: #666; }
.badge-disponible { background: #e8f5e9; color: var(--success); }

.order-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.order-card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.order-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .num { font-weight: 700; font-family: var(--font-display); }
.order-card .meta { font-size: .8rem; color: var(--ink-soft); margin-bottom: 10px; }
.order-card ul { margin: 0 0 10px; padding-left: 18px; font-size: .87rem; }
.order-card .foot { display: flex; align-items: center; justify-content: space-between; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
fieldset.section legend { font-weight: 700; padding: 0 8px; font-family: var(--font-display); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: var(--cream-2); border-radius: 999px; padding: 5px 12px; font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.chip button { background: none; border: none; color: var(--danger); cursor: pointer; font-weight: 700; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.login-card { background: var(--white); border-radius: var(--radius); padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-card h1 { text-align: center; margin-bottom: 22px; }

/* ============================================================
   TICKET DE IMPRESIÓN (comanda)
   ============================================================ */
.ticket { width: 300px; margin: 0 auto; padding: 16px; font-family: 'Courier New', monospace; color: #000; }
.ticket h2 { font-size: 1.1rem; text-align: center; margin-bottom: 2px; }
.ticket .center { text-align: center; }
.ticket hr { border: none; border-top: 1px dashed #000; margin: 10px 0; }
.ticket .item-line { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 4px; }
.ticket .item-meta { font-size: .78rem; color: #333; margin: 0 0 6px 12px; }
.ticket .total-line { display: flex; justify-content: space-between; font-weight: 700; font-size: 1rem; margin-top: 8px; }
.no-print { margin-top: 16px; text-align: center; }
@media print {
  .no-print { display: none; }
  body { background: #fff; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; align-items: center; overflow-x: auto; padding: 10px 0; }
  .admin-sidebar .brand { padding: 0 14px; flex-shrink: 0; }
  .admin-nav { display: flex; }
  .admin-nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .admin-nav a.active { border-left-color: transparent; border-bottom-color: var(--accent-on-dark); }
  .admin-main { padding: 18px 16px 50px; }
  .card { padding: 16px; overflow-x: auto; }
  table.data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data-table thead, table.data-table tbody, table.data-table tr { display: revert; }
}
