/* ============================================================
   Chaser.sg Dashboard — Stylesheet
   Aesthetic: Dark industrial with electric-amber accents
   Fonts: IBM Plex Mono (mono/labels) + Syne (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-base:       #0a0b0f;
  --bg-surface:    #111318;
  --bg-card:       #161920;
  --bg-elevated:   #1c2028;
  --border:        #252932;
  --border-bright: #343b48;

  --accent:        #f5a623;
  --accent-dim:    #b87a1a;
  --accent-glow:   rgba(245,166,35,0.15);
  --accent-2:      #3ecfcf;
  --accent-2-dim:  rgba(62,207,207,0.12);

  --text-primary:  #e8eaf0;
  --text-secondary:#8b91a0;
  --text-muted:    #4a5060;
  --text-inverse:  #0a0b0f;

  --success:       #2ecb7a;
  --danger:        #ff4d6d;
  --warning:       #f5a623;
  --info:          #3ecfcf;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     14px;

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --font-mono:     'IBM Plex Mono', monospace;
  --font-head:     'Syne', sans-serif;
  --font-body:     'DM Sans', sans-serif;

  --shadow-card:   0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
  --shadow-glow:   0 0 24px var(--accent-glow);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Auth pages layout ── */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 4rem;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
  pointer-events: none;
}

.auth-brand::after {
  content: 'CHASER.SG';
  position: absolute;
  bottom: 3rem;
  right: 3rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: .2em;
  color: var(--text-muted);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 3rem;
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.brand-logo-icon svg { width: 22px; height: 22px; fill: var(--text-inverse); }

.brand-logo-name {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-logo-name span { color: var(--accent); }

.brand-tagline {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -.03em;
}

.brand-tagline em {
  font-style: normal;
  color: var(--accent);
}

.brand-desc {
  color: var(--text-secondary);
  font-size: .95rem;
  max-width: 340px;
  line-height: 1.7;
}

.brand-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
}

.brand-stat-num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
}

.brand-stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: .15rem;
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-title {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.auth-card-sub {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 2.25rem;
}

/* ── Form elements ── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: .5rem;
}

.form-input {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: .95rem;
  font-weight: 500;
  border: none;
  transition: all .2s;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 700;
  width: 100%;
  padding: .85rem;
  font-size: 1rem;
  letter-spacing: .01em;
}

.btn-primary:hover {
  background: #e8961a;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(245,166,35,.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: .85rem;
}

.btn-ghost:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255,77,109,.1);
  color: var(--danger);
  border: 1px solid rgba(255,77,109,.2);
  font-size: .85rem;
  padding: .5rem 1rem;
}

.btn-danger:hover { background: rgba(255,77,109,.2); }

/* ── Alert messages ── */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-md);
  font-size: .9rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(255,77,109,.08);
  border-color: rgba(255,77,109,.2);
  color: #ff8097;
}

.alert-success {
  background: rgba(46,203,122,.08);
  border-color: rgba(46,203,122,.2);
  color: var(--success);
}

.alert-info {
  background: rgba(62,207,207,.08);
  border-color: rgba(62,207,207,.2);
  color: var(--accent-2);
}

.auth-footer-link {
  text-align: center;
  margin-top: 1.75rem;
  font-size: .9rem;
  color: var(--text-secondary);
}

.auth-footer-link a { color: var(--accent); font-weight: 500; }

/* ── Dashboard Layout ── */
.dash-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 18px; height: 18px; fill: var(--text-inverse); }

.sidebar-logo-text {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.sidebar-logo-text span { color: var(--accent); }

.sidebar-nav { flex: 1; padding: 1.25rem 0; overflow-y: auto; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: .65rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .5rem 1.5rem .3rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  font-size: .9rem;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all .18s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: .7;
}

.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: color .18s;
  display: flex;
}

.sidebar-logout:hover { color: var(--danger); }
.sidebar-logout svg { width: 15px; height: 15px; }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }

.topbar-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
}

.topbar-breadcrumb {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .05em;
}

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.topbar-time {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: .3rem .75rem;
  border-radius: 100px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .3rem .75rem;
  border-radius: 100px;
  border: 1px solid;
}

.status-badge.online {
  color: var(--success);
  border-color: rgba(46,203,122,.25);
  background: rgba(46,203,122,.06);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Page content ── */
.page-content { padding: 2rem; flex: 1; }

.page-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-header-text {}

.page-title {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-top: .2rem;
}

/* ── Metric cards ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}

.metric-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius-lg) 0 50%;
  opacity: .06;
}

.metric-card.accent::before  { background: var(--accent); }
.metric-card.cyan::before    { background: var(--accent-2); }
.metric-card.success::before { background: var(--success); }
.metric-card.danger::before  { background: var(--danger); }

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

.metric-icon.accent  { background: var(--accent-glow);   color: var(--accent); }
.metric-icon.cyan    { background: var(--accent-2-dim);   color: var(--accent-2); }
.metric-icon.success { background: rgba(46,203,122,.1);   color: var(--success); }
.metric-icon.danger  { background: rgba(255,77,109,.1);   color: var(--danger); }

.metric-icon svg { width: 20px; height: 20px; }

.metric-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: .35rem;
}

.metric-label {
  font-size: .82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--font-mono);
}

.metric-change {
  margin-top: .75rem;
  font-size: .78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Section cards ── */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.section-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-card-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
}

.section-card-badge {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .25rem .7rem;
  border-radius: 100px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.section-card-body { padding: 1.5rem; }

/* ── Data tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.data-table th {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding: .6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg-elevated); color: var(--text-primary); }

.data-table .mono {
  font-family: var(--font-mono);
  font-size: .82rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 100px;
  font-size: .75rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

.pill-country {
  background: var(--accent-2-dim);
  color: var(--accent-2);
  border: 1px solid rgba(62,207,207,.2);
}

.pill-local {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(245,166,35,.2);
}

/* ── Chart container ── */
.chart-wrapper {
  position: relative;
  height: 260px;
}

/* ── Country bar ── */
.country-bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .85rem;
}

.country-bar-label {
  min-width: 110px;
  font-size: .85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
}

.country-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent) 0%, #e8961a 100%);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.country-bar-count {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.empty-state-text {
  font-family: var(--font-mono);
  font-size: .82rem;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* ── Two column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ── Hamburger for mobile ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: .4rem;
}

.hamburger svg { width: 22px; height: 22px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animations ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fade-up .4s ease both;
}

.fade-up-d1 { animation-delay: .05s; }
.fade-up-d2 { animation-delay: .10s; }
.fade-up-d3 { animation-delay: .15s; }
.fade-up-d4 { animation-delay: .20s; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-brand { display: none; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .metrics-grid { grid-template-columns: 1fr 1fr; }

  .page-content { padding: 1.25rem; }

  .topbar { padding: 0 1.25rem; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
}

/* ── Register page specifics ── */
.password-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .4rem;
  font-family: var(--font-mono);
}

/* ── Footer ── */
.dash-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .04em;
}

/* ── Tooltip-like label next to count ── */
.inline-muted {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
  margin-left: .5rem;
}

/* ── Overlay for mobile sidebar ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

.sidebar-overlay.active { display: block; }
