/* Color scheme variables */
:root {
  --mint-green: #bee9e8ff;
  --moonstone: #62b6cbff;
  --indigo-dye: #1b4965ff;
  --columbia-blue: #cae9ffff;
  --picton-blue: #5fa8d3ff;
  
  /* Additional utility colors */
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --dark-gray: #343a40;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
}

/* Header guide variables */
:root {
  /* Typography */
  --font-weight-normal: 400;
  --font-weight-bold: 700;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* Shadows */
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--indigo-dye);
  background: var(--white);
  min-height: 100vh;
}

/* Container and layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--indigo-dye), var(--moonstone));
  color: var(--white);
  padding: var(--spacing-xl) 0;
  box-shadow: var(--shadow-md);
}

.header__title {
  text-align: left;
  font-size: 2.5rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-xs);
}

.header__subtitle {
  text-align: left;
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: var(--font-weight-normal);
}

/* Main content */
.main-content {
  padding: 2rem 0;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: var(--moonstone);
  color: var(--white);
  padding: 1rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Input section */
.ticker-input-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-group {
  display: flex;
  border: 2px solid var(--picton-blue);
  border-radius: 8px;
  background: var(--white);
  position: relative;
}

.input-group input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  font-size: 1rem;
  outline: none;
  background: transparent;
}

.input-group input::placeholder {
  color: #6c757d;
}

/* Search container and dropdown */
.ticker-search-container {
  position: relative;
  width: 100%;
  z-index: 100;
}

.ticker-search-container input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  font-size: 1rem;
  outline: none;
  background: transparent;
  width: 100%;
}

.ticker-search-container input[type="text"]::placeholder {
  color: #6c757d;
}

.search-results {
  position: absolute;
  top: calc(100% + 2px);
  left: -2px;
  right: -2px;
  width: auto;
  max-height: 320px;
  overflow-y: auto;
  background-color: white;
  border: 2px solid var(--picton-blue);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  display: none;
}

.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--columbia-blue);
  transform: translateX(2px);
}

.search-result-item:active {
  background-color: var(--mint-green);
  transform: translateX(0);
}

.search-result-main {
  flex: 1;
  min-width: 0;
}

.search-result-item .symbol {
  font-weight: 700;
  font-size: 1rem;
  color: var(--indigo-dye);
  margin-bottom: 0.25rem;
  display: block;
}

.search-result-item .name {
  color: #6c757d;
  font-size: 0.875rem;
  line-height: 1.3;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.search-result-item .type {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

.search-result-item .type.equity {
  background: var(--picton-blue);
}

.search-result-item .type.etf {
  background: var(--moonstone);
}

.search-spinner {
  display: none;
  width: 20px;
  height: 20px;
  position: absolute;
  right: 10px;
  top: 10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.error-message {
  color: #d9534f;
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-compact {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  color: var(--picton-blue);
  border: 1px solid var(--picton-blue);
}

.btn-outline:hover {
  background: var(--columbia-blue);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
  background: var(--picton-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--moonstone);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-secondary {
  background: var(--dark-gray);
  color: var(--white);
}

.btn-options {
  background: #6c757d;
  color: var(--white);
  border: 2px solid #6c757d;
  position: relative;
}

.btn-options:hover {
  background: #5a6268;
  border-color: #5a6268;
  transform: translateY(-1px);
}

.btn-sample {
  background: var(--picton-blue);
  border: 1px solid var(--moonstone);
  color: white;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-sample:hover {
  background: var(--moonstone);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

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

.btn-export {
  background: var(--picton-blue);
  color: var(--white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-export:hover {
  background: var(--moonstone);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Ticker list */
.ticker-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: var(--white);
}

/* Simple progress bar */
.progress {
  width: 100%;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #dee2e6;
}

.progress-bar {
  height: 14px;
  background: linear-gradient(90deg, var(--picton-blue), var(--moonstone));
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
  line-height: 14px;
  transition: width 0.2s ease;
}

/* Keep rightmost header tooltip (Score) within table bounds in hedge results */
#hedge-results-table th:last-child .risk-header-tooltip,
#hedge-results-table th:nth-last-child(2) .risk-header-tooltip {
  --tooltip-left: auto;
  --tooltip-right: 0;
  --tooltip-transform: none;
  --tooltip-arrow-left: auto;
  --tooltip-arrow-right: 12px;
  --tooltip-animation: tooltipFadeStatic;
}

/* Make hedge results rows clickable for selection */
#hedge-results-table tbody tr {
  cursor: pointer;
}

#hedge-build-results-body tr.hedge-efficient-row {
  background: rgba(34, 139, 34, 0.12) !important;
}

#hedge-build-results-body tr.hedge-efficient-row:hover {
  background: rgba(34, 139, 34, 0.2) !important;
}

#hedge-build-results-body tr.hedge-inefficient-row {
  background: rgba(155, 89, 182, 0.12) !important;
}

#hedge-build-results-body tr.hedge-inefficient-row:hover {
  background: rgba(155, 89, 182, 0.2) !important;
}

#hedge-build-results-body tr.hedge-infeasible-row {
  background: rgba(220, 53, 69, 0.12) !important;
}

#hedge-build-results-body tr.hedge-infeasible-row:hover {
  background: rgba(220, 53, 69, 0.2) !important;
}

#hedge-type-short[disabled] {
  opacity: 1;
  cursor: not-allowed;
}

.hedge-short-wip {
  position: relative;
}

.hedge-short-wip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--indigo-dye);
  color: var(--white);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 10001;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.ticker-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.ticker-item:last-child {
  border-bottom: none;
}

.ticker-item:hover {
  background: var(--light-gray);
}

.ticker-info {
  flex: 1;
}

.ticker-symbol {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--indigo-dye);
}

