/* ================================================================
   MENÚ DIGITAL — Estilos
   Tema claro, mobile-first, paleta cálida (naranja)
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #f8f9fa;
  --surface:      #ffffff;
  --surface2:     #f1f3f5;
  --border:       #e9ecef;
  --text:         #212529;
  --text2:        #495057;
  --muted:        #6c757d;
  --primary:      #f97316;
  --primary-dark: #ea580c;
  --primary-light:#fff7ed;
  --primary-ring: rgba(249,115,22,.25);
  --danger:       #dc3545;
  --danger-light: #fff5f5;
  --success:      #198754;
  --warning:      #f59e0b;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
  --transition:   .18s ease;
  --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
img  { max-width: 100%; display: block; }
a    { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; border: none;
  cursor: pointer; transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary{ background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger   { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fecaca; }
.btn-ghost    { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); }
.btn-sm       { padding: .3rem .75rem; font-size: .8rem; border-radius: 6px; }
.btn-full     { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }

/* ── Formularios ────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-row   { display: flex; gap: .75rem; }
.form-group-grow  { flex: 1; }
.form-group-price { width: 130px; }
label       { font-size: .83rem; font-weight: 600; color: var(--text2); }
.required   { color: var(--danger); margin-left: 2px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select, textarea {
  width: 100%; padding: .55rem .75rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .9rem;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
textarea { resize: vertical; min-height: 64px; }
.form-err {
  color: var(--danger); font-size: .82rem; font-weight: 500;
  display: none; padding: .4rem .6rem;
  background: var(--danger-light); border-radius: 6px;
}
.char-info   { font-weight: 400; color: var(--muted); float: right; }
.char-counter      { font-size: .78rem; color: var(--muted); }
.char-counter.warn { color: var(--warning); }
.img-preview {
  margin-top: .5rem; max-height: 140px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

/* ── Badges & Status ────────────────────────────────────────── */
.badge       { background: var(--primary-light); color: var(--primary-dark); border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; }
.badge-light { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.status-badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.status-badge.active   { background: #dcfce7; color: #166534; }
.status-badge.inactive { background: var(--surface2); color: var(--muted); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: .7rem 1.2rem;
  border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500;
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
  z-index: 9999; white-space: nowrap; box-shadow: var(--shadow-md);
}
.toast.show  { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
@media (min-width: 768px) { .toast { bottom: 24px; } }

/* ── Modales ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--surface); width: 100%; max-width: 540px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1rem;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border: none; background: var(--surface2);
  border-radius: 50%; font-size: 1.2rem; line-height: 1; cursor: pointer;
  color: var(--muted); transition: background var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-footer {
  display: flex; gap: .75rem; justify-content: flex-end;
  padding-top: .75rem; border-top: 1px solid var(--border); margin-top: .5rem;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-box     { border-radius: var(--radius); }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1rem; gap: .75rem; text-align: center;
}
.empty-icon { font-size: 3rem; line-height: 1; }
.empty-text { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.empty-sub  { font-size: .875rem; color: var(--muted); }
.empty-cell { padding: 2rem; text-align: center; color: var(--muted); font-size: .875rem; }

/* ── Item Cards (menú público y preview) ────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.item-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex; flex-direction: column;
}
.item-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-img-wrap { overflow: hidden; height: 180px; }
.card-img      { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.item-card:hover .card-img { transform: scale(1.04); }
.card-img-placeholder {
  height: 180px; background: linear-gradient(135deg, #fed7aa, #fef3c7);
  display: flex; align-items: center; justify-content: center; font-size: 3.5rem;
}
.card-body  { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-desc  { font-size: .82rem; color: var(--muted); line-height: 1.4; flex: 1; }
.card-price { font-size: 1.15rem; font-weight: 800; color: var(--primary); margin-top: auto; padding-top: .5rem; }

/* ── Menu Section (menú público y preview) ──────────────────── */
.menu-section { margin-bottom: 2.5rem; }
.cat-title  { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-bottom: .3rem; padding-bottom: .5rem; border-bottom: 2px solid var(--primary); display: inline-block; }
.cat-desc   { color: var(--muted); font-size: .875rem; margin-bottom: 1rem; }

/* ── Utilidades ─────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.hide-xs     { display: none; }
@media (min-width: 640px) { .hide-xs { display: table-cell; } }

/* ================================================================
   PÁGINA PÚBLICA (index.html)
   ================================================================ */
.public-page { background: var(--bg); }

.public-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 1.25rem 1rem; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  max-width: 900px; margin: 0 auto;
}
.header-icon { font-size: 2.2rem; line-height: 1; }
.public-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.public-header p  { font-size: .85rem; color: var(--muted); }

/* Barra de filtro de categorías */
.cat-filter-bar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .6rem 1rem; position: sticky; top: 73px; z-index: 99;
  overflow-x: auto; white-space: nowrap;
  display: flex; gap: .5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-filter-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-block; padding: .4rem .9rem;
  border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text2);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* Contenido principal público */
.pub-main {
  max-width: 900px; margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

/* Footer */
.pub-footer {
  text-align: center; padding: 1.5rem 1rem;
  color: var(--muted); font-size: .8rem;
  border-top: 1px solid var(--border);
}

/* ================================================================
   PANEL ADMIN (admin.html)
   ================================================================ */
.admin-page { background: var(--bg); }

/* Overlay de login */
.auth-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 1rem;
}
.login-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem 2rem 2.5rem;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 1rem;
}
.login-logo  { font-size: 2.5rem; text-align: center; }
.login-card h1 { font-size: 1.5rem; font-weight: 800; text-align: center; }
.login-sub   { text-align: center; color: var(--muted); font-size: .875rem; }
.login-card form { display: flex; flex-direction: column; gap: .9rem; margin-top: .5rem; }

