/* ============================================================
   eArrow Support Portal — THEME LAYER (loaded after app.css)
   Direction: luminous, layered, professional.
   - Brand gradient + ambient background depth
   - Glass topbar, gradient sidebar, spotlight cards
   - Motion: staged page entrances, hover physics, ripples
   Everything here is additive; delete this file to revert.
   ============================================================ */

:root {
  --grad-brand: linear-gradient(135deg, #1a65c8 0%, #3b5bdb 52%, #6d4be0 100%);
  --grad-brand-hover: linear-gradient(135deg, #2272dc 0%, #4a6af0 52%, #7b5af0 100%);
  --glow-brand: 0 8px 24px -6px rgba(59, 91, 219, 0.55);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --glass-bg: color-mix(in srgb, var(--white) 78%, transparent);
  --radius-xl: 20px;
}

/* ── Ambient background ─────────────────────────────────── */
body {
  background:
    radial-gradient(900px 420px at 92% -6%, rgba(59, 91, 219, 0.11), transparent 70%),
    radial-gradient(700px 380px at -8% 4%, rgba(109, 75, 224, 0.07), transparent 70%),
    var(--surface-1);
  background-attachment: fixed;
}
body.dark-mode {
  background:
    radial-gradient(900px 420px at 92% -6%, rgba(59, 91, 219, 0.2), transparent 70%),
    radial-gradient(700px 380px at -8% 4%, rgba(109, 75, 224, 0.14), transparent 70%),
    var(--surface-1);
  background-attachment: fixed;
}

/* ── Sidebar: deep gradient with a violet glow ──────────── */
.sidebar {
  background:
    radial-gradient(420px 280px at 0% 0%, rgba(109, 75, 224, 0.38), transparent 70%),
    radial-gradient(360px 260px at 100% 100%, rgba(26, 101, 200, 0.28), transparent 70%),
    linear-gradient(180deg, #0c2556 0%, #081b42 55%, #061330 100%);
}
body.dark-mode .sidebar {
  background:
    radial-gradient(420px 280px at 0% 0%, rgba(109, 75, 224, 0.3), transparent 70%),
    linear-gradient(180deg, #060d1f 0%, #040a18 100%);
}
.nav-item { transition: background var(--transition), color var(--transition), padding var(--transition); }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item .nav-icon { transition: transform 0.25s var(--ease-out); }
.nav-item:hover .nav-icon { transform: translateX(2px) scale(1.08); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(91, 158, 246, 0.32), rgba(109, 75, 224, 0.14));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(147, 191, 252, 0.22), 0 6px 18px -8px rgba(59, 91, 219, 0.7);
}
.nav-item.active::before { background: linear-gradient(180deg, #93c5fd, #a78bfa); }
.nav-item.active .nav-icon { color: #bfdbfe; }

/* ── Topbar: frosted glass ──────────────────────────────── */
.topbar {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  transition: box-shadow 0.25s var(--ease-out);
}
.topbar.scrolled { box-shadow: 0 8px 24px -14px rgba(16, 24, 40, 0.35); }
.topbar-title { font-weight: 700; }
.topbar-search {
  border-radius: 999px;
  width: 280px;
  background: var(--surface-1);
  border-width: 1px;
  border-color: var(--border);
  transition: width 0.3s var(--ease-out), var(--transition);
}
.topbar-search:focus-within { width: 340px; }
.search-kbd {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  padding: 1px 6px;
  cursor: pointer;
  background: var(--white);
  transition: var(--transition);
}
.search-kbd:hover { color: var(--blue-500); border-color: var(--blue-300); }
.notif-btn, .theme-toggle-btn { border-width: 1px; border-color: var(--border); border-radius: 12px; }
.notif-btn:hover, .theme-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--blue-500);
}
.theme-toggle-btn i { transition: transform 0.5s var(--ease-out); }
.theme-toggle-btn:hover i { transform: rotate(40deg); }

/* ── Cards: soft glass with spotlight hover ─────────────── */
.stat-card, .report-card, .table-card, .detail-panel, .ticket-detail-header {
  border-radius: var(--radius-xl);
}
.report-card, .table-card { border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.table-card { overflow: hidden; }

.stat-card, .report-card {
  position: relative;
  isolation: isolate;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.25s;
}
.stat-card::after, .report-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(91, 158, 246, 0.18), transparent 70%);
  transition: opacity 0.3s;
  pointer-events: none;
}
.stat-card:hover::after, .report-card:hover::after { opacity: 1; }
.stat-card:hover, .report-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -16px rgba(26, 60, 140, 0.35);
  border-color: var(--border-blue);
}

/* ── KPI cards: gradient icon tiles, bold figures ───────── */
.stat-card { --tile: var(--grad-brand); --tile-glow: rgba(59, 91, 219, 0.5); padding: 20px 22px; }
.stat-card::before { display: none; }
.stat-card.accent-sky   { --tile: linear-gradient(135deg, #0ea5e9, #2563eb); --tile-glow: rgba(14, 165, 233, 0.5); }
.stat-card.accent-green { --tile: linear-gradient(135deg, #22c55e, #059669); --tile-glow: rgba(34, 197, 94, 0.45); }
.stat-card.accent-red   { --tile: linear-gradient(135deg, #f87171, #dc2626); --tile-glow: rgba(239, 68, 68, 0.5); }
.stat-card.accent-amber { --tile: linear-gradient(135deg, #fbbf24, #ea580c); --tile-glow: rgba(245, 158, 11, 0.5); }
.stat-icon {
  background: var(--tile) !important;
  color: #fff !important;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 16px -6px var(--tile-glow);
  transition: transform 0.35s var(--ease-out);
}
.stat-card:hover .stat-icon { transform: rotate(-6deg) scale(1.08); }
.stat-value { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 8px; }

/* ── Buttons: gradient primary with glow + ripple ───────── */
.btn { position: relative; overflow: hidden; border-radius: 10px; }
.btn-primary { background: var(--grad-brand); box-shadow: var(--glow-brand); }
.btn-primary:hover { background: var(--grad-brand-hover); transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(59, 91, 219, 0.65); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary, .btn-outline { transition: var(--transition); }
.btn-secondary:hover, .btn-outline:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple 0.6s var(--ease-out);
  pointer-events: none;
}
.btn-secondary .ripple, .btn-outline .ripple, .view-chip .ripple { background: rgba(59, 91, 219, 0.2); }
@keyframes ripple { to { transform: scale(3.2); opacity: 0; } }

/* ── Tables: accent bar on hover ────────────────────────── */
tbody tr { transition: background 0.2s, box-shadow 0.2s; }
tbody tr:hover {
  background: color-mix(in srgb, var(--blue-500) 6%, transparent);
  box-shadow: inset 3px 0 0 var(--blue-400);
}
.ticket-num { font-weight: 700; color: var(--blue-500); }

/* ── Quick-view chips get the gradient when active ──────── */
.view-chip.active { background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow-brand); }
.view-chip { position: relative; overflow: hidden; }

/* ── Dashboard hero ─────────────────────────────────────── */
.dash-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 28px 32px;
  margin-bottom: 20px;
  border-radius: 24px;
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 24px 48px -24px rgba(59, 91, 219, 0.7);
}
.dash-hero::before, .dash-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.dash-hero::before {
  width: 340px; height: 340px; right: -80px; top: -150px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 68%);
}
.dash-hero::after {
  width: 260px; height: 260px; left: 28%; bottom: -150px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.5), transparent 70%);
}
.dash-hero-eyebrow { font-size: 12.5px; font-weight: 600; opacity: 0.8; letter-spacing: 0.02em; }
.dash-hero-title { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; margin: 4px 0 6px; }
.dash-hero-sub { font-size: 14px; opacity: 0.85; max-width: 520px; }
.dash-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.2s;
}
.hero-chip:hover { background: rgba(255, 255, 255, 0.26); transform: translateY(-2px); }
.hero-chip b { font-size: 15px; font-weight: 800; }
.dash-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.hero-btn.primary { background: #fff; color: #2b3fb8; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45); }
.hero-btn.ghost { background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); }
.hero-btn:hover { transform: translateY(-2px); }
.hero-btn kbd {
  font: inherit; font-size: 10.5px; padding: 1px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
}

/* ── Command palette ────────────────────────────────────── */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(8, 15, 40, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cmdk-overlay.open { display: flex; animation: cmdkFade 0.18s ease; }
.cmdk {
  width: 100%;
  max-width: 620px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  box-shadow: 0 40px 80px -24px rgba(8, 15, 40, 0.6);
  animation: cmdkPop 0.25s var(--ease-out);
}
.cmdk-input-row { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cmdk-input-row i { color: var(--text-muted); font-size: 16px; }
.cmdk-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--text-primary);
}
.cmdk-esc { font-size: 10.5px; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border-bright); border-radius: 6px; padding: 2px 7px; }
.cmdk-list { overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 10px 12px 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  color: var(--text-primary); font-size: 14px;
}
.cmdk-item .cmdk-ico {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-1); color: var(--blue-500); font-size: 14px;
}
.cmdk-item .cmdk-main { flex: 1; min-width: 0; }
.cmdk-item .cmdk-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .cmdk-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .cmdk-hint { font-size: 11px; color: var(--text-muted); }
.cmdk-item.sel { background: color-mix(in srgb, var(--blue-500) 10%, transparent); }
.cmdk-item.sel .cmdk-ico { background: var(--grad-brand); color: #fff; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.cmdk-foot {
  display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted); background: var(--surface-1);
}
@keyframes cmdkFade { from { opacity: 0; } }
@keyframes cmdkPop { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }

/* ── Toasts ─────────────────────────────────────────────── */
.toast {
  border-width: 1px;
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 32px -12px rgba(16, 24, 40, 0.35);
}

/* ── Modals ─────────────────────────────────────────────── */
.modal { border-radius: 22px; box-shadow: 0 40px 80px -28px rgba(8, 15, 40, 0.55); }

/* ── Motion: staged page entrance (no persistent transforms) ─ */
@media (prefers-reduced-motion: no-preference) {
  .page.active > * { animation: riseIn 0.5s var(--ease-out) backwards; }
  .page.active > *:nth-child(2) { animation-delay: 0.05s; }
  .page.active > *:nth-child(3) { animation-delay: 0.1s; }
  .page.active > *:nth-child(4) { animation-delay: 0.15s; }
  .page.active > *:nth-child(5) { animation-delay: 0.2s; }
  .page.active > *:nth-child(n+6) { animation-delay: 0.25s; }
  .stats-grid > .stat-card { animation: riseIn 0.55s var(--ease-out) backwards; }
  .stats-grid > .stat-card:nth-child(2) { animation-delay: 0.07s; }
  .stats-grid > .stat-card:nth-child(3) { animation-delay: 0.14s; }
  .stats-grid > .stat-card:nth-child(4) { animation-delay: 0.21s; }
  .stats-grid > .stat-card:nth-child(n+5) { animation-delay: 0.28s; }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  .ripple { display: none; }
  .stat-card:hover, .report-card:hover, .hero-chip:hover, .hero-btn:hover { transform: none; }
}

/* ── Small screens ──────────────────────────────────────── */
@media (max-width: 860px) {
  .dash-hero { padding: 22px 20px; border-radius: 20px; }
  .dash-hero-title { font-size: 22px; }
  .topbar-search, .topbar-search:focus-within { width: 100%; }
  .search-kbd { display: none; }
}