.ticker-name {
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.ticker-meta {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  position: relative;
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 1s ease-in-out infinite;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--columbia-blue);
  border-top: 3px solid var(--picton-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Empirical Modal Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 0 0 12px 12px;
  backdrop-filter: blur(3px);
}

/* Hedge Finder Modal */
.hedge-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.hedge-modal-content {
  background: var(--white);
  margin: 5% auto;
  border-radius: 10px;
  width: min(1100px, 95vw);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: modalFadeIn 0.3s ease-out;
}

.hedge-modal-header {
  background: linear-gradient(135deg, var(--indigo-dye), var(--moonstone));
  color: var(--white);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 10px 10px 0 0;
}

.hedge-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.hedge-modal-close {
  color: var(--white);
  font-size: 1.75rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s ease;
  line-height: 1;
}

.hedge-modal-close:hover { opacity: 0.7; }

.hedge-modal-body {
  padding: 1rem 1.5rem 1.25rem 1.5rem;
}

.hedge-section { margin-bottom: 1rem; }


.loading-overlay .loading-spinner {
  width: 64px;
  height: 64px;
  border: 5px solid var(--columbia-blue);
  border-top: 5px solid var(--picton-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.loading-overlay p {
  color: var(--indigo-dye);
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  text-align: center;
  opacity: 1;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(190, 233, 232, 0.5);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Results section */
.results-section {
  display: none;
}

.results-section.show {
  display: block;
}

/* Portfolio Results Layout */
.portfolio-results-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1rem;
}

.portfolio-table-section {
  min-width: 0;
}

.portfolio-chart-section {
  min-width: 0;
}

/* Risk metric explanation styling */
.risk-metric-explanation {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #495057;
}

.change-risk-metric-link {
  color: var(--picton-blue);
  cursor: pointer;
  text-decoration: underline;
}

.change-risk-metric-link:hover {
  color: var(--moonstone);
}

/* Training date range styling */
.training-date-range {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #495057;
}

/* Important considerations list styling */
.important-considerations {
  margin: 0;
  padding-left: 1.5rem;
  color: #856404;
}

.volatility-risk-bullet { display: list-item; }

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Scrollable table container that only scrolls on hover */
.table-scroll {
  /* Constrain height so long tables don’t push the modal/page */
  max-height: clamp(280px, 50vh, 520px);
  overflow-y: hidden; /* allow page to scroll when not hovering */
}
.table-scroll:hover {
  overflow-y: auto; /* capture scroll only when hovering over the table */
}

/* Keep table headers visible while scrolling */
.table-scroll table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-scroll table thead th {
  position: sticky;
  top: 0;
  z-index: 3; /* ensure above tbody cells */
  /* reinforce header background so it covers rows while sticky */
  background: var(--indigo-dye);
}

/* Smooth scroll experience on touch devices */
.table-scroll {
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.table th {
  background: var(--indigo-dye);
  color: var(--white);
  font-weight: 600;
  text-align: center;
}

.table td {
  text-align: center;
}

.table tbody tr:hover {
  background: var(--columbia-blue);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.table .highlight {
  background: var(--mint-green) !important;
  font-weight: 600;
}

.table .highlight:hover {
  background: var(--mint-green) !important;
}

/* Portfolio efficiency highlighting */
.table .efficient-portfolio {
  background: rgba(34, 139, 34, 0.12) !important;
}

.table .efficient-portfolio:hover {
  background: rgba(34, 139, 34, 0.2) !important;
}

.table .inefficient-portfolio {
  background: rgba(155, 89, 182, 0.2) !important;
}

.table .inefficient-portfolio:hover {
  background: rgba(155, 89, 182, 0.3) !important;
}

.portfolio-table-section .table th,
.portfolio-table-section .table td {
  padding: 0.5rem 0.4rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.portfolio-table-section .table th {
  font-size: 0.8rem;
}

/* Portfolio row hover effect for clicking */
#portfolio-results-body tr {
  cursor: pointer;
  transition: background-color 0.2s;
}

#portfolio-results-body tr:hover {
  background-color: rgba(95, 168, 211, 0.1);
}

/* Chart container */
.chart-container {
  position: relative;
  height: 400px;
  background: var(--white);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 1rem;
}

#efficient-frontier-chart {
  max-height: 100%;
  max-width: 100%;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--picton-blue);
  margin-bottom: 1rem;
}

.tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--indigo-dye);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab:hover {
  background: var(--columbia-blue);
}

.tab.active {
  color: var(--picton-blue);
  border-bottom-color: var(--picton-blue);
  background: var(--columbia-blue);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: #6c757d;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Text utilities */
.text-muted {
  color: #6c757d;
}

/* Mathematical Tooltip Trigger */
.math-tooltip-trigger {
  color: var(--picton-blue);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.3s ease;
}

.math-tooltip-trigger:hover {
  color: var(--moonstone);
  text-decoration: underline;
}

/* Math Modal */
.math-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.math-modal-content {
  background-color: var(--white);
  margin: 2% auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: mathModalSlideIn 0.3s ease-out;
}

@keyframes mathModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.math-modal-header {
  background: linear-gradient(135deg, var(--indigo-dye), var(--moonstone));
  color: var(--white);
  padding: 1.5rem 2rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.math-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.math-modal-close {
  color: var(--white);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.3s ease;
  line-height: 1;
}

.math-modal-close:hover {
  opacity: 0.7;
}

.math-modal-body {
  padding: 0;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  gap: 0;
}

/* Table of Contents Sidebar */
.math-toc {
  width: 280px;
  background: var(--light-gray);
  border-right: 2px solid var(--columbia-blue);
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 80vh;
  flex-shrink: 0;
}

.math-toc h4 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 2px solid var(--picton-blue);
  padding-bottom: 0.5rem;
}

.toc-section {
  margin-bottom: 1.5rem;
}

.toc-section:last-child {
  margin-bottom: 0;
}

.toc-section h5 {
  color: var(--moonstone);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--white);
  border-radius: 6px;
  border-left: 4px solid var(--picton-blue);
}

.toc-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-section li {
  margin-bottom: 0.5rem;
}

.toc-section a {
  display: block;
  color: var(--indigo-dye);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.toc-section a:hover {
  background: var(--white);
  color: var(--picton-blue);
  border-left-color: var(--picton-blue);
  transform: translateX(4px);
}

.toc-section a:active {
  background: var(--columbia-blue);
  color: var(--indigo-dye);
}

/* Main Content Area */
.math-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 80vh;
  background: var(--white);
  scroll-behavior: smooth;
}

/* Section Styling */
.main-section {
  margin-bottom: 3rem;
}

.main-section:last-child {
  margin-bottom: 1rem;
}

.section-title {
  color: var(--indigo-dye);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding: 1rem;
  background: linear-gradient(135deg, var(--columbia-blue) 0%, var(--mint-green) 100%);
  border-radius: 8px;
  border-left: 5px solid var(--picton-blue);
}

.section-title .subtitle {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
  color: #5a6c7d;
  margin-top: 0.5rem;
  opacity: 0.85;
}


/* Equation Sections */
.equation-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e9ecef;
}

