/* SerialPOS — Modern Dark UI */
:root {
  --primary:      #0d9488;
  --primary-dark: #0f766e;
  --primary-l:    #14b8a6;
  --accent:       #8b5cf6;
  --bg:           #0f172a;
  --bg2:          #1a2332;
  --card:         #1e2d3d;
  --card2:        #162030;
  --sidebar-bg:   #0a1628;
  --topbar-bg:    #1e2d3d;
  --border:       #2a3f55;
  --text:         #e2e8f0;
  --muted:        #8fa3b8;
  --dim:          #546a7b;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #3b82f6;
  --violet:       #8b5cf6;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.5);
  --tr:           all .18s ease;
  --transition:   all .18s ease;
  --sidebar-w:    240px;
  --topbar-h:     60px;
}

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

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

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

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img { height: 32px; object-fit: contain; }

.sidebar-logo-text {
  font-size: 17px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

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

.nav-section {
  padding: 10px 18px 4px;
  font-size: 9px; font-weight: 800;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--dim);
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: var(--tr);
  cursor: pointer;
}

.nav-item i { width: 16px; text-align: center; font-size: 14px; }
.nav-item:hover { background: rgba(13,148,136,.1); color: var(--primary-l); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(13,148,136,.2), rgba(139,92,246,.08));
  color: var(--primary-l);
  border-left: 3px solid var(--primary);
  padding-left: 15px;
}

/* ── MAIN ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(10px);
}

.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.btn-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--tr); font-size: 15px;
}
.btn-icon:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.user-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.user-pill .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.user-pill .un { font-size: 12px; font-weight: 600; }

/* ── PAGE ── */
.page-content { padding: 20px 24px; flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.card-title { font-size: 14px; font-weight: 700; }
.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  transition: var(--tr);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0; transition: var(--tr);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); }

.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.ic-teal   { background: rgba(13,148,136,.15); color: var(--primary-l); }
.ic-green  { background: rgba(16,185,129,.15); color: var(--success); }
.ic-red    { background: rgba(239,68,68,.15);  color: var(--danger); }
.ic-amber  { background: rgba(245,158,11,.15); color: var(--warning); }
.ic-blue   { background: rgba(59,130,246,.15); color: var(--info); }
.ic-violet { background: rgba(139,92,246,.15); color: var(--violet); }

.stat-val   { font-size: 22px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.stat-label { font-size: 11px; color: var(--muted); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: var(--tr);
  text-decoration: none; white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning  { background: var(--warning); color: #000; }
.btn-secondary { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,.1); }
.btn-violet   { background: var(--violet); color: #fff; }
.btn-violet:hover { background: #7c3aed; }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px; font-size: 11px; }

/* ── FORMS ── */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; }
.form-control {
  width: 100%; padding: 9px 13px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; outline: none; transition: var(--tr);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.form-control::placeholder { color: var(--dim); }
select.form-control option { background: var(--card); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  background: var(--bg2); color: var(--muted);
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(42,63,85,.5); vertical-align: middle; }
tbody tr:hover { background: rgba(13,148,136,.04); }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.badge-success  { background: rgba(16,185,129,.15); color: var(--success); }
.badge-danger   { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-warning  { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-info     { background: rgba(59,130,246,.15);  color: var(--info); }
.badge-secondary{ background: rgba(255,255,255,.08); color: var(--muted); }
.badge-violet   { background: rgba(139,92,246,.15); color: var(--violet); }
.badge-purple   { background: rgba(139,92,246,.15); color: var(--violet); }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72); backdrop-filter: blur(6px);
  z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(-16px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header {
  padding: 16px 20px; 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: 9px; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: none;
  color: var(--muted); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
}
.modal-close:hover { background: var(--danger); color: #fff; }

/* ── ALERTS ── */
.alert {
  padding: 11px 15px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 9px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: var(--success); }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: var(--danger); }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: var(--warning); }
.alert-info    { background: rgba(59,130,246,.1);  border-color: rgba(59,130,246,.3);  color: var(--info); }

/* ── SERIAL TAG ── */
.sn-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  background: rgba(13,148,136,.12); border: 1px solid rgba(13,148,136,.25);
  border-radius: 999px; font-size: 11px; font-family: monospace;
  color: var(--primary-l); margin: 2px;
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 24px; text-align: center; cursor: pointer; transition: var(--tr);
}
.drop-zone:hover { border-color: var(--primary); background: rgba(13,148,136,.04); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; opacity: .2; }
.empty-state h3 { font-size: 15px; color: var(--dim); margin-bottom: 6px; }
.empty-state p  { font-size: 12px; color: var(--dim); }

/* ── AVATAR ── */
.av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0;
}

/* ── LOGIN ── */
body.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 36px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { max-height: 60px; margin-bottom: 10px; display: block; margin-left: auto; margin-right: auto; }
.login-logo h1 {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-logo p { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── POS specific ── */
.pos-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 14px; height: calc(100vh - var(--topbar-h) - 40px); }
.pos-prods { overflow-y: auto; min-width: 0; }
.pos-cart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.pos-cart-hdr { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.pos-cart-body { flex: 1; overflow-y: auto; padding: 10px; }
.pos-cart-ftr { padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* POS Product Grid */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; padding-bottom: 20px; }
.prod-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: var(--tr);
}
.prod-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(13,148,136,.15); }
.prod-card-img { width: 100%; height: 110px; object-fit: cover; display: block; }
.prod-card-ph { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 36px; background: var(--bg2); }
.prod-card-body { padding: 10px 12px; }
.prod-card-name { font-weight: 700; font-size: 12px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-card-price { font-size: 14px; font-weight: 800; color: var(--primary-l); }
.prod-card-stock { font-size: 10px; margin-top: 3px; }

/* Cart item */
.cart-item { background: var(--bg2); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; }

/* Customer dropdown */
.cust-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto;
  z-index: 200; box-shadow: var(--shadow); display: none;
}
.cust-result { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; }
.cust-result:hover { background: var(--bg2); }
.cust-result:last-child { border-bottom: none; }

/* Payment method pills */
.pm-pill { display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); transition: var(--tr); }
.pm-pill.on { border-color: var(--primary) !important; background: rgba(13,148,136,.1) !important; color: var(--primary-l) !important; font-weight: 700; }

/* ── THEME COLOR PICKER (settings) ── */
.color-swatch {
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; transition: var(--tr); flex-shrink: 0;
}
.color-swatch:hover, .color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px var(--primary); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .pos-wrap { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .no-print, .modal-backdrop { display: none !important; }
  .main-content { margin-left: 0; }
  body { background: #fff; color: #000; }
}