/* Panel administrativo */
.admin-panel {
  display: flex; flex-direction: column; height: 100dvh;
}

/* Header del admin */
.admin-header {
  height: 56px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1rem; gap: .75rem; z-index: 200;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.header-title { font-size: 1rem; font-weight: 700; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Hamburger */
.hamburger {
  width: 36px; height: 36px; background: none; border: none;
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 5px; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: var(--transition);
}

/* Cuerpo del admin: sidebar + main */
.admin-body {
  display: flex; flex: 1; overflow: hidden; position: relative;
}

/* Sidebar overlay (móvil) */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 299;
}
#sidebar-overlay.show { display: block; }

/* Sidebar */
.admin-sidebar {
  width: 220px; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1rem 0;
  position: fixed; top: 56px; left: -220px; bottom: 60px; /* bottom: bottom-nav height */
  z-index: 300;
  transition: left var(--transition);
  overflow-y: auto;
}
.admin-sidebar.open { left: 0; box-shadow: var(--shadow-lg); }

.sidebar-logo { font-size: 2rem; text-align: center; padding: .5rem 0 1rem; }
.sidebar-nav  { display: flex; flex-direction: column; flex: 1; padding: 0 .75rem; gap: .25rem; }
.sidebar-footer { padding: .75rem; border-top: 1px solid var(--border); }

.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .9rem; border-radius: var(--radius-sm);
  background: none; border: none; font-size: .875rem;
  font-weight: 500; color: var(--text2); cursor: pointer; width: 100%;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.nav-item:hover           { background: var(--surface2); color: var(--text); }
.nav-item.active          { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.nav-icon                 { font-size: 1.1rem; width: 1.4rem; text-align: center; }

/* Contenido principal admin */
.admin-main {
  flex: 1; overflow-y: auto;
  padding: 1.25rem 1rem 1rem;
}

/* Secciones */
.section { }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem;
}
.section-header h2 { font-size: 1.2rem; font-weight: 800; }

/* Lista de categorías */
.categories-list { display: flex; flex-direction: column; gap: .75rem; }
.cat-row {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.cat-info     { flex: 1; min-width: 140px; }
.cat-row-name { font-weight: 700; font-size: .95rem; }
.cat-row-desc { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.cat-meta     { display: flex; gap: .4rem; flex-wrap: wrap; }
.cat-actions  { display: flex; gap: .4rem; }

/* Filtros de ítems */
.filters {
  display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.filters input  { flex: 1; min-width: 150px; }
.filters select { min-width: 140px; flex: 1; }

/* Tabla de ítems */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.items-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  font-size: .875rem;
}
.items-table th {
  padding: .65rem .75rem; text-align: left;
  background: var(--surface2); font-size: .78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.items-table td {
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.items-table tr:last-child td { border-bottom: none; }
.items-table tr:hover td { background: var(--surface2); }
.row-inactive td:not(.td-actions) { opacity: .6; }
.th-img, .td-img { width: 60px; }
.td-actions { white-space: nowrap; }
.item-thumb {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  object-fit: cover; border: 1px solid var(--border);
}
.thumb-placeholder {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fed7aa, #fef3c7);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  border: 1px solid var(--border);
}

/* Vista previa */
.preview-content { padding: 1rem 0; }

/* Bottom nav (móvil) */
.bottom-nav {
  height: 60px; background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; z-index: 200;
  box-shadow: 0 -1px 4px rgba(0,0,0,.05);
  flex-shrink: 0;
}
.bottom-nav .nav-item {
  flex: 1; flex-direction: column; gap: .15rem;
  padding: .4rem .25rem; font-size: .7rem;
  border-radius: 0; width: auto;
  justify-content: center; align-items: center;
}
.bottom-nav .nav-icon { font-size: 1.3rem; width: auto; }
.bottom-nav .nav-item.active { background: var(--primary-light); }

/* ── Desktop (768px+) ───────────────────────────────────────── */
@media (min-width: 768px) {
  /* Sidebar siempre visible en desktop */
  .hamburger { display: none; }
  .admin-sidebar {
    position: static; left: 0; bottom: auto;
    width: 220px; flex-shrink: 0;
    box-shadow: none;
  }
  #sidebar-overlay { display: none !important; }

  /* Sin bottom-nav en desktop */
  .bottom-nav { display: none; }

  /* Admin body usa flex horizontal */
  .admin-body { overflow: hidden; }
  .admin-main { padding: 1.5rem; }

  .section-header h2 { font-size: 1.35rem; }

  /* Modal centrado */
  .modal-overlay { align-items: center; }
  .modal-box     { border-radius: var(--radius); max-height: 85vh; }

  /* Grid de cards más amplio */
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  /* Tabla: mostrar columnas ocultas */
  .hide-xs { display: table-cell; }

  /* Toast sin offset de bottom-nav */
  .toast { bottom: 24px; }
}

@media (min-width: 1024px) {
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .admin-main { padding: 2rem; }
}