.equation-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.equation-section h3 {
  color: var(--indigo-dye);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  font-weight: 600;
  border-left: 4px solid var(--picton-blue);
  padding-left: 1rem;
}

.equation-section p {
  margin-bottom: 1rem;
  color: #333;
  font-size: 1rem;
  line-height: 1.7;
}

.equation-note {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--light-gray);
  border-left: 3px solid var(--picton-blue);
  border-radius: 0 4px 4px 0;
}

/* MathJax equations styling */
.MathJax {
  font-size: 1.1em !important;
}

.math-modal-body .MathJax_Display {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

/* Options Modal */
.options-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.options-modal-content {
  background-color: var(--white);
  margin: 10% auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: visible;
  animation: optionsModalSlideIn 0.3s ease-out;
}

@keyframes optionsModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.options-modal-header {
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: var(--white);
  padding: 1.5rem 2rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.options-modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.options-modal-close {
  color: var(--white);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.3s ease;
  line-height: 1;
}

.options-modal-close:hover {
  opacity: 0.7;
}

.options-modal-body {
  padding: 2rem;
}

.option-item {
  margin-bottom: 1.5rem;
}

.option-label {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--indigo-dye);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.option-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
}

.option-input:focus {
  outline: none;
  border-color: var(--picton-blue);
  box-shadow: 0 0 0 2px rgba(95, 168, 211, 0.2);
}

.option-input[type="number"] {
  text-align: center;
}

.option-input select {
  cursor: pointer;
}

.option-description {
  font-size: 0.85rem;
  color: #6c757d;
  line-height: 1.4;
  font-style: italic;
}

.options-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Tooltip System */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--picton-blue);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
  cursor: help;
  position: relative;
  line-height: 1;
  text-align: center;
}

/* Tighter spacing for universe icons within hedge modal */
.universe-row .tooltip-icon { margin-left: 4px; }

/* Default tooltip - positions above */
.tooltip-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: var(--tooltip-bottom, 125%);
  top: var(--tooltip-top, auto);
  left: var(--tooltip-left, 50%);
  right: var(--tooltip-right, auto);
  transform: var(--tooltip-transform, translateX(-50%));
  background: var(--indigo-dye);
  color: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-line;
  max-width: 320px;
  width: max-content;
  text-align: left;
  line-height: 1.5;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: var(--tooltip-animation, tooltipFadeIn 0.2s ease-out);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.tooltip-icon:hover::before {
  content: '';
  position: absolute;
  bottom: var(--tooltip-arrow-bottom, 115%);
  top: var(--tooltip-arrow-top, auto);
  left: var(--tooltip-arrow-left, 50%);
  right: var(--tooltip-arrow-right, auto);
  transform: var(--tooltip-arrow-transform, translateX(-50%));
  border-left: var(--tooltip-arrow-border-left, 6px solid transparent);
  border-right: var(--tooltip-arrow-border-right, 6px solid transparent);
  border-top: var(--tooltip-arrow-border-top, 6px solid var(--indigo-dye));
  border-bottom: var(--tooltip-arrow-border-bottom, 0 solid transparent);
  z-index: 10001;
  animation: var(--tooltip-animation, tooltipFadeIn 0.2s ease-out);
  pointer-events: none;
}

.tooltip-icon.tooltip-right {
  --tooltip-bottom: auto;
  --tooltip-top: 50%;
  --tooltip-left: calc(100% + 12px);
  --tooltip-right: auto;
  --tooltip-transform: translateY(-50%);
  --tooltip-animation: rightTooltipFadeIn 0.2s ease-out;
  --tooltip-arrow-bottom: auto;
  --tooltip-arrow-top: 50%;
  --tooltip-arrow-left: calc(100% + 4px);
  --tooltip-arrow-right: auto;
  --tooltip-arrow-transform: translateY(-50%);
  --tooltip-arrow-border-top: 6px solid transparent;
  --tooltip-arrow-border-bottom: 6px solid transparent;
  --tooltip-arrow-border-left: 6px solid var(--indigo-dye);
  --tooltip-arrow-border-right: 0 solid transparent;
}

/* Unified rule for ALL stat-row tooltips in empirical modal - positions to the right */
.empirical-modal .stat-row .tooltip-icon:hover::after {
  top: 50% !important;
  bottom: auto !important;
  left: 125% !important;
  right: auto !important;
  transform: translateY(-50%) !important;
  max-width: min(300px, 40vw) !important;
}

.empirical-modal .stat-row .tooltip-icon:hover::before {
  top: 50% !important;
  bottom: auto !important;
  left: 115% !important;
  right: auto !important;
  transform: translateY(-50%) !important;
  border-bottom: none !important;
  border-top: none !important;
  border-left: 6px solid var(--indigo-dye) !important;
  border-right: 6px solid transparent !important;
}

