/* ════════════════════════════════════════════════════════
   css/styles.css — Estilos globales del sistema restaurante
   ════════════════════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  --accent:    #C4622D;
  --accent2:   #E07A48;
  --accentbg:  #FDF0E8;
  --green:     #1E6B3C;
  --greenbg:   #EAF4EE;
  --amber:     #92600A;
  --amberbg:   #FEF3C7;
  --blue:      #1A4F8A;
  --bluebg:    #EEF4FF;
  --purple:    #5B2D8E;
  --purplebg:  #F3EEFF;
  --red:       #B91C1C;
  --redbg:     #FEE2E2;
  --bg:        #F7F4EF;
  --surface:   #FFFEFB;
  --surface2:  #F0EDE6;
  --surface3:  #E8E4DC;
  --border:    #DDD8CE;
  --border2:   #C8C2B4;
  --text:      #1C1A16;
  --muted:     #7A7264;
  --faint:     #B0A898;

  /* Cocina (modo oscuro) */
  --coc-bg:      #0E0E0C;
  --coc-surface: #181815;
  --coc-surface2:#222120;
  --coc-border:  #2E2E2A;
  --coc-text:    #F4F1E8;
  --coc-muted:   #9A9588;
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }

.topbar-usuario {
  font-size: 12px; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 99px; white-space: nowrap;
}
.topbar-reloj {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--muted);
}

/* ── HAMBURGUESA ── */
.hamburger {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 6px; background: none;
  border: none; cursor: pointer; border-radius: 8px;
  transition: background .15s;
}
.hamburger:hover { background: var(--surface2); }
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── SIDEBAR OVERLAY (admin móvil) ── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  backdrop-filter: blur(1px);
}
#sidebar-overlay.open { display: block; }

/* ── CONTENEDOR APP ── */
#app { min-height: calc(100vh - 52px); }

/* ── LAYOUT ADMIN ── */
.admin-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: calc(100vh - 52px);
}

/* ── SIDEBAR ADMIN ── */
.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  position: sticky;
  top: 52px;
  overflow-y: auto;
  scrollbar-width: none;
}
.admin-sidebar::-webkit-scrollbar { display: none; }

.sidebar-section {
  padding: 10px 12px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
}
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin: 1px 6px;
  border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: all .12s; border: none; background: none;
  width: calc(100% - 12px); text-align: left;
  font-family: 'Sora', sans-serif;
}
.sidebar-item:hover  { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: var(--surface3); color: var(--text); }
.sidebar-item .ico   { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-pill {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 2px 6px; border-radius: 99px;
}

/* ── MAIN CONTENT ADMIN ── */
.admin-main {
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--bg);
}

/* ── LAYOUT MESERA ── */
.mesera-layout {
  display: grid;
  grid-template-columns: 210px 1fr 290px;
  height: calc(100vh - 96px); /* topbar + stepbar */
}

/* ── STEPBAR ── */
.stepbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 44px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.stepbar::-webkit-scrollbar { display: none; }
.step {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px; height: 44px;
  font-size: 12px; font-weight: 600;
  color: var(--faint); cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .15s;
  font-family: 'Sora', sans-serif;
  background: none; border-top: none;
  border-left: none; border-right: none;
}
.step.active { color: var(--accent); border-bottom-color: var(--accent); }
.step.done   { color: var(--green); }
.step-num {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.step.done .step-num {
  background: var(--green); border-color: var(--green); color: #fff;
}
.step-sep { color: var(--border2); padding: 0 2px; font-size: 14px; }

/* ── PANELES MESERA ── */
.panel-left {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel-center {
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}
.panel-right {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── MESAS ── */
.panel-section {
  padding: 10px 12px 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
}
.mesas-grid {
  padding: 8px 10px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 7px; overflow-y: auto; flex: 1;
}
.mesa-btn {
  aspect-ratio: 1; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface2); cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px; transition: all .15s; position: relative;
  font-family: 'Sora', sans-serif;
}
.mesa-btn:hover     { border-color: var(--accent2); transform: scale(1.03); }
.mesa-btn.active    { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentbg); }
.mesa-btn.ocupada   { background: #FFF6F2; border-color: var(--accent2); }
.mesa-btn.lista     { background: var(--greenbg); border-color: var(--green); }
.mesa-btn.cobrar    { background: var(--amberbg); border-color: var(--amber); }
.mesa-num  { font-size: 19px; font-weight: 700; }
.mesa-lbl  { font-size: 9px; font-weight: 600; color: var(--muted);
             text-transform: uppercase; letter-spacing: .05em; }
.mesa-dot  { position: absolute; top: 5px; right: 5px;
             width: 7px; height: 7px; border-radius: 50%; }
.dot-ocupada { background: var(--accent); }
.dot-lista   { background: var(--green); }
.dot-cobrar  { background: var(--amber); }

.mostrador-btn {
  margin: 8px 10px 10px;
  padding: 9px; border-radius: 10px;
  border: 1.5px dashed var(--border2);
  background: transparent; cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all .15s;
}
.mostrador-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── CUENTA PANEL DERECHO ── */
.cuenta-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cuenta-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.cuenta-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 7px;
  flex-shrink: 0;
}
.total-row {
  display: flex; justify-content: space-between;
  font-size: 12px; align-items: center;
}
.total-row .val { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.total-row.big  { font-size: 15px; font-weight: 700;
                  padding-top: 6px; border-top: 1px solid var(--border); margin-top: 2px; }
.total-row.big .val { color: var(--accent); }

/* ── BOTTOM BAR CUENTA (móvil) ── */
.cuenta-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 2px solid var(--border);
  z-index: 150; flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.cuenta-bar-resumen {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 16px; cursor: pointer; gap: 10px;
}
.cuenta-bar-detail {
  display: none; flex-direction: column;
  border-top: 1px solid var(--border);
  max-height: 55vh; overflow-y: auto;
}
.cuenta-bar.expandida .cuenta-bar-detail { display: flex; }

/* ── TARJETAS STAT (dashboard) ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.stat-label {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 6px;
}
.stat-val {
  font-size: 24px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stat-sub.up   { color: var(--green); }
.stat-sub.down { color: var(--red); }

/* ── TABLA ── */
.tbl-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin-bottom: 20px;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 9px 14px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--border);
  background: var(--surface2); white-space: nowrap;
}
td {
  padding: 9px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── SECCIÓN HEADER ── */
.sec-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.sec-title { font-size: 14px; font-weight: 700; }
.sec-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .admin-main { padding: 16px; }
}

@media (max-width: 768px) {
  /* Admin sidebar colapsable */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed; left: 0; top: 52px;
    height: calc(100vh - 52px); width: 220px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 20px rgba(0,0,0,.1);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: 14px 12px; }

  /* Mesera */
  .mesera-layout { grid-template-columns: 1fr; }
  .panel-left {
    position: fixed; left: 0; top: 96px;
    height: calc(100vh - 96px); width: 220px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 20px rgba(0,0,0,.1);
  }
  .panel-left.open { transform: translateX(0); }
  .panel-right { display: none; }
  .cuenta-bar  { display: flex; }
  .mesera-layout { height: calc(100vh - 96px - 58px); }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tbl-wrap   { font-size: 12px; }
}
