/* ─── MultiPOS — Master Stylesheet ────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg:        #0e1117;
  --surface:   #161b26;
  --surface2:  #1f2636;
  --border:    #2a3347;
  --text:      #e2e8f4;
  --muted:     #7a8aa8;
  --accent:    #4f8ef7;
  --accent2:   #7c5cfc;
  --green:     #22c55e;
  --red:       #ef4444;
  --orange:    #f97316;
  --yellow:    #eab308;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', monospace;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--surface);
  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;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  letter-spacing: -.3px;
}
.sidebar-logo span { color: var(--text); font-weight: 300; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 14px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  text-decoration: none;
}
.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: var(--surface2);
  border-left-color: var(--accent);
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
}

.main-content {
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1.05rem; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.page-body { padding: 28px; flex: 1; }

/* ─── Cards & Panels ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}
.card-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Stats Row ───────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.7rem; font-weight: 700; font-family: var(--mono); margin-top: 4px; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.blue  .stat-value { color: var(--accent); }
.stat-card.red   .stat-value { color: var(--red); }
.stat-card.orange .stat-value { color: var(--orange); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  font-family: var(--font);
  text-decoration: none;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #3d7ee8; text-decoration: none; color:#fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover  { background: #16a34a; text-decoration: none; color:#fff;}
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { background: #dc2626; text-decoration: none; color:#fff;}
.btn-warning  { background: var(--orange); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); text-decoration: none; color:var(--text); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-icon { padding: 7px; border-radius: 7px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); cursor: pointer; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.form-control {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 13px;
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .15s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--accent); }
select.form-control { cursor: pointer; }

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-green  { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-orange { background: rgba(249,115,22,.15); color: var(--orange); }
.badge-blue   { background: rgba(79,142,247,.15); color: var(--accent); }
.badge-gray   { background: rgba(122,138,168,.15); color: var(--muted); }

/* ─── Flash ───────────────────────────────────────────────── */
.flash { padding: 10px 16px; border-radius: 7px; margin-bottom: 16px; font-size: .88rem; font-weight: 500; }
.flash-ok  { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.flash-err { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.flash-info { background: rgba(79,142,247,.15); color: var(--accent); border: 1px solid rgba(79,142,247,.3); }

/* ─── Login page ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, rgba(79,142,247,.08) 0%, transparent 70%),
              radial-gradient(ellipse at 70% 80%, rgba(124,92,252,.06) 0%, transparent 60%),
              var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: -1px;
}
.login-sub { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 28px; }

/* ─── POS Layout ──────────────────────────────────────────── */
.pos-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 0; height: calc(100vh - 57px); }
.pos-left { overflow-y: auto; padding: 20px; background: var(--bg); }
.pos-right { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; }

.pos-search { padding: 16px; border-bottom: 1px solid var(--border); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.product-card .p-name { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.product-card .p-price { font-size: 1rem; font-weight: 700; color: var(--accent); font-family: var(--mono); }
.product-card .p-stock { font-size: .72rem; color: var(--muted); margin-top: 4px; }

/* Cart */
.cart-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.cart-body { flex: 1; overflow-y: auto; }
.cart-item { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.cart-item-name { flex: 1; font-size: .84rem; font-weight: 500; }
.cart-qty-ctrl { display: flex; align-items: center; gap: 6px; }
.cart-qty-ctrl button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); cursor: pointer; font-size: 1rem; line-height: 1; }
.cart-qty-ctrl input { width: 44px; text-align: center; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 3px; font-size: .85rem; }
.cart-item-total { font-family: var(--mono); font-size: .88rem; font-weight: 600; min-width: 70px; text-align: right; }
.cart-remove { color: var(--red); cursor: pointer; font-size: 1.1rem; }

.cart-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 6px; color: var(--muted); }
.cart-total-row.grand { color: var(--text); font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* ─── Payment modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 94%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.modal-close { float: right; cursor: pointer; color: var(--muted); font-size: 1.3rem; }

.pay-method-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.pay-btn {
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: all .15s;
  background: var(--surface2);
}
.pay-btn:hover, .pay-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(79,142,247,.1); }
.pay-btn svg { display: block; margin: 0 auto 6px; }

.upi-qr { text-align: center; padding: 14px 0; }
.upi-qr img { max-width: 180px; border-radius: 8px; border: 1px solid var(--border); }
.upi-qr .upi-id { font-family: var(--mono); margin-top: 8px; color: var(--accent); font-size: .85rem; }

/* ─── Receipt (print) ────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; color: #000; }
  .receipt-wrap { max-width: 80mm; margin: 0 auto; font-size: 11px; }
}
.receipt-wrap { font-family: var(--mono); max-width: 360px; margin: 0 auto; }
.receipt-wrap .r-line { border-top: 1px dashed #555; margin: 6px 0; }
.receipt-wrap .r-row { display: flex; justify-content: space-between; padding: 2px 0; }

/* ─── Misc ────────────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-small { font-size: .8rem; }
.mono { font-family: var(--mono); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.hidden { display: none; }

/* Error page */
.err-page { text-align: center; padding: 80px 20px; }
.err-page h1 { font-size: 5rem; color: var(--red); }
.err-page h2 { font-size: 1.5rem; margin: 10px 0; }
.err-page p { color: var(--muted); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-230px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .pos-wrap { grid-template-columns: 1fr; }
  .pos-right { height: 50vh; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