/* Other modal tooltips - positioned to avoid clipping */
.options-modal .tooltip-icon,
.table-container .tooltip-icon,
.modal-content .tooltip-icon {
  position: relative;
  --tooltip-bottom: 150%;
  --tooltip-top: auto;
  --tooltip-left: auto;
  --tooltip-right: -30px;
  --tooltip-transform: none;
  --tooltip-animation: rightTooltipFadeIn;
  --tooltip-arrow-bottom: 140%;
  --tooltip-arrow-top: auto;
  --tooltip-arrow-left: auto;
  --tooltip-arrow-right: 21px;
  --tooltip-arrow-transform: none;
  --tooltip-arrow-border-left: 6px solid transparent;
  --tooltip-arrow-border-right: 6px solid transparent;
  --tooltip-arrow-border-top: 6px solid var(--indigo-dye);
  --tooltip-arrow-border-bottom: 0 solid transparent;
}

.portfolio-table-section .risk-header-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 125%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  background: var(--indigo-dye);
  color: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-line;
  max-width: min(300px, 90vw);
  width: max-content;
  text-align: left;
  line-height: 1.5;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: portfolioTooltipFadeIn 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: normal;
}

.portfolio-table-section .risk-header-tooltip:hover::before {
  content: '';
  position: absolute;
  top: 115%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--indigo-dye);
  z-index: 10001;
  animation: portfolioTooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes tooltipFadeStatic {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rightTooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(-50%);
  }
  to {
    opacity: 1;
    transform: translateY(-50%);
  }
}

@keyframes portfolioTooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Disclaimer Modal */
.disclaimer-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.disclaimer-modal-content {
  background-color: var(--white);
  margin: 10% auto;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: disclaimerModalSlideIn 0.3s ease-out;
}

@keyframes disclaimerModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.disclaimer-modal-header {
  padding: 1.5rem 2rem 1rem 2rem;
  border-bottom: 1px solid #eee;
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-radius: 12px 12px 0 0;
}

.disclaimer-modal-header h2 {
  margin: 0;
  color: var(--indigo-dye);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
}

.disclaimer-modal-body {
  padding: 1.5rem 2rem 2rem 2rem;
  line-height: 1.6;
}

.disclaimer-modal-body p {
  margin: 0 0 1rem 0;
  color: #333;
}

.disclaimer-modal-body p:first-child {
  font-size: 1.1rem;
  color: var(--indigo-dye);
  margin-bottom: 0.5rem;
}

.disclaimer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.disclaimer-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
  user-select: none;
}

.disclaimer-checkbox input[type="checkbox"] {
  margin: 0;
  accent-color: var(--picton-blue);
}

.disclaimer-checkbox span {
  line-height: 1;
}

#acknowledge-disclaimer {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Table header tooltip styling */
.risk-header-tooltip {
  position: relative;
  cursor: help;
  --tooltip-left: 50%;
  --tooltip-right: auto;
  --tooltip-transform: translateX(-50%);
  --tooltip-arrow-left: 50%;
  --tooltip-arrow-right: auto;
  --tooltip-animation: tooltipFadeIn;
}

.tooltip-right {
  position: relative;
  --tooltip-left: calc(100% + 12px);
  --tooltip-right: auto;
  --tooltip-top: 50%;
  --tooltip-arrow-top: 50%;
  --tooltip-transform: translateY(-50%);
  --tooltip-arrow-left: calc(100% + 4px);
  --tooltip-arrow-right: auto;
  --tooltip-animation: rightTooltipFadeIn;
}

.tooltip-right:hover::before {
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--indigo-dye);
  border-left: none;
}

/* Table header tooltip styling - General rule (centered positioning) */
.risk-header-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: var(--tooltip-top, 125%);
  left: var(--tooltip-left, 50%);
  right: var(--tooltip-right, auto);
  transform: var(--tooltip-transform, translateX(-50%));
  background: var(--indigo-dye);
  color: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-line;
  max-width: min(420px, 92vw);
  min-width: 260px;
  width: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
  line-height: 1.5;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: var(--tooltip-animation, tooltipFadeIn) 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: normal;
  will-change: left, right, transform;
  display: inline-block;
}

.risk-header-tooltip:hover::before {
  content: '';
  position: absolute;
  top: var(--tooltip-arrow-top, 115%);
  left: var(--tooltip-arrow-left, 50%);
  right: var(--tooltip-arrow-right, auto);
  transform: var(--tooltip-transform, translateX(-50%));
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--indigo-dye);
  z-index: 10001;
  animation: var(--tooltip-animation, tooltipFadeIn) 0.2s ease-out;
}

/* Help Icon in Top Right */
.help-icon {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--picton-blue);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.help-icon:hover {
  background: var(--indigo-dye);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.help-icon:active {
  transform: scale(0.95);
}

.help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -35px;
  right: 0;
  background: var(--dark-gray);
  color: var(--white);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 1001;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.help-icon::before {
  content: '';
  position: absolute;
  bottom: -25px;
  right: 15px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid var(--dark-gray);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1001;
}

.help-icon:hover::after,
.help-icon:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Export Modal */
.export-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.export-modal-content {
  background-color: var(--white);
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: exportModalSlideIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes exportModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.export-modal-header {
  background: var(--moonstone);
  color: var(--white);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--picton-blue);
}

.export-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.export-modal-close {
  color: var(--white);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.export-modal-close:hover {
  color: var(--columbia-blue);
}

.export-modal-body {
  padding: 2rem;
  max-height: 70vh;
  overflow-y: auto;
}

.export-modal-body p {
  margin-bottom: 1.5rem;
  color: var(--indigo-dye);
  font-size: 1.1rem;
}

.export-options {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.export-option {
  border: 2px solid var(--columbia-blue);
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.export-option:hover {
  border-color: var(--picton-blue);
  background-color: var(--columbia-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.export-option-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.export-option-content {
  flex: 1;
}

.export-option-content h3 {
  margin: 0 0 0.5rem 0;
  color: var(--indigo-dye);
  font-size: 1.2rem;
  font-weight: 600;
}

.export-option-content p {
  margin: 0 0 0.75rem 0;
  color: #6c757d;
  font-size: 0.95rem;
  line-height: 1.4;
}

.export-option-content ul {
  margin: 0;
  padding-left: 1.2rem;
  list-style-type: disc;
  display: none;
  transition: all 0.3s ease;
}

.export-option:hover .export-option-content ul {
  display: block;
}

.export-option-content li {
  color: #6c757d;
  font-size: 0.9rem;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.export-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.export-status {
  text-align: center;
  padding: 2rem;
  background: var(--columbia-blue);
  border-radius: 8px;
  margin-top: 1rem;
}

.export-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--indigo-dye);
  font-weight: 500;
}

/* Empirical Distribution Modal */
.empirical-modal {
  display: none;
  position: fixed;
  z-index: 1005;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.empirical-modal-content {
  background-color: var(--white);
  margin: 2% auto;
  padding: 0;
  width: 90%;
  max-width: 1000px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: modalFadeIn 0.3s ease-out;
  overflow: visible;
}

.empirical-modal-header {
  background: linear-gradient(135deg, var(--indigo-dye), var(--moonstone));
  color: var(--white);
  padding: 1.5rem 2rem;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.empirical-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.empirical-modal-close {
  color: var(--white);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.empirical-modal-close:hover {
  opacity: 0.7;
}

.empirical-modal-body {
  padding: 2rem;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: visible;
  position: relative;
}

.empirical-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--light-gray);
  overflow: visible;
}

.empirical-section:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
}

.empirical-section h3 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
}

/* Stats Grid */
.empirical-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--columbia-blue);
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--moonstone);
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--indigo-dye);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  color: var(--indigo-dye);
  margin-bottom: 0.5rem;
}

