/* Font loaded via <link> tag in HTML — see index.php / login.php */

/* ═══════════════════════════════════════════════════════════════
   DESIGN TOKENS — NQHC PriceSuite Light Theme (Default) & Dark System v3.0
═══════════════════════════════════════════════════════════════ */
:root, [data-theme="light"] {
  /* Fonts */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Premium Light Surface Palette */
  --bg-root:     #f8fafc;
  --bg-base:     #f1f5f9;
  --bg-surface:  #ffffff;
  --bg-raised:   #f8fafc;
  --bg-overlay:  #e2e8f0;
  --bg-stroke:   #e2e8f0;
  --bg-input:    #ffffff;
  --bg-hover:    #f1f5f9;

  /* Brand — Royal Indigo & Deep Blue */
  --brand:        #4f46e5;
  --brand-dim:    #4338ca;
  --brand-light:  rgba(79, 70, 229, 0.08);
  --brand-glow:   rgba(79, 70, 229, 0.25);
  --brand-text:   #4338ca;

  /* Accent — Purple Violet */
  --accent:       #7c3aed;
  --accent-dim:   #6d28d9;
  --accent-light: rgba(124, 58, 237, 0.08);

  /* Semantic Colors */
  --emerald:      #059669;
  --emerald-bg:   rgba(16, 185, 129, 0.1);
  --emerald-brd:  rgba(16, 185, 129, 0.3);
  --rose:         #e11d48;
  --rose-bg:      rgba(225, 29, 72, 0.08);
  --rose-brd:     rgba(225, 29, 72, 0.25);
  --amber:        #d97706;
  --amber-bg:     rgba(217, 119, 6, 0.1);
  --amber-brd:    rgba(217, 119, 6, 0.3);
  --sky:          #0284c7;
  --sky-bg:       rgba(2, 132, 199, 0.08);

  /* High Contrast Text */
  --text-primary:  #0f172a;
  --text-secondary:#334155;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;

  /* Geometry */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  24px;
  --r-pill:999px;

  /* Shadows */
  --shadow-sm:  0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 20px 40px -10px rgba(15, 23, 42, 0.12);
  --shadow-brand: 0 8px 24px rgba(79, 70, 229, 0.28);
  --shadow-emerald: 0 8px 24px rgba(5, 150, 105, 0.2);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* Layout */
  --navbar-h: 68px;
  --container-w: 1200px;
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME OVERRIDE (Toggleable)
═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-root:     #060910;
  --bg-base:     #0b0f1a;
  --bg-surface:  #111827;
  --bg-raised:   #1a2236;
  --bg-overlay:  #1f2d45;
  --bg-stroke:   rgba(255,255,255,0.08);
  --bg-input:    rgba(0,0,0,0.45);
  --bg-hover:    rgba(255,255,255,0.04);

  --brand:        #6366f1;
  --brand-dim:    #4f46e5;
  --brand-light:  rgba(99,102,241,0.18);
  --brand-glow:   rgba(99,102,241,0.35);
  --brand-text:   #a5b4fc;

  --accent:       #8b5cf6;
  --accent-dim:   #7c3aed;
  --accent-light: rgba(139,92,246,0.15);

  --emerald:      #10b981;
  --emerald-bg:   rgba(16,185,129,0.12);
  --emerald-brd:  rgba(16,185,129,0.28);
  --rose:         #f43f5e;
  --rose-bg:      rgba(244,63,94,0.12);
  --rose-brd:     rgba(244,63,94,0.28);
  --amber:        #f59e0b;
  --amber-bg:     rgba(245,158,11,0.12);
  --amber-brd:    rgba(245,158,11,0.28);

  --text-primary:  #f8fafc;
  --text-secondary:#cbd5e1;
  --text-muted:    #94a3b8;
  --text-faint:    #64748b;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.6);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

/* Light Background Accent Shimmer */
.mesh-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mesh-bg::before {
  content: '';
  position: absolute;
  top: -15%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(79,70,229,0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.mesh-bg::after {
  content: '';
  position: absolute;
  bottom: -15%;
  right: -5%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(124,58,237,0.05) 0%, transparent 70%);
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--bg-stroke);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .navbar {
  background: rgba(17, 24, 39, 0.85);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-brand);
  color: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.brand-tagline {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Tab pill switcher */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-pill);
  padding: 4px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
}

[data-theme="dark"] .nav-tab:hover {
  background: rgba(255,255,255,0.05);
}

.nav-tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}

.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--dur-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
  transform: rotate(15deg);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-pill);
  padding: 4px 14px 4px 5px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name  { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.user-role  { font-size: 10.5px; font-weight: 600; color: var(--brand-text); text-transform: uppercase; letter-spacing: 0.04em; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid var(--rose-brd);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--dur-fast);
}

.btn-logout:hover {
  background: var(--rose);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE CONTAINER & CARDS
═══════════════════════════════════════════════════════════════ */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn var(--dur-base) var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 24px;
}

