/* ============================================================
   BlockingRouter — Main Stylesheet
   Dark professional theme: deep navy/black + green accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #060a10;
  --bg-surface:    #0d1117;
  --bg-card:       #111827;
  --bg-elevated:   #1a2332;
  --bg-hover:      #1f2d3d;

  --border:        #1f2937;
  --border-light:  #2d3748;

  --green:         #22c55e;
  --green-dim:     #16a34a;
  --green-glow:    rgba(34, 197, 94, 0.15);
  --green-subtle:  rgba(34, 197, 94, 0.08);

  --text-primary:  #f9fafb;
  --text-secondary:#9ca3af;
  --text-muted:    #4b5563;

  --red:           #ef4444;
  --yellow:        #f59e0b;
  --blue:          #3b82f6;
  --cyan:          #06b6d4;

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow:        0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --shadow-green:  0 0 24px rgba(34,197,94,0.2);

  --font-sans:     'Space Grotesk', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;

  --transition:    0.18s ease;
  --transition-slow: 0.35s ease;
}

html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Typography ───────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { color: var(--text-primary); font-weight: 600; line-height: 1.3; }
p { color: var(--text-secondary); }
a { color: var(--green); text-decoration: none; transition: color var(--transition); }
a:hover { color: #4ade80; }
strong, b { color: var(--text-primary); font-weight: 600; }
small { font-size: 12px; color: var(--text-muted); }
code, .mono { font-family: var(--font-mono); }

/* ─── Layout ───────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 20px; }
.container-md { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ─── Auth layout ──────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
@media (max-width: 900px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
}

.auth-panel {
  background: linear-gradient(135deg, #050d15 0%, #0a1628 60%, #0d1f0f 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 56px;
  position: relative;
  overflow: hidden;
}

.auth-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 30% 30%, rgba(34,197,94,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 70% 80%, rgba(59,130,246,0.06) 0%, transparent 60%);
}

.auth-panel-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(34,197,94,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,197,94,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.auth-panel-content { position: relative; z-index: 1; }

.auth-panel .brand {
  margin-bottom: 60px;
  display: block;
}
.auth-panel .brand img {
  height: 48px;
  width: auto;
  display: block;
}

.auth-logo-mobile img {
  height: 36px;
  width: auto;
  display: block;
}

.auth-panel h1 { font-size: 38px; font-weight: 700; color: #fff; margin-bottom: 16px; line-height: 1.2; }
.auth-panel h1 em { color: var(--green); font-style: normal; }
.auth-panel p { color: #6b7280; font-size: 16px; line-height: 1.7; margin-bottom: 40px; }

.auth-stats { display: flex; gap: 32px; }
.auth-stat-num { font-size: 28px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.auth-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.auth-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 40px;
  background: var(--bg-surface);
  overflow-y: auto;
}

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

.auth-logo-mobile {
  display: none;
  margin-bottom: 32px;
}
.auth-logo-mobile img {
  height: 36px;
  width: auto;
}
@media (max-width: 900px) {
  .auth-logo-mobile { display: block; }
}

.auth-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-sm { padding: 16px; }
.card-lg { padding: 32px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* ─── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}
label .required { color: var(--red); margin-left: 2px; }

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.input-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
}
.input-toggle:hover { color: var(--green); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  padding: 12px 16px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.has-icon input,
.has-icon select {
  padding-left: 42px;
}

.has-toggle input {
  padding-right: 42px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
  background: var(--bg-hover);
}

.input-wrap:focus-within .input-icon { color: var(--green); }

input::placeholder,
textarea::placeholder { color: var(--text-muted); }
input[type="password"] { letter-spacing: 1px; }
input[type="password"]::placeholder { letter-spacing: normal; }

select option { background: var(--bg-card); color: var(--text-primary); }
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 6px; display: none; }
.form-error.show { display: block; }

.field-error input,
.field-error select,
.field-error textarea {
  border-color: var(--red);
}
.field-error .form-error { display: block; }

/* OTP input */
.otp-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0;
}
.otp-input {
  width: 52px !important;
  height: 60px;
  text-align: center;
  font-size: 24px !important;
  font-weight: 700;
  font-family: var(--font-mono) !important;
  padding: 0 !important;
  letter-spacing: 0 !important;
  border-radius: var(--radius) !important;
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  box-shadow: 0 2px 12px rgba(34,197,94,0.3);
}
.btn-primary:hover {
  background: #16a34a;
  border-color: #16a34a;
  box-shadow: 0 4px 20px rgba(34,197,94,0.4);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}
.btn-outline:hover {
  background: var(--green-subtle);
  color: var(--green);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 15px 32px; font-size: 15px; }
.btn-full { width: 100%; }

.btn:disabled,
.btn.loading {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-label { opacity: 0; }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert p { margin: 0; }

.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #86efac; }
.alert-error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* ─── Dividers ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-success { background: rgba(34,197,94,0.15);  color: #86efac; }
.badge-danger  { background: rgba(239,68,68,0.15);   color: #fca5a5; }
.badge-warning { background: rgba(245,158,11,0.15);  color: #fcd34d; }
.badge-info    { background: rgba(59,130,246,0.15);  color: #93c5fd; }
.badge-muted   { background: rgba(75,85,99,0.3);     color: var(--text-muted); }

/* ─── Navbar ───────────────────────────────────────────────── */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.navbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-brand img { height: 32px; width: auto; display: block; }
.navbar-brand .dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 8px var(--green); }
.navbar-brand span { color: var(--green); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.navbar-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.navbar-nav a:hover,
.navbar-nav a.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.navbar-nav a.active { color: var(--green); }

/* ─── Sidebar layout ───────────────────────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.sidebar-brand span { color: var(--green); }

.sidebar-nav { padding: 0 12px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 16px 12px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
}
.sidebar-nav a:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.sidebar-nav a.active {
  background: var(--green-subtle);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.15);
}
.sidebar-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-elevated); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover td { background: rgba(255,255,255,0.015); }
td .mono { font-size: 12px; color: var(--text-muted); }

/* ─── Stat cards ───────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.green::before  { background: var(--green); }
.stat-card.blue::before   { background: var(--blue); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.red::before    { background: var(--red); }

.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1; }
.stat-value.green  { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red    { color: var(--red); }
.stat-change { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ─── Animations ───────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }

.stagger > * {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }

/* ─── Utilities ────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-green  { color: var(--green); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--red); }
.text-warning{ color: var(--yellow); }
.text-success{ color: var(--green); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ─── Toast notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.4s ease 3.5s forwards;
  pointer-events: all;
}
.toast.success { border-color: rgba(34,197,94,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.warning { border-color: rgba(245,158,11,0.4); }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--yellow); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(10px); }
}

/* ─── Loading overlay ──────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
.page-loader.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Responsive utils ─────────────────────────────────────── */
@media (max-width: 640px) {
  .auth-form-side { padding: 40px 24px; }
  .auth-box { max-width: 100%; }
  .auth-title { font-size: 22px; }
  .container { padding: 0 16px; }
}