.stat-note {
  display: block;
  font-size: 0.8rem;
  color: var(--dark-gray);
  font-style: italic;
}

.stat-card-small {
  background: var(--columbia-blue);
  padding: 0.75rem;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--moonstone);
}

.stat-label-small {
  display: block;
  font-size: 0.75rem;
  color: var(--indigo-dye);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.stat-value-small {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--indigo-dye);
  margin-bottom: 0.2rem;
}

.stat-note-small {
  display: block;
  font-size: 0.65rem;
  color: var(--dark-gray);
  font-style: italic;
  margin-top: 0.2rem;
}

/* Portfolio weights table */
.portfolio-weights-table {
  margin-bottom: 1.5rem;
}

.portfolio-weights-table h4 {
  margin: 0 0 0.75rem 0;
  color: var(--indigo-dye);
  font-size: 1rem;
  font-weight: 600;
}

#emp-weights-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#emp-weights-table th,
#emp-weights-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  font-size: 0.85rem;
}

#emp-weights-table th {
  background: var(--moonstone);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#emp-weights-table tbody tr:hover {
  background: var(--columbia-blue);
}

#emp-weights-table tbody tr:last-child td {
  border-bottom: none;
}

/* Empirical Explanation */
.empirical-explanation {
  background: var(--mint-green);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--moonstone);
}

.empirical-explanation h4 {
  color: var(--indigo-dye);
  margin-bottom: 0.75rem;
}

.empirical-explanation ul {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.empirical-explanation li {
  margin-bottom: 0.5rem;
}

/* Distribution Stats */
.distribution-stats {
  background: var(--light-gray);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  overflow: visible;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.stat-row:not(:last-child) {
  border-bottom: 1px solid #ddd;
}

.stat-row .stat-value {
  text-align: right;
  font-weight: bold;
  color: var(--indigo-dye);
}

/* Chart Controls */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--light-gray);
  border-radius: 8px;
  border: 1px solid #ddd;
}

.ci-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ci-toggle-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--moonstone);
}

.ci-toggle-container label {
  font-weight: 500;
  color: var(--indigo-dye);
  cursor: pointer;
}

.ci-info {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--dark-gray);
}

.ci-info strong {
  color: var(--indigo-dye);
}



/* Compact CI Controls Section */
.ci-controls-section {
  background: var(--columbia-blue);
  border: 1px solid var(--moonstone);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0 2rem 0;
}

.ci-instruction {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  text-align: center;
  color: var(--dark-gray);
}

.ci-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.range-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-input-group label {
  font-weight: 500;
  color: var(--indigo-dye);
  min-width: 40px;
}

.range-input-group input[type="number"] {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--moonstone);
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
}

.range-input-group input[type="number"]:focus {
  outline: none;
  border-color: var(--picton-blue);
  box-shadow: 0 0 0 2px rgba(95, 168, 211, 0.2);
}

.range-separator {
  font-size: 1.1rem;
  color: var(--dark-gray);
  font-weight: 500;
}

.ci-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  text-align: center;
}

.ci-result strong {
  color: var(--indigo-dye);
  font-size: 1.1rem;
}

.ci-periods {
  font-size: 0.9rem;
  color: var(--dark-gray);
  font-style: italic;
}

/* Add space between sections */
.distribution-stats {
  margin-top: 2rem;
}

.var-analysis-section {
  margin-top: 3rem;
}



/* VaR Controls */
.var-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.var-controls input[type="number"] {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--moonstone);
  border-radius: 4px;
}

.var-display {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.var-value {
  font-size: 2rem;
  font-weight: bold;
  color: #d63031;
  margin: 1rem 0;
}

.var-note {
  font-size: 0.85rem;
  color: var(--dark-gray);
  font-style: italic;
}

.empirical-footer {
  text-align: center;
  padding-top: 1rem;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

/* Analyze Page Specific Styles */
.analyze-input-section {
  margin-bottom: 2rem;
}


.analyze-ticker-form {
  display: grid;
  grid-template-columns: 1fr 200px 140px;
  gap: 1rem;
  align-items: end;
}

.ticker-search-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.ticker-search-container label,
.weight-input-group label {
  font-weight: 500;
  color: var(--indigo-dye);
  font-size: 0.9rem;
}

.weight-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.weight-input-group input {
  padding: 0.75rem;
  border: 2px solid var(--columbia-blue);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.weight-input-group input:focus {
  outline: none;
  border-color: var(--picton-blue);
  box-shadow: 0 0 0 3px rgba(95, 168, 211, 0.1);
}

.analyze-portfolio-section {
  margin-bottom: 2rem;
}

.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.portfolio-header h4 {
  color: var(--indigo-dye);
  margin: 0;
}


.portfolio-summary-clean {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--dark-gray);
}

.summary-item {
  color: var(--indigo-dye);
}

.portfolio-items {
  border: 2px solid var(--columbia-blue);
  border-radius: 8px;
  min-height: 100px;
  padding: 1rem;
}

.empty-portfolio {
  text-align: center;
  color: var(--dark-gray);
  font-style: italic;
  padding: 2rem;
}

.portfolio-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--mint-green);
  border-radius: 8px;
  border: 1px solid var(--moonstone);
}

