/* ============================== ROOT VARIABLES ==============================
   These variables control the ENTIRE theme. Each theme overrides them. */
:root {
  --bg: #f1f5f9;
  --bg-gradient-start: #eff6ff;
  --bg-gradient-end: #e0e7ff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-strong: 0 10px 25px rgba(0,0,0,0.10);
}

/* ============================== THEMES ============================== */
/* Default — Ocean Blue */
[data-theme="default"] {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --bg-gradient-start: #eff6ff;
  --bg-gradient-end: #e0e7ff;
}

/* Sunset Orange */
[data-theme="sunset"] {
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-soft: #ffedd5;
  --bg-gradient-start: #fff7ed;
  --bg-gradient-end: #ffedd5;
}

/* Forest Green */
[data-theme="forest"] {
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-soft: #dcfce7;
  --bg-gradient-start: #f0fdf4;
  --bg-gradient-end: #dcfce7;
}

/* Royal Purple */
[data-theme="royal"] {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-soft: #ede9fe;
  --bg-gradient-start: #faf5ff;
  --bg-gradient-end: #ede9fe;
}

/* Rose Pink */
[data-theme="rose"] {
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-soft: #ffe4e6;
  --bg-gradient-start: #fff1f2;
  --bg-gradient-end: #ffe4e6;
}

/* Midnight Dark */
[data-theme="midnight"] {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #312e81;
  --bg: #0f172a;
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-strong: 0 10px 25px rgba(0,0,0,0.6);
}

/* ============================== BASE ============================== */
body {
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="midnight"] body,
body[data-theme="midnight"] {
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
}

/* ============================== NAV BUTTONS ============================== */
.nav-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
  background: transparent;
}
.nav-btn:hover {
  background-color: var(--primary-soft);
  color: var(--primary);
}
.nav-btn.active {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-btn.active:hover {
  background-color: var(--primary-hover);
  color: white;
}

/* ============================== CARDS ============================== */
.card {
  background: var(--surface);
  color: var(--text);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card {
  color: white;
  padding: 1.25rem;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ============================== INFO BOX ============================== */
.info-box {
  background: var(--surface-2);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.tech-badge {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================== FORM CONTROLS ============================== */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
label { color: var(--text); }

/* ============================== BUTTONS ============================== */
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

/* ============================== TABLES ============================== */
table { border-collapse: collapse; }
thead { background: var(--surface-2); }
thead th { color: var(--text); }
tbody tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: var(--surface-2); }
tbody td { color: var(--text); }

/* ============================== HEADER ============================== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ============================== THEME SWATCHES ============================== */
.theme-swatch {
  height: 4rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  border: 3px solid var(--border);
  transition: all 0.2s;
}
.theme-swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow-strong); }
.theme-swatch.active { border-color: var(--text); transform: scale(1.05); }

/* ============================== TOAST ============================== */
#toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-strong);
  color: white;
  z-index: 9999;
  transform: translateY(0);
  transition: all 0.3s;
}
#toast.hidden { transform: translateY(20px); opacity: 0; pointer-events: none; }

/* ============================== HELPERS ============================== */
.text-muted { color: var(--text-muted) !important; }
.bg-surface { background: var(--surface) !important; }

/* ============================== RECEIPT PRINT ============================== */
#receiptContent {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #111;
  background: white;
}

@media print {
  body * { visibility: hidden; }
  #receiptModal, #receiptModal * { visibility: visible; }
  #receiptModal {
    position: absolute !important;
    left: 0; top: 0;
    background: white !important;
    padding: 0 !important;
  }
  #receiptModal > div {
    box-shadow: none !important;
    max-width: 100% !important;
  }
  .print-hidden { display: none !important; }
}

/* ============================== SCROLLBAR ============================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
