/* ══════════════════════════════════════════════════════
   NightPOS – Design System
   Paleta: fondo casi negro + magenta neón + violeta
   Tipografía: Inter (display) + sistema (body)
   Signature: borde izquierdo neón en cards activas
══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Variables ─────────────────────────────────────── */
:root {
  --bg:        #0f1020;
  --bg2:       #171929;
  --surface:   #1e2035;
  --surface2:  #272a42;
  --surface3:  #31354f;
  --border:    #383c5a;
  --border2:   #2a2e47;

  --accent:    #e8356d;
  --accent2:   #ff6b9d;
  --purple:    #8b5cf6;
  --purple2:   #a78bfa;
  --blue:      #3b82f6;
  --blue2:     #60a5fa;
  --green:     #10b981;
  --green2:    #34d399;
  --gold:      #f59e0b;
  --gold2:     #fbbf24;
  --red:       #ef4444;
  --red2:      #f87171;

  --text:      #f0f2ff;
  --text2:     #c5cae8;
  --muted:     #7880a8;
  --muted2:    #9299bb;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow:    0 4px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);
  --glow:      0 0 20px rgba(232,53,109,.25);

  --sidebar-w: 240px;
  --topbar-h:  60px;
  --font:      'Inter', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ══ LAYOUT ═══════════════════════════════════════════ */

.np-app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.np-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.np-sidebar__logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.np-sidebar__logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.np-sidebar__logo-text { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.np-sidebar__logo-text span { color: var(--accent); }

.np-sidebar__user {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.np-sidebar__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.np-sidebar__user-info { min-width: 0; }
.np-sidebar__user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sidebar__user-role { font-size: 10px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }

.np-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.np-nav-section { padding: 12px 20px 4px; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.np-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  position: relative;
}
.np-nav-item:hover { color: var(--text); background: var(--surface); }
.np-nav-item.active {
  color: var(--text);
  background: var(--surface);
  border-left-color: var(--accent);
}
.np-nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.np-nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.np-sidebar__bottom {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

/* ── Topbar ──────────────────────────────────────────── */
.np-topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 90;
}
.np-topbar__left { display: flex; align-items: center; gap: 12px; }
.np-topbar__title { font-size: 16px; font-weight: 700; }
.np-topbar__right { display: flex; align-items: center; gap: 10px; }

.np-hamburger {
  display: none;
  background: none; border: none;
  color: var(--text); font-size: 22px;
  cursor: pointer; padding: 4px;
}

/* ── Main content ───────────────────────────────────── */
.np-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ══ COMPONENTS ═══════════════════════════════════════ */

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 700; }

/* ── Stat cards ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
}
.stat-card.c-accent::before { background: var(--accent); }
.stat-card.c-green::before  { background: var(--green); }
.stat-card.c-blue::before   { background: var(--blue); }
.stat-card.c-gold::before   { background: var(--gold); }
.stat-card.c-purple::before { background: var(--purple); }

.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.c-accent { background: #e8356d22; }
.stat-icon.c-green  { background: #10b98122; }
.stat-icon.c-blue   { background: #3b82f622; }
.stat-icon.c-gold   { background: #f59e0b22; }
.stat-icon.c-purple { background: #8b5cf622; }

.stat-info { min-width: 0; }
.stat-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.2; margin: 2px 0; }
.stat-sub   { font-size: 11px; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 18px;
  border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

.btn-primary  { background: var(--accent);   color: #fff; }
.btn-primary:hover { background: #ff4d80; box-shadow: var(--glow); }
.btn-secondary{ background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-success  { background: var(--green);    color: #012317; }
.btn-warning  { background: var(--gold);     color: #160d00; }
.btn-danger   { background: var(--red);      color: #fff; }
.btn-purple   { background: var(--purple);   color: #fff; }
.btn-blue     { background: var(--blue);     color: #fff; }
.btn-ghost    { background: transparent; color: var(--muted2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: var(--font);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  text-align: left; white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  font-size: 13px;
  border-top: 1px solid var(--border2);
  vertical-align: middle;
}
tbody tr:hover td { background: var(--surface); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-free    { background: #10b98120; color: var(--green2); }
.badge-occupied{ background: #8b5cf620; color: var(--purple2); }
.badge-billing { background: #f59e0b20; color: var(--gold2); }
.badge-reserved{ background: #3b82f620; color: var(--blue2); }
.badge-success { background: #10b98120; color: var(--green2); }
.badge-warning { background: #f59e0b20; color: var(--gold2); }
.badge-danger  { background: #ef444420; color: var(--red2); }
.badge-info    { background: #3b82f620; color: var(--blue2); }
.badge-accent  { background: #e8356d20; color: var(--accent2); }
.badge-muted   { background: var(--surface2); color: var(--muted2); }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Toast ───────────────────────────────────────────── */
#np-toasts {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.np-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 340px;
  animation: toastIn .25s ease;
  pointer-events: auto;
}
.np-toast.success { border-left: 3px solid var(--green); }
.np-toast.error   { border-left: 3px solid var(--red); }
.np-toast.info    { border-left: 3px solid var(--blue); }
.np-toast.warning { border-left: 3px solid var(--gold); }

/* ── Tables map ─────────────────────────────────────── */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.table-card {
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  position: relative;
}
.table-card:hover { border-color: var(--border); transform: translateY(-2px); }
.table-card.free     { }
.table-card.occupied { border-color: #8b5cf644; background: #2a1f4a; }
.table-card.billing  { border-color: var(--gold); background: #2d2310; }
.table-card.reserved { border-color: var(--blue); background: #1a2540; }
.table-card.selected { border-color: var(--accent)!important; box-shadow: var(--glow); }

.table-card__dot {
  width: 8px; height: 8px; border-radius: 50%;
  position: absolute; top: 8px; right: 8px;
}
.free .table-card__dot     { background: var(--green); }
.occupied .table-card__dot { background: var(--purple2); }
.billing .table-card__dot  { background: var(--gold); }
.reserved .table-card__dot { background: var(--blue2); }

.table-card__num    { font-size: 18px; font-weight: 800; }
.table-card__status { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.free .table-card__status     { color: var(--green2); }
.occupied .table-card__status { color: var(--purple2); }
.billing .table-card__status  { color: var(--gold2); }
.reserved .table-card__status { color: var(--blue2); }

/* ── POS ─────────────────────────────────────────────── */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; height: calc(100vh - var(--topbar-h) - 48px); }
.pos-menu   { display: flex; flex-direction: column; overflow: hidden; }
.pos-order  { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.pos-cat-bar { display: flex; gap: 8px; padding: 0 0 14px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.pos-cat-bar::-webkit-scrollbar { display: none; }
.pos-cat-btn {
  flex-shrink: 0; background: var(--surface2); border: 2px solid transparent;
  border-radius: 20px; padding: 6px 16px; font-size: 12px; font-weight: 700;
  color: var(--muted2); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.pos-cat-btn.active { background: #3a0e1c; border-color: var(--accent); color: var(--accent); }

.pos-prod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px; overflow-y: auto; flex: 1;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  padding-right: 4px;
}
.pos-prod-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 8px;
  text-align: center; cursor: pointer; transition: all .15s;
}
.pos-prod-card:hover { border-color: var(--accent); background: #2a1828; transform: translateY(-1px); }
.pos-prod-card:active { transform: scale(.96); }
.pos-prod-card .emoji { font-size: 26px; display: block; margin-bottom: 6px; }
.pos-prod-card .pname { font-size: 11px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pos-prod-card .pprice{ font-size: 12px; color: var(--green2); font-weight: 700; margin-top: 4px; }

.pos-order__header { padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pos-order__items  { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.pos-order-item {
  display: grid; grid-template-columns: 1fr 32px 60px 28px;
  align-items: center; padding: 9px 16px;
  border-bottom: 1px solid var(--border2); font-size: 13px;
}
.pos-order-item__name { font-weight: 600; font-size: 12px; }
.pos-order-item__sub  { font-size: 10px; color: var(--muted); }
.pos-order-item__qty  { text-align: center; font-weight: 700; }
.pos-order-item__price{ text-align: right; font-weight: 700; color: var(--green2); font-size: 12px; }
.pos-order__totals  { padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.pos-total-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--muted2); }
.pos-total-row.grand { font-size: 18px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px; }
.pos-order__actions { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

/* ── Kitchen / Bar tiles ─────────────────────────────── */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.kb-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.kb-card__header {
  padding: 10px 14px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border);
}
.kb-card.urgent .kb-card__header { background: #3a0e0e; border-color: var(--red); }
.kb-card__table { font-size: 16px; font-weight: 800; }
.kb-card__time  { font-size: 11px; color: var(--muted); }
.kb-card__items { padding: 10px 14px; }
.kb-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border2); font-size: 13px; }
.kb-item:last-child { border: none; }
.kb-item__qty { font-weight: 800; color: var(--gold2); margin-right: 10px; }
.kb-card__footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ── Scrollbar global ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Animations ─────────────────────────────────────── */
@keyframes slideUp   { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastIn   { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes pulse     { 0%,100% { opacity:1; } 50% { opacity:.5; } }
.anim-pulse { animation: pulse 1.5s infinite; }

/* ── Utility ─────────────────────────────────────────── */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-muted   { color: var(--muted); }
.text-accent  { color: var(--accent); }
.text-green   { color: var(--green2); }
.text-gold    { color: var(--gold2); }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 900; }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 22px; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ══ RESPONSIVE ═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-order  { min-height: 400px; }
  .form-row   { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .np-sidebar {
    transform: translateX(-240px);
    width: 240px;
    z-index: 300;
  }
  .np-sidebar.open { transform: translateX(0); }
  .np-hamburger { display: flex; }
  .np-topbar { left: 0; }
  .np-main { margin-left: 0; padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kb-grid   { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
    display: none;
  }
  .sidebar-overlay.open { display: block; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .modal { margin: 0; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ── Login page ─────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, #e8356d12 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, #8b5cf612 0%, transparent 60%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 20px;
  box-shadow: var(--glow);
}
.login-title { font-size: 24px; font-weight: 900; text-align: center; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 28px; }