.portfolio-item:last-child {
  margin-bottom: 0;
}

.portfolio-item-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portfolio-ticker {
  font-weight: bold;
  color: var(--indigo-dye);
  min-width: 60px;
}

.portfolio-weight {
  color: var(--dark-gray);
  font-size: 0.9rem;
}

.portfolio-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.weight-edit {
  width: 80px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--moonstone);
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
}

.weight-validation {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #ffc107;
  background: #fff3cd;
}

.validation-message {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.validation-message.warning {
  color: #856404;
}

.validation-message.error {
  color: #721c24;
}

.validation-actions {
  display: flex;
  gap: 0.5rem;
}

.analyze-options-section {
  margin-bottom: 2rem;
}

.analyze-options-section h4 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--columbia-blue);
  padding-bottom: 0.5rem;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.option-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-item label {
  font-weight: 500;
  color: var(--indigo-dye);
  font-size: 0.9rem;
}

.option-item select,
.option-item input {
  padding: 0.75rem;
  border: 2px solid var(--columbia-blue);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--white);
}

.option-item select:focus,
.option-item input:focus {
  outline: none;
  border-color: var(--picton-blue);
  box-shadow: 0 0 0 3px rgba(95, 168, 211, 0.1);
}

.loading-section {
  text-align: center;
  padding: 3rem 0;
}

.loading-spinner-large {
  width: 60px;
  height: 60px;
  border: 6px solid var(--columbia-blue);
  border-top: 6px solid var(--picton-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.portfolio-summary-section {
  margin-bottom: 1.5rem;
  background: var(--columbia-blue);
  border-radius: 8px;
  border: 2px solid var(--moonstone);
  overflow: hidden;
}

.portfolio-summary-section h3 {
  color: var(--indigo-dye);
  margin: 0;
  padding: 1rem 1.5rem 0.5rem;
  text-align: center;
  font-size: 1.2rem;
}

.portfolio-weights-section {
  background: var(--white);
  margin: 0 1.5rem 1rem;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.portfolio-weights-section h4 {
  margin: 0 0 0.75rem 0;
  color: var(--indigo-dye);
  font-size: 0.95rem;
  font-weight: 600;
}

.stats-section {
  padding: 0 1.5rem 1.5rem;
}

#main-weights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#main-weights-table th,
#main-weights-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

#main-weights-table th {
  background: transparent;
  font-weight: 600;
  color: var(--indigo-dye);
  font-size: 0.85rem;
}

#main-weights-table tbody tr:hover {
  background: #f8f9fa;
}

/* Fix analysis period font size */
.stat-value-small {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--indigo-dye);
  line-height: 1.2;
}

#analysis-period.stat-value-small {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* Increase spacing between distribution characteristics and important note */
.distribution-note {
  margin-top: 2rem !important;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.summary-card {
  background: var(--white);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--moonstone);
}

.summary-label {
  display: block;
  font-size: 0.9rem;
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
}

.summary-value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--indigo-dye);
}

.portfolio-summary-section-slim {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--columbia-blue);
  border-radius: 6px;
  border: 1px solid var(--moonstone);
}

.portfolio-summary-section-slim h3 {
  color: var(--indigo-dye);
  margin-bottom: 0.75rem;
  text-align: center;
  font-size: 1.1rem;
}

.summary-grid-slim {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.summary-card-slim {
  background: var(--white);
  padding: 0.75rem;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--moonstone);
}

.summary-label-slim {
  display: block;
  font-size: 0.8rem;
  color: var(--dark-gray);
  margin-bottom: 0.25rem;
}

.summary-value-slim {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--indigo-dye);
}

.composition-chart-container {
  height: 300px;
  margin: 1rem 0 2rem 0;
  background: var(--white);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--columbia-blue);
}


.empirical-portfolio-summary {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--mint-green);
  border-radius: 6px;
  border: 1px solid var(--moonstone);
}

.empirical-portfolio-summary h5 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
  text-align: center;
}

.empirical-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.empirical-chart-section {
  margin-bottom: 2rem;
}

.empirical-chart-section h5 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
}

.distribution-stats {
  margin-top: 2rem;
}

.distribution-stats h5 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
}

.distribution-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.distribution-insights {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--columbia-blue);
  border-radius: 6px;
  border: 1px solid var(--moonstone);
}

.insight-item {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--white);
  border-radius: 4px;
  border-left: 4px solid var(--picton-blue);
}

.insight-item:last-child {
  margin-bottom: 0;
}


.clickable-row {
  cursor: pointer;
  transition: background-color 0.2s;
}

.clickable-row:hover {
  background-color: var(--mint-green);
}

.type-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
}

.type-badge.equity {
  background: #e3f2fd;
  color: #1976d2;
}

.type-badge.etf {
  background: #f3e5f5;
  color: #7b1fa2;
}

.type-badge.mutual {
  background: #fff3e0;
  color: #f57c00;
}

.header-nav .nav-link:hover {
  background: rgba(255,255,255,0.3) !important;
}

