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

*, *::before, *::after { box-sizing: border-box; }

:root {
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --surface-800: #1e293b;
  --surface-900: #0f172a;
  --surface-700: #334155;
  --text-muted: #64748b;
  --radius: .75rem;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; }

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #6366f1; }

/* ── Nav item ───────────────────────────────────────── */
.nav-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem; border-radius: .625rem;
  font-size: .875rem; font-weight: 500;
  color: #64748b; transition: all .2s ease-in-out;
  text-decoration: none; white-space: nowrap;
}
.dark .nav-item { color: #94a3b8; }
.nav-item:hover { background: #f1f5f9; color: #1e293b; }
.dark .nav-item:hover { background: #334155; color: #f1f5f9; }
.nav-item.active { background: rgba(99,102,241,.1); color: #6366f1; }
.dark .nav-item.active { background: rgba(99,102,241,.2); color: #818cf8; }
.nav-item svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }

/* ── Collapsed Sidebar ──────────────────────────────── */
#sidebar.w-20 .nav-item { justify-content: center !important; padding-left: 0 !important; padding-right: 0 !important; gap: 0 !important; }
#sidebar.w-20 .nav-item span { display: none !important; }
#sidebar.w-20 .context-badge { display: none !important; }
#sidebar.w-20 .user-info { display: none !important; }
#sidebar.w-20 .logo-img { display: none !important; }
#sidebar.w-20 .logo-icon { display: flex !important; }

/* ── Card ───────────────────────────────────────────── */
.card {
  background: #ffffff; border: 1px solid #e2e8f0;
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dark .card {
  background: #1e293b; border: 1px solid #334155;
  box-shadow: none;
}

/* ── Table ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead th {
  text-align: left; padding: .625rem 1rem;
  color: #64748b; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.dark .data-table thead th { border-bottom: 1px solid #334155; }
.data-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.dark .data-table tbody tr { border-bottom: 1px solid #1e293b; }
.data-table tbody tr:hover { background: #f8fafc; }
.dark .data-table tbody tr:hover { background: #1e293b; }
.data-table tbody td { padding: .75rem 1rem; color: #334155; vertical-align: middle; }
.dark .data-table tbody td { color: #cbd5e1; }

/* ── Badge ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 99px;
  font-size: .7rem; font-weight: 600; letter-spacing: .03em;
}
.badge-green  { background: rgba(16,185,129,.15); color: #34d399; }
.badge-red    { background: rgba(239,68,68,.15);  color: #f87171; }
.badge-yellow { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-blue   { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-purple { background: rgba(139,92,246,.15); color: #a78bfa; }
.badge-gray   { background: rgba(100,116,139,.15); color: #94a3b8; }

/* ── Btn ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .5rem 1rem; border-radius: .5rem; font-size: .875rem;
  font-weight: 600; cursor: pointer; border: none; transition: all .15s;
  white-space: nowrap; text-decoration: none;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form ───────────────────────────────────────────── */
.form-input, .form-select, .form-textarea {
  width: 100%; background: #ffffff; border: 1px solid #cbd5e1;
  border-radius: .5rem; padding: .6rem .875rem;
  color: #1e293b; font-size: .875rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.dark .form-input, .dark .form-select, .dark .form-textarea {
  background: #0f172a; border: 1px solid #334155; color: #f1f5f9;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-input::placeholder { color: #475569; }
.form-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: #94a3b8; margin-bottom: .375rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-group { margin-bottom: 1rem; }

/* ── POS Grid ───────────────────────────────────────── */
.pos-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .875rem;
}
.pos-item-card {
  background: #ffffff; border: 1px solid #e2e8f0;
  border-radius: .875rem; overflow: hidden; cursor: pointer;
  transition: all .2s; position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dark .pos-item-card { background: #1e293b; border: 1px solid #334155; box-shadow: none; }
.pos-item-card:hover { border-color: #6366f1; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,.1); }
.dark .pos-item-card:hover { box-shadow: 0 8px 24px rgba(99,102,241,.2); }
.pos-item-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.pos-item-info { padding: .625rem .75rem; }
.pos-item-name { font-size: .8rem; font-weight: 600; color: #334155; line-height: 1.3; }
.dark .pos-item-name { color: #e2e8f0; }
.pos-item-price { font-size: .75rem; color: #818cf8; font-weight: 700; margin-top: .25rem; }
.pos-availability {
  position: absolute; top: .4rem; right: .4rem;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  border-radius: 99px; padding: .15rem .5rem;
  font-size: .65rem; font-weight: 700; color: #34d399;
}
.pos-availability.low { color: #fbbf24; }
.pos-availability.out { color: #f87171; }

/* ── Table Layout ───────────────────────────────────── */
.table-layout-canvas { position: relative; overflow: hidden; }
.layout-table {
  position: absolute; display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; transition: box-shadow .15s;
  font-size: .7rem; font-weight: 700; border: 2px solid transparent;
}
.layout-table.available { background: rgba(16,185,129,.2); border-color: #10b981; color: #34d399; }
.layout-table.occupied  { background: rgba(239,68,68,.2);  border-color: #ef4444; color: #f87171; }
.layout-table.pending_payment { background: rgba(245,158,11,.2); border-color: #f59e0b; color: #fbbf24; }
.layout-table.reserved  { background: rgba(59,130,246,.2); border-color: #3b82f6; color: #60a5fa; }
.layout-table:hover { box-shadow: 0 0 0 4px rgba(99,102,241,.3); }

/* ── KDS Card ───────────────────────────────────────── */
.kds-card {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 1rem; padding: 1rem; display: flex; flex-direction: column; gap: .5rem;
}
.kds-card.urgent { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.kds-timer { font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kds-timer.ok { color: #34d399; }
.kds-timer.warn { color: #fbbf24; }
.kds-timer.urgent { color: #f87171; }

/* ── Stats widget ───────────────────────────────────── */
.stat-card {
  background: #1e293b; border: 1px solid #334155; border-radius: var(--radius);
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 3rem; height: 3rem; border-radius: .75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: #f1f5f9; }
.stat-label { font-size: .75rem; color: #64748b; font-weight: 500; margin-top: .15rem; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 767px) {
  .pos-item-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
  .card { padding: 1rem; }
  .data-table thead { display: none; }
  .data-table tbody tr { display: block; padding: .75rem; border: 1px solid #334155; border-radius: .5rem; margin-bottom: .5rem; }
  .data-table tbody td { display: flex; justify-content: space-between; padding: .25rem 0; border: none; }
  .data-table tbody td::before { content: attr(data-label); color: #64748b; font-size: .75rem; font-weight: 600; }
}

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .25s ease; }
@keyframes pulse-ring { 0%,100%{box-shadow:0 0 0 0 rgba(99,102,241,.4)} 50%{box-shadow:0 0 0 8px rgba(99,102,241,0)} }
.pulse-ring { animation: pulse-ring 2s infinite; }
