/* Automyra POS — css/style.css: Single stylesheet, no build step. Desktop-first (min width ~1024px). */

:root {
  --primary: #1a56db;
  --success: #057a55;
  --danger: #e02424;
  --warning: #e3a008;
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #111928;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-width: 1024px;
}
h1, h2, h3 { margin: 0 0 12px; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 20px; }

/* ---------------- Shell layout ---------------- */
#shell { display: flex; min-height: 100vh; }
#sidebar {
  width: 220px; background: #0e1b3d; color: #fff; display: flex; flex-direction: column;
  flex-shrink: 0; min-height: 100vh;
}
.sidebar-brand { padding: 20px 16px; font-weight: 700; font-size: 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px; flex: 1; }
.nav-link { color: #c3cbe0; padding: 10px 14px; border-radius: 8px; margin-bottom: 2px; font-size: 14px; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar { height: 60px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; flex-shrink: 0; }
#top-title { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
#app-content { padding: 20px; overflow-y: auto; }

body.bare #shell { display: block; }
body.bare #sidebar, body.bare #topbar { display: none; }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2ff; color: var(--primary); }
.badge-ok { background: #def7ec; color: var(--success); }
.badge-warn { background: #fdf6b2; color: #8a6d00; }
.badge-danger { background: #fde8e8; color: var(--danger); }

/* ---------------- Update bar ---------------- */
#update-bar { background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px; font-size: 14px; }

/* Invoice markup is only ever meant to be seen on paper — css/print.css reveals it during window.print(). */
#print-area { display: none; }

/* ---------------- Buttons & inputs ---------------- */
.btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1646b0; }
.btn-ghost { background: transparent; }
.btn-danger, .danger { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.file-btn { display: inline-block; cursor: pointer; }

.input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.field-row { display: flex; gap: 10px; margin-bottom: 12px; }
.field-row .field { flex: 1; margin-bottom: 0; }

.icon-btn { border: none; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); line-height: 1; }
.icon-btn:hover { color: var(--danger); }

/* ---------------- Page / card ---------------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.page-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-toolbar .input { max-width: 260px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }

.simple-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.simple-table th, .simple-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.simple-table tfoot td { border-bottom: none; border-top: 2px solid var(--border); }
.simple-table tr.row-low { background: #fef3f2; }
.simple-list { list-style: none; margin: 10px 0 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* ---------------- KPI cards ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 24px; font-weight: 700; }

/* ---------------- Auth / setup screens ---------------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.setup-card { width: 440px; }
.setup-step-indicator { margin-bottom: 16px; }
.setup-nav { display: flex; justify-content: space-between; margin-top: 16px; }
.logo-preview { max-width: 120px; max-height: 60px; display: block; margin-top: 8px; border: 1px solid var(--border); border-radius: 6px; }

/* ---------------- POS screen ---------------- */
.pos-page { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pos-left, .pos-right { display: flex; flex-direction: column; gap: 12px; }
.pos-right { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; position: sticky; top: 0; }
.pos-toolbar { display: flex; gap: 10px; }
.pos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 480px; overflow-y: auto; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.pos-tile { border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 10px; text-align: left; cursor: pointer; }
.pos-tile:hover { border-color: var(--primary); }
.pos-tile.out { opacity: .5; }
.pos-tile-name { font-weight: 600; font-size: 13px; }
.pos-tile-price { color: var(--primary); font-weight: 700; margin-top: 4px; }
.pos-tile-stock { color: var(--muted); font-size: 11px; margin-top: 2px; }

.held-list { display: flex; flex-direction: column; gap: 6px; }
.held-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.held-chip span { flex: 1; }

.cart-table input { padding: 4px 6px; font-size: 13px; }
.cart-table td:nth-child(2) input, .cart-table td:nth-child(3) input { width: 64px; }
.pos-totals { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; font-size: 14px; }
.pos-totals > div { display: flex; justify-content: space-between; }
.pos-total-line { font-weight: 700; font-size: 18px; border-top: 1px solid var(--border); padding-top: 6px; }
.pos-actions { display: flex; gap: 10px; }
.pos-actions .btn { flex: 1; }

/* ---------------- Reports ---------------- */
.report-tabs { display: flex; gap: 6px; }
.report-tab { border: 1px solid var(--border); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.report-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- Settings ---------------- */
.settings-page { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* ---------------- Toast ---------------- */
#toast { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast-item { background: #111928; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transform: translateY(8px); transition: all .2s; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-item.toast-err { background: var(--danger); }

/* ---------------- Modal ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 14px; width: 440px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
