:root {
  --bg: #0c0e1a;
  --surface: #141728;
  --surface2: #1e2240;
  --surface3: #262b4a;
  --accent: #7c6fff;
  --accent2: #00d4ff;
  --success: #00c896;
  --warning: #ffb347;
  --danger: #ff6b6b;
  --text: #e8eaf6;
  --muted: #7b82a8;
  --border: #252a4a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

/* HEADER */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}
.tab:hover { background: var(--surface2); color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

/* MAIN */
.main { padding: 24px 28px; max-width: 1500px; margin: 0 auto; }

/* STATS */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 800; }

/* CATEGORY */
.cat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 18px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* PRODUCT GRID */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s;
}
.prod-card:hover { border-color: var(--accent); }
.prod-card.low-stock { border-color: rgba(255,179,71,0.4); }
.prod-card.no-stock { opacity: 0.55; }
.prod-info { flex: 1; min-width: 0; }
.prod-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.prod-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.prod-stock { font-size: 11px; margin-top: 4px; }
.prod-right { text-align: right; flex-shrink: 0; }
.prod-price { font-weight: 800; font-size: 15px; color: var(--accent2); margin-bottom: 6px; }

/* QTY INPUT */
.qty-input {
  width: 72px;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s;
}
.qty-input:focus { outline: none; border-color: var(--accent); background: var(--surface3); }
.qty-input:disabled { opacity: 0.35; cursor: not-allowed; }

/* STANJE TABLE */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
.cat-row td { background: var(--surface3) !important; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 9px 16px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-zero { background: rgba(255,107,107,0.15); color: var(--danger); }
.badge-low { background: rgba(255,179,71,0.15); color: var(--warning); }
.badge-ok { background: rgba(0,200,150,0.15); color: var(--success); }
.badge-soon { background: rgba(255,179,71,0.12); color: var(--warning); font-size: 10px; padding: 2px 7px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }

/* PRODAJA LAYOUT */
.prodaja-wrap {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
.products-col { min-width: 0; }

/* RECEIPT */
.receipt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: sticky;
  top: 74px;
}
.receipt-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}
.receipt-empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 13px; }
.receipt-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.ri-left { flex: 1; min-width: 0; }
.ri-name { font-size: 13px; font-weight: 600; }
.ri-calc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ri-price { font-weight: 700; font-size: 13px; white-space: nowrap; }
.receipt-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.receipt-discount-total {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--success);
  margin-bottom: 10px;
}
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 4px;
}
.rt-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.rt-amount { font-size: 28px; font-weight: 900; color: var(--accent2); letter-spacing: -1px; }

.shipping-box {
  margin-top: 14px;
  background: rgba(0,200,150,0.08);
  border: 1px solid rgba(0,200,150,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 8px;
}
.shipping-box.hidden { display: none; }

/* BUTTONS */
.btn-confirm {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #5a4fcf);
  color: #fff;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-confirm:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-confirm:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-clear {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-clear:hover { color: var(--text); border-color: var(--muted); }

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn-add {
  padding: 11px 28px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--success), #009970);
  color: #fff;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-add:hover { opacity: 0.9; transform: translateY(-1px); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  max-width: 320px;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { border-color: var(--success); color: var(--success); }
.toast.err { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--accent); color: var(--accent); }

/* LOW STOCK BANNER */
.low-stock-banner {
  background: rgba(255,179,71,0.12);
  border-bottom: 1px solid rgba(255,179,71,0.35);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 28px;
}
.low-stock-banner.hidden { display: none; }

/* FORMS */
.form-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--accent); }

/* LOGIN */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 48px); }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 340px;
}
.login-error {
  background: rgba(255,107,107,0.12);
  border: 1px solid rgba(255,107,107,0.35);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 14px;
}

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