/*
 * University of San Diego - Knauss School of Business
 * Official Financial & Advanced Analytics Web Suite Stylesheet
 * Department of Finance • Master of Science in Finance (MSF)
 */

/* ==============================================================================
 * THEME PALETTES: DARK (DEFAULT) & LIGHT
 * ============================================================================== */

/* 1. Default Dark Palette (USD Torero Navy / Obsidian, Silicon Circuit Backdrop, Cyan & Gold) */
:root, [data-theme="dark"] {
  --bg-body: #030812;
  --bg-surface: rgba(10, 20, 36, 0.85);
  --bg-card: rgba(14, 28, 48, 0.82);
  --bg-card-hover: rgba(20, 39, 66, 0.95);
  --bg-subtle: rgba(8, 18, 32, 0.85);
  --bg-input: rgba(6, 14, 26, 0.9);
  --border-subtle: #1D304D;
  --border-focus: #00A3E0;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --usd-navy: #002855;
  --usd-navy-dark: #001226;
  --usd-cyan: #38BDF8;
  --usd-cyan-light: rgba(56, 189, 248, 0.15);
  --usd-gold: #FBBF24;
  --usd-gold-light: rgba(251, 191, 36, 0.15);
  
  --nav-bg: rgba(0, 21, 46, 0.95);
  --hero-bg-1: #020710;
  --hero-bg-2: #071324;
  --hero-bg-3: #0B1C33;
  
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --card-shadow-hover: 0 10px 30px rgba(0, 163, 224, 0.22);
  
  --modal-bg: #0B1626;
  --modal-overlay: rgba(2, 6, 12, 0.88);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Merriweather', Georgia, Cambria, serif;
}

/* 2. Light Palette (Classic Alcalá White & Torero Blue) */
[data-theme="light"] {
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-input: #FFFFFF;
  --border-subtle: #E2E8F0;
  --border-focus: #00A3E0;
  
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  
  --usd-navy: #002855;
  --usd-navy-dark: #001A38;
  --usd-cyan: #00A3E0;
  --usd-cyan-light: #E0F2FE;
  --usd-gold: #D9A74A;
  --usd-gold-light: #FDF8ED;
  
  --nav-bg: #002855;
  --hero-bg-1: #001A38;
  --hero-bg-2: #002855;
  --hero-bg-3: #004080;
  
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 10px 24px rgba(0, 40, 85, 0.1);
  
  --modal-bg: #FFFFFF;
  --modal-overlay: rgba(15, 23, 42, 0.75);
}

/* Base resets & Dark Scrollbars */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background: transparent;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.22);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Silicon Circuit Trace Backdrop for Dark Theme (Calibrated to 50% Brightness) */
[data-theme="dark"] body {
  background-color: #02050B;
  background-image: linear-gradient(rgba(2, 5, 11, 0.45), rgba(2, 5, 11, 0.45)), url('assets/silicon_circuit_bg.svg');
  background-attachment: fixed;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

[data-theme="light"] body {
  background-color: #F8FAFC;
  background-image: none;
}

/* Institutional Top Utility Bar */
.institutional-utility-bar {
  background: #001226;
  border-top: 3px solid var(--usd-gold);
  border-bottom: 1px solid rgba(217, 167, 74, 0.25);
  color: #CBD5E1;
  font-size: 11px;
  padding: 6px 24px;
  position: relative;
  z-index: 1001;
}

[data-theme="light"] .institutional-utility-bar {
  background: #001C3D;
  color: #E2E8F0;
}

.top-util-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.top-util-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.util-inst-name {
  color: var(--usd-gold);
  text-transform: uppercase;
  font-weight: 700;
}

.util-school-name {
  color: #FFFFFF;
  text-transform: uppercase;
}

.util-sep {
  color: rgba(255, 255, 255, 0.3);
}

.util-badge {
  background: rgba(217, 167, 74, 0.15);
  border: 1px solid rgba(217, 167, 74, 0.4);
  color: var(--usd-gold);
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
}

.top-util-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94A3B8;
  font-size: 11px;
}

