/* ══════════════════════════════════════════════
   StockFlow — Retail Inventory Management System
   style.css
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 50;
    background: #0f172a;
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }
}
:root {
  --brand: #22c55e;
  --brand-dim: rgba(34,197,94,0.15);
  --surface: rgba(15, 23, 42, 0.85);
  --surface-2: rgba(30, 41, 59, 0.6);
  --border: rgba(51, 65, 85, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  background: #020817;
  min-height: 100vh;
}

/* ─── Background grid ─────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(34,197,94,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,197,94,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Login orbs ──────────────────────────── */
.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(34,197,94,0.12) 0%, transparent 70%);
  top: -150px; right: -100px;
  animation: float1 8s ease-in-out infinite;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  animation: float2 10s ease-in-out infinite;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(34,197,94,0.06) 0%, transparent 70%);
  top: 40%; left: 40%;
  animation: float1 12s ease-in-out infinite reverse;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -30px); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, 20px); }
}

/* ─── Glass card ──────────────────────────── */
.glass-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ─── Stat card ───────────────────────────── */
.stat-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.4);
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover {
  border-color: rgba(34,197,94,0.2);
  transform: translateY(-2px);
}

/* ─── Sidebar ─────────────────────────────── */
.sidebar {
  background: rgba(9, 14, 28, 0.95);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* ─── Nav items ───────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(34,197,94,0.08);
  color: #e2e8f0;
}
.nav-item.active {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  font-weight: 500;
}

/* ─── Buttons ─────────────────────────────── */
.btn-primary {
  background: #22c55e;
  color: white;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 0 rgba(34,197,94,0);
}
.btn-primary:hover {
  background: #16a34a;
  box-shadow: 0 4px 20px rgba(34,197,94,0.25);
}
.btn-primary:active { transform: scale(0.98); }

/* ─── Form inputs ─────────────────────────── */
.form-input {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  color: white;
  transition: border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.form-input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}
.form-input::placeholder { color: #475569; }
select.form-input option {
  background: #0f172a;
  color: white;
}

/* ─── Table ───────────────────────────────── */
.glass-card table thead tr {
  background: rgba(15, 23, 42, 0.8);
}
.glass-card table tbody tr {
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  transition: background 0.15s;
}
.glass-card table tbody tr:last-child { border-bottom: none; }
.glass-card table tbody tr:hover { background: rgba(34,197,94,0.04); }

/* Low stock row highlight */
tr.low-stock-row { background: rgba(239, 68, 68, 0.07) !important; }
tr.low-stock-row:hover { background: rgba(239, 68, 68, 0.1) !important; }

/* ─── Modal ───────────────────────────────── */
.modal-overlay {
  background: rgba(2, 8, 23, 0.75);
  backdrop-filter: blur(4px);
}
.modal-card {
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(51, 65, 85, 0.5);
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Auth tab ────────────────────────────── */
.tab-active {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  font-weight: 500;
}

/* ─── Toast ───────────────────────────────── */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: all;
  max-width: 340px;
  animation: toastIn 0.3s ease;
  backdrop-filter: blur(12px);
  border: 1px solid;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast-success {
  background: rgba(20, 83, 45, 0.9);
  border-color: rgba(34,197,94,0.3);
  color: #86efac;
}
.toast-error {
  background: rgba(127, 29, 29, 0.9);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.toast-info {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}
.toast-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ─── Status badges ───────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-active   { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-inactive { background: rgba(71,85,105,0.3);  color: #94a3b8; border: 1px solid rgba(71,85,105,0.3); }
.badge-completed{ background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
.badge-low      { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ─── Order item row ──────────────────────── */
.order-item-row {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 10px;
  align-items: center;
}
.order-item-row select,
.order-item-row input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: white;
  font-family: 'DM Sans', sans-serif;
}
.order-item-row select:focus,
.order-item-row input:focus {
  outline: none;
  border-color: #22c55e;
}
.order-item-row input[type="number"] { width: 80px; }

/* ─── Category card ───────────────────────── */
.category-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 18px;
  padding: 22px;
  transition: all 0.2s;
}
.category-card:hover {
  border-color: rgba(34,197,94,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

/* ─── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(51, 65, 85, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.6); }

/* ─── Loading spinner ─────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.animate-spin { animation: spin 0.8s linear infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Profit bar ──────────────────────────── */
.profit-bar-wrap {
  height: 4px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.profit-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ─── Page transitions ────────────────────── */
.page-section {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 30; transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .order-item-row { grid-template-columns: 1fr 1fr; }
}