.page-title { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; }
.page-title span { color: var(--brand); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  position: relative;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.card-head-text h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.card-head-text p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   FORMS & BUTTONS
═══════════════════════════════════════════════════════════════ */
.field { margin-bottom: 20px; }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.field-label .req { color: var(--rose); }

.input-row {
  display: flex;
  gap: 12px;
}

.input {
  width: 100%;
  padding: 12px 18px;
  background: var(--bg-input);
  border: 1px solid #cbd5e1;
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 500;
  outline: none;
  transition: all var(--dur-fast);
}

[data-theme="dark"] .input {
  border-color: rgba(255,255,255,0.12);
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-light);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dim);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.38);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: var(--bg-base);
  color: var(--text-secondary);
  border: 1px solid var(--bg-stroke);
}

.btn-ghost:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid var(--rose-brd);
}

.btn-danger:hover {
  background: var(--rose);
  color: #ffffff;
}

.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════ */
.alert {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  border: 1px solid transparent;
}

.alert.show { display: flex; }

.alert-info { background: var(--sky-bg); border-color: rgba(2,132,199,0.25); color: var(--sky); }
.alert-success { background: var(--emerald-bg); border-color: var(--emerald-brd); color: var(--emerald); }
.alert-error { background: var(--rose-bg); border-color: var(--rose-brd); color: var(--rose); }
.alert-warning { background: var(--amber-bg); border-color: var(--amber-brd); color: var(--amber); }

/* ═══════════════════════════════════════════════════════════════
   TABLES & BADGES
═══════════════════════════════════════════════════════════════ */
.tbl-wrap {
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin-top: 20px;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tbl thead tr {
  background: var(--bg-base);
  border-bottom: 1px solid var(--bg-stroke);
}

.tbl th {
  padding: 14px 18px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.tbl td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--bg-stroke);
  color: var(--text-primary);
  vertical-align: middle;
}

.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--bg-hover); }

.tbl-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}

.cell-product { font-weight: 700; color: var(--text-primary); }
.cell-sub { font-size: 12px; color: var(--text-muted); }

.cell-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
}

code.sku {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-xs);
  color: var(--brand-text);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-brand  { background: var(--brand-light); color: var(--brand-text); border-color: rgba(79,70,229,0.2); }
.badge-accent { background: var(--accent-light); color: var(--accent); border-color: rgba(124,58,237,0.2); }
.badge-emerald{ background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-brd); }
.badge-rose   { background: var(--rose-bg); color: var(--rose); border-color: var(--rose-brd); }
.badge-sky    { background: var(--sky-bg); color: var(--sky); border-color: rgba(2,132,199,0.2); }
.badge-ghost  { background: var(--bg-base); color: var(--text-secondary); border-color: var(--bg-stroke); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.active::before { background: var(--emerald); }
.status-dot.inactive::before { background: var(--text-faint); }

/* ═══════════════════════════════════════════════════════════════
   WOOCOMMERCE CARD
═══════════════════════════════════════════════════════════════ */
.wc-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-top: 24px;
}

.wc-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--bg-stroke);
  background: var(--bg-base);
}

.wc-details { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.wc-label { font-size: 11px; font-weight: 800; color: var(--brand-text); text-transform: uppercase; letter-spacing: 0.08em; }
.wc-name { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.wc-price-box { display: flex; align-items: baseline; gap: 6px; }
.wc-currency { font-size: 18px; font-weight: 800; color: var(--emerald); }
.wc-price-val { font-size: 32px; font-weight: 900; color: var(--emerald); font-variant-numeric: tabular-nums; }
.wc-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   MODAL & OVERLAY
═══════════════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
}

.modal-bg.open { display: flex !important; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-xl);
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.modal-body { padding: 0 28px 28px; }

.btn-close-modal {
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-modal:hover { color: var(--text-primary); }

.perm-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-base);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-md);
  padding: 14px;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.perm-item:hover { background: var(--bg-hover); }
.perm-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 1px; }
.perm-text { display: flex; flex-direction: column; gap: 2px; }
.perm-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.perm-desc { font-size: 12px; color: var(--text-muted); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-stroke);
  margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: min(440px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--bg-stroke);
  border-radius: var(--r-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand { text-align: center; margin-bottom: 32px; }
.login-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: var(--shadow-brand);
  color: #fff;
  margin-bottom: 14px;
}

.login-title { font-size: 26px; font-weight: 900; color: var(--text-primary); letter-spacing: -0.03em; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.default-creds {
  background: var(--brand-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 24px;
}

.default-creds-title { font-size: 11px; font-weight: 800; color: var(--brand-text); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.default-creds-row { font-size: 13px; color: var(--text-secondary); margin: 2px 0; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 800px) {
  .navbar { padding: 0 16px; }
  .wc-card { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; }
}