@media (max-width: 900px) {
  .top-util-right {
    display: none;
  }
}

/* Institutional Top Navigation */
.top-nav {
  background-color: var(--nav-bg);
  color: #FFFFFF;
  padding: 10px 24px;
  border-bottom: 2px solid rgba(217, 167, 74, 0.5);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.top-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: #FFFFFF;
}

.nav-ksb-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.nav-brand:hover .nav-ksb-logo {
  transform: scale(1.02);
}

[data-theme="dark"] .nav-logo-light { display: none; }
[data-theme="dark"] .nav-logo-dark { display: block; }
[data-theme="light"] .nav-logo-dark { display: block; }
[data-theme="light"] .nav-logo-light { display: none; }

.nav-brand-sep {
  width: 1px;
  height: 38px;
  background: linear-gradient(180deg, rgba(217, 167, 74, 0.6) 0%, rgba(0, 163, 224, 0.4) 100%);
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nav-dept-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: #FFFFFF;
  line-height: 1.2;
}

.nav-portal-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--usd-cyan);
  letter-spacing: 0.4px;
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link {
  color: #E2E8F0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--usd-cyan);
}

.nav-badge {
  background: rgba(0, 163, 224, 0.2);
  border: 1px solid var(--usd-cyan);
  color: #FFFFFF;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--usd-gold);
  color: var(--usd-gold);
}

[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: inline-block; color: var(--usd-gold); }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-block; }

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--hero-bg-1) 0%, var(--hero-bg-2) 60%, var(--hero-bg-3) 100%);
  color: #FFFFFF;
  padding: 55px 24px 65px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="dark"] .hero-section {
  background: rgba(4, 11, 22, 0.75);
  backdrop-filter: blur(8px);
}

.hero-content {
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero-subtitle-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(217, 167, 74, 0.18);
  border: 1px solid var(--usd-gold);
  color: var(--usd-gold);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-description {
  font-size: 17px;
  color: #CBD5E1;
  max-width: 960px;
  line-height: 1.65;
  margin-bottom: 28px;
}

/* Author Banner Elite Scholar Card */
.hero-author-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(0, 36, 77, 0.65) 0%, rgba(2, 14, 30, 0.8) 100%);
  border: 1px solid rgba(217, 167, 74, 0.4);
  padding: 16px 22px;
  border-radius: 14px;
  max-width: 820px;
  margin-bottom: 32px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .hero-author-banner {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 16px rgba(0, 40, 85, 0.08);
}

[data-theme="light"] .hero-author-banner .author-title-row h4 {
  color: #0F172A;
}

[data-theme="light"] .hero-author-banner .author-dept {
  color: #002855;
}

[data-theme="light"] .hero-author-banner .author-campus {
  color: #475569;
}

[data-theme="light"] .hero-author-banner .author-contact-item {
  color: #002855;
}

.hero-author-photo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--usd-gold);
  box-shadow: 0 0 16px rgba(217, 167, 74, 0.35);
  display: block;
  flex-shrink: 0;
}

.author-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.author-title-row h4 {
  font-size: 19px;
  font-weight: 800;
  color: #FFFFFF;
}

.author-status-pill {
  background: rgba(0, 163, 224, 0.2);
  border: 1px solid var(--usd-cyan);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="light"] .author-status-pill {
  background: #E0F2FE;
  color: #0072BC;
}

.author-role-pill {
  background: rgba(217, 167, 74, 0.18);
  border: 1px solid var(--usd-gold);
  color: var(--usd-gold);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 12px;
}

.hero-author-info .author-dept {
  font-size: 13px;
  color: #FFFFFF;
  font-weight: 500;
  margin-bottom: 2px;
}

.hero-author-info .author-campus {
  font-size: 12px;
  color: var(--usd-cyan);
  margin-bottom: 8px;
}

.author-contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.author-contact-item {
  color: #E2E8F0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.author-contact-item:hover {
  color: var(--usd-gold);
}

.author-contact-inst {
  color: #94A3B8;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Stats Row */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 1000px;
}

