/* Finance Hub — site theme bridge (pairs with style.css + hsi-styles.css) */

body.finhub-page {
  padding-top: 72px;
  background: var(--light-background, #f3f4f6);
  color: var(--text-color, #1f2937);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Sticky FinHub section nav (mirrors snake-hub pattern) */
.finhub-subnav {
  position: sticky;
  top: 72px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  padding: 0.65rem 1rem;
}

.finhub-subnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.finhub-subnav-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.finhub-subnav-title i {
  color: var(--primary-color);
}

.finhub-subnav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.finhub-subnav-links a {
  text-decoration: none;
  color: var(--light-text, #4b5563);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.finhub-subnav-links a:hover {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
}

.finhub-subnav-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.finhub-subnav-actions .btn {
  font-size: 0.78rem;
}

/* Site header — do not apply FinHub dark navbar rules */
.finhub-page .modern-header .navbar {
  background: transparent;
  box-shadow: none;
  padding: 1rem 2rem;
}

.finhub-page .modern-header .navbar-brand,
.finhub-page .modern-header .nav-link {
  color: inherit;
}

.finhub-page .modern-header .nav-link:hover {
  color: var(--primary-color) !important;
}

/* Cards */
.finhub-page .card {
  background: #ffffff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
}

.finhub-page .card .card-header {
  background: linear-gradient(to right, #f9fafb, #ffffff);
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  position: relative;
}

.finhub-page .card .card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius, 10px) var(--radius, 10px) 0 0;
}

.finhub-page .card .card-header i {
  color: var(--primary-color);
}

.finhub-page .card.glass-effect {
  background: #ffffff;
  backdrop-filter: none;
  border: 1px solid var(--border-color, #e5e7eb);
}

/* Outline buttons on light FinHub */
.finhub-page .btn-outline-primary {
  color: var(--primary-color, #2563eb);
  border-color: #cbd5e1;
  background: #fff;
}

.finhub-page .btn-outline-primary:hover,
.finhub-page .btn-outline-primary.active,
.finhub-page .btn-outline-primary:focus {
  color: #fff;
  background-color: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
}

.finhub-page .btn-outline-light {
  color: var(--primary-color, #2563eb);
  border-color: #cbd5e1;
  background: #fff;
}

.finhub-page .btn-outline-light:hover,
.finhub-page .btn-outline-light.active,
.finhub-page .btn-outline-light:focus {
  color: #fff;
  background-color: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
}

/* Data badges */
.finhub-page .data-badge {
  background: #f3f4f6;
  color: var(--light-text);
  border: 1px solid var(--border-color, #e5e7eb);
}

/* HSI summary block */
.finhub-page #market-summary {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(14, 165, 233, 0.04));
  border: 1px solid var(--border-color, #e5e7eb);
  padding: 0;
}

.finhub-page #market-summary p,
.finhub-page #hsiIndex-last-updated {
  color: var(--light-text);
}

/* Tables */
.finhub-page .table thead th {
  background-color: #f9fafb !important;
  color: var(--light-text) !important;
  border-bottom: 2px solid var(--border-color, #e5e7eb) !important;
}

.finhub-page .table tbody tr {
  background-color: #fff !important;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .table tbody tr:nth-child(even) {
  background-color: #f9fafb !important;
}

.finhub-page .table td,
.finhub-page .table th {
  border-top: 1px solid var(--border-color, #e5e7eb);
  color: var(--text-color) !important;
}

.finhub-page .table td:first-child,
.finhub-page .table td:nth-child(2) {
  color: var(--text-color) !important;
}

/* News (hsi-styles news-item rules) */
.finhub-page .news-item {
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .news-item:hover {
  background-color: rgba(37, 99, 235, 0.04);
}

.finhub-page .news-item h3.news-title {
  color: var(--text-color);
}

.finhub-page .news-meta,
.finhub-page .news-item .news-summary,
.finhub-page .news-item .impact-score-label {
  color: var(--light-text);
}

.finhub-page .news-item .impact-score-container,
.finhub-page #news-modal .impact-score-badge {
  background-color: #f3f4f6;
}

.finhub-page .news-item .company-badge {
  background-color: #e5e7eb;
  color: var(--text-color);
}

.finhub-page .news-item .company-badge:hover {
  background-color: #d1d5db;
}

/* Panel cards */
.finhub-page .global-market-card {
  background: #ffffff;
  border: 1px solid var(--border-color, #e5e7eb);
  box-shadow: var(--shadow);
}

.finhub-page .global-market-card:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.finhub-page .opportunity-card,
.finhub-page .watchlist-card {
  background: #ffffff;
  border: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .portfolio-stress-card {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
}

.finhub-page .opportunity-stress,
.finhub-page .opportunity-backtest {
  border-top-color: var(--border-color, #e5e7eb);
}

.finhub-page .opportunity-news {
  background: rgba(37, 99, 235, 0.06);
  border-left-color: var(--primary-color);
}

.finhub-page .opportunity-score {
  color: var(--primary-color);
}

/* Forex */
.finhub-page .forex-pair-card {
  background: #f9fafb;
  border: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .forex-pair-card:hover {
  border-color: rgba(37, 99, 235, 0.3);
}

.finhub-page .chart-controls {
  background: #f3f4f6;
}

.finhub-page .loading-spinner {
  border-color: rgba(37, 99, 235, 0.15);
  border-top-color: var(--primary-color);
}

/* Footer */
.finhub-page footer {
  background-color: #ffffff !important;
  border-top: 1px solid var(--border-color, #e5e7eb) !important;
}

.finhub-page footer .border-secondary {
  border-color: var(--border-color, #e5e7eb) !important;
}

.finhub-page footer a {
  color: var(--primary-color);
}

/* Modals */
.finhub-page .modal-content {
  background-color: #ffffff;
  color: var(--text-color);
  border: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .modal-header,
.finhub-page .modal-footer {
  background-color: #f9fafb;
  border-color: var(--border-color, #e5e7eb);
}

.finhub-page #news-modal .modal-content,
.finhub-page #news-modal .modal-header,
.finhub-page #news-modal .modal-footer,
.finhub-page #company-modal .modal-content,
.finhub-page #historical-modal .modal-content {
  background-color: #ffffff;
  color: var(--text-color);
}

.finhub-page #news-modal .news-summary,
.finhub-page #news-modal .company-card {
  background-color: #f9fafb;
  border-color: var(--border-color, #e5e7eb);
  color: var(--text-color);
}

.finhub-page .data-source,
.finhub-page .last-updated {
  color: var(--light-text);
}

/* Status indicator */
.finhub-page .status-indicator {
  background: #f3f4f6;
  color: var(--light-text);
  border: 1px solid var(--border-color, #e5e7eb);
}

@media (max-width: 768px) {
  .finhub-subnav-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .finhub-subnav-actions {
    width: 100%;
  }
}

/* ==========================================================================
   Readability & contrast — overrides legacy dark-theme rules on light FinHub
   ========================================================================== */

/* Typography utilities (hsi-styles used light-on-dark values globally) */
.finhub-page .text-muted {
  color: #6b7280 !important;
}

.finhub-page .text-secondary {
  color: #4b5563 !important;
}

.finhub-page .text-primary {
  color: var(--primary-color, #2563eb) !important;
}

.finhub-page .text-success {
  color: #059669 !important;
}

.finhub-page .text-danger {
  color: #dc2626 !important;
}

.finhub-page .text-warning {
  color: #d97706 !important;
}

.finhub-page .text-info {
  color: #0284c7 !important;
}

/* Forms */
.finhub-page .form-control,
.finhub-page .form-select,
.finhub-page input,
.finhub-page select,
.finhub-page textarea {
  background-color: #ffffff !important;
  border: 1px solid var(--border-color, #e5e7eb) !important;
  color: var(--text-color, #1f2937) !important;
}

.finhub-page .form-control:focus,
.finhub-page .form-select:focus,
.finhub-page input:focus,
.finhub-page select:focus,
.finhub-page textarea:focus {
  background-color: #ffffff !important;
  border-color: var(--primary-color, #2563eb) !important;
  color: var(--text-color, #1f2937) !important;
  box-shadow: var(--shadow-focus, 0 0 0 3px rgba(37, 99, 235, 0.3));
}

.finhub-page .form-control::placeholder {
  color: #9ca3af !important;
}

/* Card headers & body copy */
.finhub-page .card .card-header,
.finhub-page .card .card-header h5,
.finhub-page .card .card-header span,
.finhub-page .card .card-body,
.finhub-page .card-text {
  color: var(--text-color, #1f2937);
}

.finhub-page .card .card-header small {
  color: #6b7280 !important;
}

/* Symbol search in sub-nav (hsi-styles #symbol-search-btn was white) */
.finhub-page #symbol-search-btn {
  color: var(--light-text, #4b5563) !important;
}

.finhub-page #symbol-search-btn:hover {
  color: var(--primary-color, #2563eb) !important;
}

/* Forex values */
.finhub-page .forex-pair-card h5,
.finhub-page .forex-pair-card #forex-bid,
.finhub-page .forex-pair-card #forex-ask,
.finhub-page .forex-pair-card #forex-change {
  color: var(--text-color, #1f2937) !important;
}

.finhub-page .forex-pair-card .label {
  color: #6b7280 !important;
}

/* HSI value block */
.finhub-page #hsi-value,
.finhub-page #hsi-change,
.finhub-page .value-display .amount {
  color: var(--text-color, #1f2937) !important;
}

/* Market movers */
.finhub-page .market-movers-card .card-header {
  background: linear-gradient(to right, #f9fafb, #ffffff) !important;
  color: var(--text-color, #1f2937) !important;
}

.finhub-page .market-movers-table thead th {
  background-color: #f9fafb !important;
  color: #6b7280 !important;
}

.finhub-page .market-movers-table td,
.finhub-page .market-movers-table .company-name {
  color: var(--text-color, #1f2937) !important;
}

/* Modals — full light reset */
.finhub-page .modal-content,
.finhub-page .modal-header,
.finhub-page .modal-body,
.finhub-page .modal-footer,
.finhub-page .modal-title {
  color: var(--text-color, #1f2937) !important;
}

.finhub-page #company-modal #company-name,
.finhub-page #company-modal h5,
.finhub-page #company-modal .company-price #company-price,
.finhub-page #company-modal #company-description,
.finhub-page #company-modal .table td:last-child,
.finhub-page #historical-modal .modal-body,
.finhub-page #symbolSearchModal .modal-body,
.finhub-page #symbolSearchModal .list-group-item {
  color: var(--text-color, #1f2937) !important;
}

.finhub-page #company-modal .company-symbol,
.finhub-page #company-modal .table td:first-child,
.finhub-page #company-modal .news-date {
  color: #6b7280 !important;
}

.finhub-page #company-modal .news-title a {
  color: var(--primary-color, #2563eb) !important;
}

.finhub-page #symbolSearchModal .list-group-item {
  background-color: #ffffff;
  border-color: var(--border-color, #e5e7eb);
}

.finhub-page #symbolSearchModal .list-group-item:hover {
  background-color: #f3f4f6;
}

.finhub-page .btn-close {
  filter: none;
  opacity: 0.6;
}

/* Toasts & notifications */
.finhub-page .toast,
.finhub-page #notification-container .toast {
  background-color: #ffffff !important;
  color: var(--text-color, #1f2937) !important;
  border: 1px solid var(--border-color, #e5e7eb) !important;
  box-shadow: var(--shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.finhub-page .toast .toast-header {
  background-color: #f9fafb !important;
  color: var(--text-color, #1f2937) !important;
  border-bottom: 1px solid var(--border-color, #e5e7eb) !important;
}

.finhub-page .toast .toast-body {
  color: var(--text-color, #1f2937) !important;
}

.finhub-page .toast .btn-close {
  filter: none !important;
}

.finhub-page .toast.success-toast .toast-header {
  color: #059669 !important;
}

.finhub-page .toast.error-toast .toast-header {
  color: #dc2626 !important;
}

.finhub-page .toast.warning-toast .toast-header {
  color: #d97706 !important;
}

.finhub-page .toast.info-toast .toast-header {
  color: #0284c7 !important;
}

/* Override OS dark-mode rules from error-handler.css on FinHub */
.finhub-page .api-status-indicator {
  background-color: #f8f9fa !important;
  border-color: #dee2e6 !important;
  color: var(--text-color, #1f2937) !important;
}

/* Opportunity / watchlist inner text */
.finhub-page .opportunity-card,
.finhub-page .opportunity-card strong,
.finhub-page .opportunity-details,
.finhub-page .watchlist-card,
.finhub-page .watchlist-details,
.finhub-page .global-market-name,
.finhub-page .global-market-price {
  color: var(--text-color, #1f2937);
}

.finhub-page .opportunity-thesis,
.finhub-page .opportunity-details .label,
.finhub-page .global-market-meta,
.finhub-page .opportunity-backtest-text {
  color: #4b5563 !important;
}

/* Chart controls */
.finhub-page .chart-controls {
  color: var(--text-color, #1f2937);
}

/* Footer */
.finhub-page footer,
.finhub-page footer p,
.finhub-page footer h6,
.finhub-page footer .text-muted {
  color: #6b7280 !important;
}

/* Positive / negative — darker greens/reds for light bg */
.finhub-page .positive,
.finhub-page .positive-change,
.finhub-page .global-market-change.positive,
.finhub-page .market-movers-table .change-value.positive {
  color: #059669 !important;
}

.finhub-page .negative,
.finhub-page .negative-change,
.finhub-page .global-market-change.negative,
.finhub-page .market-movers-table .change-value.negative {
  color: #dc2626 !important;
}

.finhub-page .market-movers-table thead th.text-end,
.finhub-page .market-movers-table .change-value {
  text-align: right !important;
}

.finhub-page .market-movers-card .card-header .text-muted {
  color: #6b7280 !important;
}

/* Enhanced news items block in hsi-styles */
.finhub-page .news-item {
  background: #ffffff;
  border: 1px solid var(--border-color, #e5e7eb);
}

.finhub-page .news-item:hover {
  background: #f9fafb;
  box-shadow: var(--shadow);
}