/* Responsive design adjustments for analyze page */
@media (max-width: 768px) {
  .analyze-ticker-form {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .portfolio-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .portfolio-summary-clean {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .portfolio-item {
    flex-direction: column;
    gap: 1rem;
  }
  
  .portfolio-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .summary-grid,
  .summary-grid-slim {
    grid-template-columns: 1fr;
  }
}

/* Responsive design */
@media (max-width: 1200px) {
  .portfolio-results-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .portfolio-chart-section {
    order: -1;
  }
}

@media (max-width: 1024px) {
  .math-modal-content {
    width: 95%;
    max-width: none;
    margin: 2.5% auto;
  }
  
  .math-modal-body {
    flex-direction: column;
    max-height: 85vh;
  }
  
  .math-toc {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 2px solid var(--columbia-blue);
    padding: 1rem;
  }
  
  .toc-section {
    display: inline-block;
    margin-right: 2rem;
    margin-bottom: 1rem;
    vertical-align: top;
    width: calc(50% - 1rem);
  }
  
  .math-content {
    max-height: calc(85vh - 200px);
    padding: 1rem;
  }
  
  .section-title {
    font-size: 1.3rem;
    padding: 0.75rem;
  }
}

@media (max-width: 768px) {
  .header__title {
    font-size: 2rem;
  }
  
  .ticker-input-section {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab {
    border-bottom: 1px solid #dee2e6;
    border-right: none;
  }
  
  .tab.active {
    border-bottom-color: #dee2e6;
    border-left: 3px solid var(--picton-blue);
  }
  
  .help-icon {
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
  
  .help-icon::after {
    bottom: -38px;
    right: 0;
    font-size: 10px;
    padding: 5px 8px;
    max-width: 100px;
  }
  
  .help-icon::before {
    right: 12px;
    bottom: -28px;
  }
  
  .options-modal-content {
    width: 95%;
    margin: 15% auto;
  }
  
  .options-modal-header {
    padding: 1rem 1.5rem;
  }
  
  .options-modal-header h2 {
    font-size: 1.1rem;
  }
  
  .options-modal-body {
    padding: 1.5rem;
  }
  
  .options-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .disclaimer-modal-content {
    width: 95%;
    margin: 15% auto;
  }
  
  .disclaimer-modal-header {
    padding: 1rem 1.5rem;
  }
  
  .disclaimer-modal-header h2 {
    font-size: 1.1rem;
  }
  
  .disclaimer-modal-body {
    padding: 1.5rem;
  }
  
  .disclaimer-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .disclaimer-checkbox {
    justify-content: center;
  }
  
  .export-modal-content {
    width: 95%;
    margin: 10% auto;
  }
  
  .export-modal-header {
    padding: 1rem;
  }
  
  .export-modal-header h2 {
    font-size: 1.3rem;
  }
  
  .export-modal-body {
    padding: 1.5rem;
  }
  
  .export-option {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .export-option-icon {
    font-size: 2rem;
  }
  
  .empirical-modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .empirical-stats-grid {
    grid-template-columns: 1fr;
  }
  

  
  .var-controls {
    flex-wrap: wrap;
  }
  
  .chart-controls {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  
  .ci-info {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  

  
  .tooltip-icon:hover::after {
    max-width: min(280px, 85vw);
    left: auto;
    right: -40px;
    transform: none;
    margin-right: 0;
    bottom: 150%;
    top: auto;
  }

  .tooltip-icon:hover::before {
    left: auto;
    right: 17px;
    transform: none;
    bottom: 140%;
    top: auto;
  }

  /* Mobile handling for empirical modal tooltips */
  .empirical-modal .stat-row .tooltip-icon:hover::after {
    max-width: min(200px, 50vw) !important;
    top: 50% !important;
    bottom: auto !important;
    left: 125% !important;
    right: auto !important;
    transform: translateY(-50%) !important;
  }

  .empirical-modal .stat-row .tooltip-icon:hover::before {
    top: 50% !important;
    bottom: auto !important;
    left: 115% !important;
    right: auto !important;
    transform: translateY(-50%) !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: 6px solid var(--indigo-dye) !important;
    border-right: 6px solid transparent !important;
  }
  
  .risk-header-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 125%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    background: var(--indigo-dye);
    color: var(--white);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: normal;
    max-width: min(280px, 90vw);
    width: max-content;
    text-align: left;
    line-height: 1.5;
    z-index: 10001;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: portfolioTooltipFadeIn 0.2s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: normal;
  }
  
  .risk-header-tooltip:hover::before {
    content: '';
    position: absolute;
    top: 115%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--indigo-dye);
    z-index: 10001;
    animation: portfolioTooltipFadeIn 0.2s ease-out;
  }
  
  .toc-section {
    width: 100%;
    margin-right: 0;
  }
  
  .math-toc {
    max-height: 150px;
  }
  
  .math-content {
    max-height: calc(85vh - 150px);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }
  .header { padding: var(--spacing-lg) 0; }
  .header__title { font-size: 1.75rem; }
  
  .card-body {
    padding: 1rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
} 

/* Empirical Distribution Loading Screen */
.empirical-loading-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1006;
}

.empirical-loading-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2.5rem;
    text-align: center;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--columbia-blue);
    border-radius: 12px;
    max-width: 500px;
    width: calc(100% - 6rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1007;
}

.empirical-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid var(--mint-green);
    border-top: 6px solid var(--moonstone);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.empirical-loading-screen h3 {
    color: var(--indigo-dye);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empirical-loading-screen p {
    color: var(--indigo-dye);
    font-size: 1.1rem;
    margin-bottom: 0;
    opacity: 0.8;
}



@media (max-width: 768px) {
    .empirical-loading-content {
        padding: 2rem;
        min-height: 300px;
        width: calc(100% - 4rem);
        max-width: 400px;
    }
    
    .empirical-loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .empirical-loading-screen h3 {
        font-size: 1.3rem;
    }
    
    .empirical-loading-screen p {
        font-size: 1rem;
    }
}

/* Ticker Profile Modal */
.ticker-profile-modal {
  display: none;
  position: fixed;
  z-index: 1008;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.ticker-profile-modal-content {
  background-color: var(--white);
  margin: 2% auto;
  padding: 0;
  width: 95%;
  max-width: 1200px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: modalFadeIn 0.3s ease-out;
  overflow: visible;
}

.ticker-profile-modal-header {
  background: linear-gradient(135deg, var(--indigo-dye), var(--moonstone));
  color: var(--white);
  padding: 1.5rem 2rem;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticker-profile-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.ticker-profile-modal-close {
  color: var(--white);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.ticker-profile-modal-close:hover {
  opacity: 0.7;
}

.ticker-profile-modal-body {
  padding: 2rem;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: visible;
  position: relative;
}

.ticker-profile-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--light-gray);
}

.ticker-profile-section:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
}

.ticker-profile-section h3 {
  color: var(--indigo-dye);
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
}

/* Basic Info Section */
.ticker-profile-basic-info {
  text-align: center;
  margin-bottom: 1.5rem;
}

.ticker-profile-symbol-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.ticker-profile-symbol-header h3 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--indigo-dye);
}

.ticker-profile-type-badge {
  background: var(--picton-blue);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticker-profile-type-badge.etf {
  background: var(--moonstone);
}

.ticker-profile-description {
  color: #6c757d;
  line-height: 1.6;
  max-width: 1000px;
  margin: 1rem auto 0;
  text-align: left;
  font-size: 1.1rem;
}

/* Chart Container */
.ticker-profile-chart-container {
  height: 400px;
  width: 100%;
  background: var(--white);
  border-radius: 8px;
  border: 1px solid #e9ecef;
  overflow: hidden;
  position: relative;
}

.ticker-profile-chart-container .tradingview-widget-container {
  width: 100% !important;
  height: 100% !important;
}

.ticker-profile-chart-container .tradingview-widget-container__widget {
  width: 100% !important;
  height: calc(100% - 32px) !important;
}

/* Metrics Grid */
.ticker-profile-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ticker-profile-metric {
  background: var(--columbia-blue);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--moonstone);
}

.metric-label {
  display: block;
  font-size: 0.9rem;
  color: var(--indigo-dye);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.metric-value {
  display: block;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--indigo-dye);
}

/* Company Details Layout */
.ticker-profile-company-details {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 1.5rem;
}

.company-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1rem;
}

.company-detail-row:last-child {
  margin-bottom: 0;
}

.company-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--white);
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.detail-label {
  font-weight: 600;
  color: var(--indigo-dye);
  margin-right: 1rem;
}

.detail-value {
  color: #495057;
  font-weight: 500;
  text-align: right;
}

/* Holdings and Sectors */
.ticker-profile-holdings,
.ticker-profile-sectors {
  background: var(--light-gray);
  border-radius: 8px;
  padding: 1rem;
}

.ticker-profile-holding,
.ticker-profile-sector {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #dee2e6;
}

.ticker-profile-holding:last-child,
.ticker-profile-sector:last-child {
  border-bottom: none;
}

.holding-info,
.sector-info {
  flex: 1;
}

.holding-symbol,
.sector-name {
  font-weight: 600;
  color: var(--indigo-dye);
  font-size: 0.95rem;
}

.holding-name {
  color: #6c757d;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.holding-weight,
.sector-weight {
  font-weight: 600;
  color: var(--picton-blue);
  font-size: 0.95rem;
}

/* Fundamentals Widget */
.ticker-profile-fundamentals {
  width: 100%;
  min-height: 550px;
  background: var(--white);
  border-radius: 8px;
  border: 1px solid #e9ecef;
  overflow: visible;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
}

.ticker-profile-fundamentals .tradingview-widget-container {
  width: 100% !important;
  height: 400px !important;
  margin: 0 auto !important;
}

.ticker-profile-fundamentals .tradingview-widget-container__widget {
  width: 100% !important;
  height: calc(100% - 32px) !important;
}

/* Footer */
.ticker-profile-footer {
  text-align: center;
  padding-top: 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--light-gray);
}

/* Loading Screen */
.ticker-profile-loading-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1009;
  justify-content: center;
  align-items: center;
}

