/* ============================================================
   NEXUS BUSINESS — Design System Global
   Dark mode premium | Glassmorphism | Inter font
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);
  --border:         rgba(255,255,255,0.08);
  --border-bright:  rgba(255,255,255,0.16);

  --primary:        #00d4ff;
  --primary-dim:    rgba(0, 212, 255, 0.15);
  --primary-glow:   rgba(0, 212, 255, 0.4);
  --secondary:      #ff6b35;
  --secondary-dim:  rgba(255,107,53,0.15);
  --success:        #22c55e;
  --success-dim:    rgba(34,197,94,0.15);
  --warning:        #f59e0b;
  --warning-dim:    rgba(245,158,11,0.15);
  --danger:         #ef4444;
  --danger-dim:     rgba(239,68,68,0.15);
  --violet:         #a855f7;
  --violet-dim:     rgba(168,85,247,0.15);

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-inverse:   #0d1117;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #00d4ff, #0099cc);
  --grad-secondary: linear-gradient(135deg, #ff6b35, #e84d1c);
  --grad-success:   linear-gradient(135deg, #22c55e, #16a34a);
  --grad-hero:      linear-gradient(135deg, #0d1117 0%, #1a0a2e 50%, #0d1117 100%);
  --grad-card:      linear-gradient(135deg, rgba(0,212,255,0.05), rgba(168,85,247,0.05));

  /* Typography */
  --font-base:   'Inter', -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* Spacing */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(0,212,255,0.2);

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-base);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.1; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);   font-weight: 700; line-height: 1.2; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; }
h4 { font-size: 1rem;  font-weight: 600; }
p  { color: var(--text-secondary); }
a  { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: #fff; }

.mono { font-family: var(--font-mono); }

/* ── Layout ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--sm  { max-width: 640px;  }
.container--md  { max-width: 900px;  }
.container--lg  { max-width: 1100px; }

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem;   }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem;   }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* ── Cards (Glassmorphism) ───────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card--flat  { background: var(--bg-surface); }
.card--glow  { box-shadow: var(--shadow-glow), var(--shadow-md); border-color: rgba(0,212,255,0.3); }
.card--gradient { background: var(--grad-card); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(0,212,255,0.3);
}
.btn-primary:hover { box-shadow: 0 4px 25px rgba(0,212,255,0.5); transform: translateY(-1px); }

.btn-secondary {
  background: var(--grad-secondary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,107,53,0.3);
}

.btn-success {
  background: var(--grad-success);
  color: #fff;
  box-shadow: 0 4px 15px rgba(34,197,94,0.3);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; }

.btn--sm  { padding: 0.5rem 1rem;   font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn--lg  { padding: 1rem 2rem;     font-size: 1.05rem; }
.btn--xl  { padding: 1.2rem 2.5rem; font-size: 1.15rem; border-radius: var(--radius-lg); }
.btn--block { width: 100%; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  background: rgba(0,212,255,0.05);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-surface); }
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.form-error {
  font-size: 0.8rem;
  color: var(--danger);
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--grad-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ── Badges & Tags ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-primary  { background: var(--primary-dim);  color: var(--primary); }
.badge-success  { background: var(--success-dim);  color: var(--success); }
.badge-warning  { background: var(--warning-dim);  color: var(--warning); }
.badge-danger   { background: var(--danger-dim);   color: var(--danger); }
.badge-violet   { background: var(--violet-dim);   color: var(--violet); }
.badge-secondary{ background: var(--secondary-dim);color: var(--secondary); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th {
  padding: 0.9rem 1.2rem;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg-card-hover); }

/* Rank badges */
.rank-1 { color: #ffd700; font-weight: 700; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

/* ── Alerts / Toasts ─────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  border: 1px solid;
}
.alert-success { background: var(--success-dim); border-color: rgba(34,197,94,0.3); color: var(--success); }
.alert-warning { background: var(--warning-dim); border-color: rgba(245,158,11,0.3); color: var(--warning); }
.alert-danger  { background: var(--danger-dim);  border-color: rgba(239,68,68,0.3);  color: var(--danger); }
.alert-info    { background: var(--primary-dim); border-color: rgba(0,212,255,0.3);  color: var(--primary); }

/* Toast container */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.toast {
  min-width: 300px;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-bright);
  backdrop-filter: blur(16px);
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.3s ease forwards;
  box-shadow: var(--shadow-lg);
}
.toast-success { background: rgba(34,197,94,0.2);  color: var(--success); border-color: rgba(34,197,94,0.4); }
.toast-error   { background: rgba(239,68,68,0.2);  color: var(--danger);  border-color: rgba(239,68,68,0.4); }
.toast-info    { background: rgba(0,212,255,0.15); color: var(--primary); border-color: rgba(0,212,255,0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Progress Bars ───────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(200%); } }

.progress-fill--success { background: var(--grad-success); }
.progress-fill--warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.progress-fill--danger  { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 9000;
}

/* ── Nav / Header ────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}
.navbar-brand .logo-icon {
  width: 36px; height: 36px;
  background: var(--grad-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 15px var(--primary-glow);
}
.navbar-brand span { color: var(--primary); }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
}
.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

/* ── Event Card ──────────────────────────────────────────── */
.event-card {
  background: linear-gradient(135deg, rgba(168,85,247,0.1), rgba(0,212,255,0.05));
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  animation: eventPulse 3s ease infinite;
}
@keyframes eventPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(168,85,247,0.15); }
  50%       { box-shadow: 0 0 40px rgba(168,85,247,0.35); }
}
.event-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(168,85,247,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.event-icon { font-size: 2.5rem; }
.event-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--violet);
}

/* ── Company Color Dot ───────────────────────────────────── */
.company-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Cash Indicator ──────────────────────────────────────── */
.cash-indicator {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.cash-indicator .remaining {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
  transition: var(--transition);
}
.cash-indicator .remaining.warn  { color: var(--warning); }
.cash-indicator .remaining.over  { color: var(--danger); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-fadeIn   { animation: fadeIn 0.4s ease forwards; }
.animate-scaleIn  { animation: scaleIn 0.3s ease forwards; }

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ── Dividers ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* ── Utility ─────────────────────────────────────────────── */
.text-primary   { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning) !important; }
.text-danger    { color: var(--danger) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-sm        { font-size: 0.875rem; }
.text-xs        { font-size: 0.78rem; }
.text-lg        { font-size: 1.15rem; }
.text-xl        { font-size: 1.3rem; }
.font-bold      { font-weight: 700; }
.font-semibold  { font-weight: 600; }
.font-mono      { font-family: var(--font-mono); }
.text-right     { text-align: right; }
.text-center    { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-0  { padding: 0 !important; }
.w-full { width: 100%; }
.hidden  { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .container { padding: 0 1rem; }
  .card { padding: 1.25rem; }
  h1 { font-size: 1.6rem; }
}
@media (max-width: 480px) {
  .btn--xl { padding: 0.9rem 1.5rem; font-size: 1rem; }
}