.stat-box {
  background: rgba(14, 28, 48, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 16px 20px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--usd-gold);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Guide Section */
.guide-section {
  max-width: 1440px;
  margin: 40px auto 20px;
  padding: 0 24px;
}

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

.section-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.category-card:hover {
  border-color: var(--usd-cyan);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.category-card.active {
  border-color: var(--usd-gold);
  background: linear-gradient(135deg, rgba(0, 40, 85, 0.75) 0%, rgba(217, 167, 74, 0.18) 100%);
  box-shadow: 0 0 24px rgba(217, 167, 74, 0.4), inset 0 0 12px rgba(217, 167, 74, 0.1);
  transform: translateY(-2px);
}

.category-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.cat-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--usd-cyan-light);
  color: var(--usd-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.category-card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.category-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.cat-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--usd-gold);
  background: var(--usd-gold-light);
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-block;
}

/* 50,000 Static Empirical Samples Section */
.samples-callout-section {
  max-width: 1440px;
  margin: 30px auto;
  padding: 0 24px;
}

.samples-callout-card {
  background: linear-gradient(135deg, rgba(0, 40, 85, 0.7) 0%, rgba(14, 28, 48, 0.85) 100%);
  border: 1px solid var(--usd-cyan);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  backdrop-filter: blur(8px);
}

.samples-callout-left {
  max-width: 800px;
}

.samples-callout-left h3 {
  font-size: 20px;
  color: #FFFFFF;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.samples-callout-left p {
  font-size: 13.5px;
  color: #CBD5E1;
  line-height: 1.55;
}

.samples-callout-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-sample-download {
  background: var(--usd-navy);
  color: #FFFFFF;
  border: 1px solid var(--usd-cyan);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-sample-download:hover {
  background: var(--usd-cyan);
  color: #001226;
}

.btn-sample-download.secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sample-download.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

/* Calculators Main Workspace */
.calculators-section {
  max-width: 1440px;
  margin: 30px auto 60px;
  padding: 0 24px;
}

.controls-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}

.search-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE / Edge */
}

.category-pills::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.pill-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.pill-btn:hover {
  border-color: var(--usd-cyan);
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--usd-navy);
  border-color: var(--usd-cyan);
  color: #FFFFFF;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-counter {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Equation Cards Grid */
.equations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.equation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.equation-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--usd-cyan);
}

.eq-cat-tag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.eq-cat-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--usd-cyan);
  letter-spacing: 0.5px;
}

.eq-50k-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid var(--usd-gold);
  color: var(--usd-gold);
  padding: 2px 8px;
  border-radius: 12px;
}

.eq-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.eq-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.eq-math-preview-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.eq-math-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.eq-math-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: var(--usd-cyan);
  white-space: pre-wrap;
  word-break: break-word;
}