.ticker-profile-loading-content {
  padding: 2.5rem;
  text-align: center;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--columbia-blue);
  border-radius: 12px;
  max-width: 500px;
  width: calc(100% - 6rem);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  z-index: 1010;
}

.ticker-profile-loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--mint-green);
  border-top: 6px solid var(--moonstone);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ticker-profile-loading-screen h3 {
  color: var(--indigo-dye);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.ticker-profile-loading-screen p {
  color: var(--indigo-dye);
  font-size: 1.1rem;
  margin-bottom: 0;
  opacity: 0.8;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ticker-profile-modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .ticker-profile-symbol-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .ticker-profile-symbol-header h3 {
    font-size: 2rem;
  }
  
  .ticker-profile-metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .company-detail-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .ticker-profile-chart-container {
    height: 300px;
  }
  
  .ticker-profile-fundamentals {
    min-height: 400px;
  }
}

/* Distribution stats tooltips on analyze page - position to the right */
.distribution-stats .tooltip-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50% !important;
  left: 120% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  background: var(--indigo-dye);
  color: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-line !important;
  line-height: 1.5;
  width: 350px !important;
  max-width: 85vw !important;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: rightTooltipFadeIn 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  text-align: left !important;
  word-wrap: break-word;
}

.distribution-stats .tooltip-icon:hover::before {
  content: '';
  position: absolute;
  top: 50% !important;
  left: 110% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--indigo-dye);
  border-left: none;
  z-index: 10001;
  animation: rightTooltipFadeIn 0.2s ease-out;
  pointer-events: none;
}

/* Analyze page tooltip positioning */
.analyze-options-section .tooltip-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50% !important;
  left: 120% !important;
  right: auto !important;
  transform: translateY(-50%) !important;
  background: var(--indigo-dye);
  color: var(--white);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-line !important;
  line-height: 1.5;
  width: 400px !important;
  max-width: 90vw !important;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: rightTooltipFadeIn 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  text-align: left !important;
  word-wrap: break-word;
  bottom: auto !important;
}

.analyze-options-section .tooltip-icon:hover::before {
  content: '';
  position: absolute;
  top: 50% !important;
  left: 110% !important;
  right: auto !important;
  transform: translateY(-50%) !important;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--indigo-dye);
  border-left: none;
  z-index: 10001;
  animation: rightTooltipFadeIn 0.2s ease-out;
  pointer-events: none;
}