.eq-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-launch {
  flex: 1;
  background: var(--usd-navy);
  color: #FFFFFF;
  border: 1px solid var(--usd-cyan);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-launch:hover {
  background: var(--usd-cyan);
  color: #001226;
}

.btn-source {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-source:hover {
  color: var(--usd-gold);
  border-color: var(--usd-gold);
}

/* Empty Search State */
.empty-search-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-search-state i {
  font-size: 36px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* Modal Overlay & Window */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-window {
  background: var(--modal-bg);
  width: 100%;
  max-width: 1020px;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.modal-header {
  background: var(--nav-bg);
  color: #FFFFFF;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--usd-gold);
}

.modal-header-left h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-header-left p {
  font-size: 12px;
  color: var(--usd-cyan);
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-modal-download {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--usd-cyan);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-modal-download:hover {
  background: var(--usd-cyan);
  color: #001226;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--usd-gold);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

@media (max-width: 820px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.calc-panel-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc-info-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* KaTeX Formula Display Container */
.modal-katex-container {
  background: rgba(0, 40, 85, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  overflow-x: auto;
  color: #FFFFFF;
  font-size: 1.15rem;
}

[data-theme="light"] .modal-katex-container {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

/* Educational Concept Note Box */
.modal-edu-box {
  background: rgba(217, 167, 74, 0.08);
  border-left: 4px solid var(--usd-gold);
  border-radius: 0 6px 6px 0;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

[data-theme="light"] .modal-edu-box {
  background: #FFFBEB;
  border-left-color: #D97706;
}

/* Educational Tooltips (?) */
.calc-label-row {
  display: flex;
  align-items: center;
  position: relative;
  gap: 6px;
  margin-bottom: 4px;
}

.tooltip-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tooltip-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--usd-cyan);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  user-select: none;
  transition: all 0.2s ease;
  line-height: 1;
}

.tooltip-icon:hover,
.tooltip-icon:focus {
  background: var(--usd-cyan);
  color: #001226;
  border-color: var(--usd-cyan);
  transform: scale(1.12);
  outline: none;
}

.tooltip-box {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #001A38;
  color: #F8FAFC;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  width: max-content;
  max-width: 260px;
  z-index: 2500;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  border: 1px solid var(--usd-cyan);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  white-space: normal;
  text-align: left;
}

.tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--usd-cyan) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-box,
.tooltip-icon:focus + .tooltip-box {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

[data-theme="light"] .tooltip-icon {
  background: rgba(0, 40, 85, 0.08);
  border-color: rgba(0, 40, 85, 0.25);
  color: var(--usd-navy);
}

[data-theme="light"] .tooltip-icon:hover,
[data-theme="light"] .tooltip-icon:focus {
  background: var(--usd-navy);
  color: #FFFFFF;
}

[data-theme="light"] .tooltip-box {
  background-color: #FFFFFF;
  color: #0F172A;
  border-color: #CBD5E1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tooltip-box::after {
  border-color: #CBD5E1 transparent transparent transparent;
}

.tooltip-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  color: var(--usd-cyan);
  margin-left: 6px;
  font-size: 13px;
}

.tooltip-badge::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #081220;
  color: #F8FAFC;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  width: 240px;
  z-index: 2500;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  border: 1px solid var(--usd-cyan);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.tooltip-badge:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Inputs & Form Groups */
.calc-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.calc-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.calc-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  outline: none;
}

.calc-input:focus {
  border-color: var(--border-focus);
}

.calc-unit-addon {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

/* Interactive Drag Bar (Range Slider) */
.calc-slider-wrapper {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calc-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(56, 189, 248, 0.16);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.calc-range-slider:hover {
  background: rgba(56, 189, 248, 0.28);
}

.calc-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--usd-gold);
  border: 2px solid #001226;
  box-shadow: 0 0 8px rgba(217, 167, 74, 0.55);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.calc-range-slider::-webkit-slider-thumb:hover,
.calc-range-slider::-webkit-slider-thumb:active {
  transform: scale(1.25);
  background: #E8C175;
  box-shadow: 0 0 14px rgba(217, 167, 74, 0.9);
}

.calc-range-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--usd-gold);
  border: 2px solid #001226;
  box-shadow: 0 0 8px rgba(217, 167, 74, 0.55);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.calc-range-slider::-moz-range-thumb:hover,
.calc-range-slider::-moz-range-thumb:active {
  transform: scale(1.25);
  background: #E8C175;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  padding: 0 2px;
}

[data-theme="light"] .calc-range-slider {
  background: rgba(0, 40, 85, 0.14);
}

[data-theme="light"] .calc-range-slider::-webkit-slider-thumb {
  border-color: #FFFFFF;
}

.btn-compute {
  background: var(--usd-navy);
  color: #FFFFFF;
  border: 1px solid var(--usd-cyan);
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
}

.btn-compute:hover {
  background: var(--usd-cyan);
  color: #001226;
}

/* Results Output & Pinned Sticky Simulation Panel */
.calc-panel-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

/* Dynamic Stochastic & Distribution Simulation Visualizer - Pinned In Place */
.calc-visual-container {
  background: #020914;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 14px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 163, 224, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}

[data-theme="light"] .calc-visual-container {
  background: #0a1728;
  border-color: rgba(2, 132, 199, 0.4);
}

.visual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.visual-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.visual-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--usd-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-status {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sim-status.running {
  background: rgba(34, 197, 94, 0.18);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.sim-status.paused {
  background: rgba(245, 158, 11, 0.18);
  color: #FBBF24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.sim-status.settled {
  background: rgba(56, 189, 248, 0.18);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.visual-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sim-speed-selector {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px 4px;
}

.sim-speed-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sim-speed-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.sim-speed-btn:hover {
  color: #FFFFFF;
  background: rgba(56, 189, 248, 0.15);
}

.sim-speed-btn.active {
  background: var(--usd-cyan);
  color: #001226;
  border-color: var(--usd-cyan);
  font-weight: 800;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.sim-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sim-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--usd-cyan);
}

.sim-btn.play {
  background: linear-gradient(135deg, #002855 0%, #0284c7 100%);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.sim-btn.play:hover {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #001226;
}

.sim-btn.play.active {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  border-color: #fcd34d;
  color: #FFFFFF;
}

.sim-btn.expand {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--usd-cyan);
}

.sim-btn.expand:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #FFFFFF;
}

.sim-btn.expand.active {
  background: var(--usd-cyan);
  color: #001226;
  border-color: #FFFFFF;
  font-weight: 800;
}

/* Jitter-Free Rock-Solid Canvas Wrapper (Fixed Height) */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 290px;
  min-height: 290px;
  max-height: 290px;
  border-radius: 8px;
  overflow: hidden;
  background: #01060f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

#sim-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Zero-Hop Tabular Fixed Telemetry Bar */
.sim-telemetry-bar {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 46px;
  max-height: 46px;
  box-sizing: border-box;
}

.sim-telemetry-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.sim-tel-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sim-tel-val {
  font-size: 12.5px;
  font-weight: 800;
  color: #F8FAFC;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* =============================================================================
 * Large Theater / Fullscreen Overlay View
 * ============================================================================= */
.calc-visual-container.expanded-overlay {
  position: fixed !important;
  top: 16px !important;
  left: 16px !important;
  right: 16px !important;
  bottom: 16px !important;
  z-index: 100005 !important;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  height: calc(100vh - 32px) !important;
  background: rgba(2, 9, 22, 0.98) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1.5px solid var(--usd-cyan) !important;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.98), 0 0 40px rgba(56, 189, 248, 0.35) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 20px 24px !important;
  border-radius: 16px !important;
  animation: overlayTheaterFade 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes overlayTheaterFade {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.calc-visual-container.expanded-overlay .canvas-wrapper {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 160px) !important;
}

.calc-visual-container.expanded-overlay #sim-canvas {
  width: 100% !important;
  height: 100% !important;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 18px;
}

.result-card.highlight {
  background: linear-gradient(135deg, rgba(0, 40, 85, 0.6) 0%, rgba(0, 163, 224, 0.2) 100%);
  border-color: var(--usd-cyan);
}

.result-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.result-card.highlight .result-label {
  color: var(--usd-gold);
}

.result-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.result-card.highlight .result-value {
  font-size: 24px;
  color: #FFFFFF;
}

.calc-error-card {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #EF4444;
  border-radius: 8px;
  padding: 14px;
  color: #FCA5A5;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Disclosures Section */
.disclosures-section {
  max-width: 1440px;
  margin: 0 auto 60px;
  padding: 0 24px;
}

.disclosures-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px 28px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  backdrop-filter: blur(6px);
}

.disclosures-card h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 700;
}

/* Institutional Footer */
.site-footer {
  background-color: var(--nav-bg);
  border-top: 3px solid var(--usd-gold);
  color: #FFFFFF;
  padding: 36px 24px 24px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #FFFFFF;
}

.footer-brand p {
  font-size: 13px;
  color: #94A3B8;
  line-height: 1.5;
  margin: 0;
}

.footer-nav-col {
  display: flex;
  align-items: center;
}

.footer-nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-nav-links a {
  color: #CBD5E1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-nav-links a:hover {
  color: var(--usd-gold);
}

.footer-nav-sep {
  color: rgba(255, 255, 255, 0.25);
  font-size: 12px;
}

.footer-bottom {
  max-width: 1440px;
  margin: 24px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748B;
  flex-wrap: wrap;
  gap: 10px;
}
