/* ============================================================
   GLOBAL STYLES

   Minimal overrides on top of Bootstrap 5.
   A4 report pages use a4-report.css separately.
   ============================================================ */

body {
  font-family: var(--bs-font-sans-serif) !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--bs-headings-font-family) !important;
}

.navbar-brand {
  font-family: var(--bs-headings-font-family) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================================
   NAVBAR THEME-AWARE TEXT COLORS
   ============================================================ */

.navbar-theme-text {
  color: var(--bs-body-color) !important;
}

.navbar-theme-text .navbar-brand,
.navbar-theme-text .navbar-nav .nav-link,
.navbar-theme-text .navbar-text {
  color: var(--bs-body-color) !important;
}

.navbar-theme-text .navbar-brand:hover,
.navbar-theme-text .navbar-nav .nav-link:hover {
  color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .navbar-theme-text {
  color: var(--bs-white) !important;
}

[data-bs-theme="dark"] .navbar-theme-text .navbar-brand,
[data-bs-theme="dark"] .navbar-theme-text .navbar-nav .nav-link,
[data-bs-theme="dark"] .navbar-theme-text .navbar-text {
  color: var(--bs-white) !important;
}

[data-bs-theme="dark"] .navbar-theme-text .navbar-brand:hover,
[data-bs-theme="dark"] .navbar-theme-text .navbar-nav .nav-link:hover {
  color: var(--bs-gray-200) !important;
}

._dash-loading { visibility: hidden; }

/* ============================================================
   LAYOUT - Watchlist items + sidebar nav links
   ============================================================ */

/* Watchlist items - simple links, no Bootstrap pill interference */
.wl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  margin: 1px 8px;
  border-radius: 6px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.78rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.wl-item:hover {
  background-color: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}
.wl-item .wl-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.wl-section-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 8px 12px 2px;
  text-transform: uppercase;
}

/* Sidebar nav links */
.nav-link-inactive,
.nav-link-active {
  display: block;
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  margin: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link-active {
  background-color: #dc3545;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* ============================================================
   DROPDOWN - Red accent for Dash dropdowns
   ============================================================ */

.dropdown-red .Select-control { border-color: #98151b; }
.dropdown-red .Select-option.is-selected { background-color: #98151b; color: white; }
.dropdown-red .Select-option.is-focused { background-color: rgba(152,21,27,0.1); color: #98151b; }
.dropdown-red .Select-multi-value-wrapper .Select-value { background-color: #98151b; color: white; }

/* ============================================================
   GRAPH HEIGHTS - utility classes for dcc.Graph wrappers
   ============================================================ */

.graph-sm  { height: 170px; }
.graph-md  { height: 200px; }
.graph-lg  { height: 250px; }
.graph-xl  { height: 260px; }
.graph-2xl { height: 350px; }
.graph-3xl { height: 600px; }

/* ============================================================
   CARDS - hover lift for portfolio + ETF cards
   ============================================================ */

.portfolio-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portfolio-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.10) !important;
}

.sparkline-graph .js-plotly-plot,
.sparkline-graph .plot-container {
  height: 50px !important;
}

.portfolio-card .vr { opacity: 0.15; }
.portfolio-card .progress { border-radius: 2px; background-color: rgba(0,0,0,0.04); }

/* ETF selection cards - pointer + selected ring */
.etf-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.etf-card-clickable:hover {
  border-color: rgba(151,21,28,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.etf-card-selected {
  border-color: #97151c !important;
  box-shadow: 0 0 0 1px #97151c, 0 2px 6px rgba(151,21,28,0.12) !important;
  background-color: rgba(151,21,28,0.02);
}

/* ============================================================
   TABS - brand red accent
   ============================================================ */

.nav-tabs .nav-link.active {
  color: #97151c !important;
  border-bottom-color: #97151c !important;
  font-weight: 600;
}

.nav-tabs .nav-link {
  color: #6c757d;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-tabs .nav-link:hover {
  color: #97151c;
}

/* ============================================================
   MISC DASH OVERRIDES
   ============================================================ */

.dash-spinner { border-color: #dc3545 !important; }
.tab-pane .dash-loading-callback { min-height: 200px; }

/* Floating save button */
#save-portfolio-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  transition: all 0.3s ease;
}

#save-portfolio-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 16px rgba(220,53,69,0.4);
}

/* ============================================================
   GLOW - ETF X-Ray heading effect
   ============================================================ */

.glow-danger {
  color: #dc3545;
  text-shadow:
    0 0 6px rgba(220, 53, 69, 0.9),
    0 0 18px rgba(220, 53, 69, 0.65),
    0 0 40px rgba(220, 53, 69, 0.35);
  animation: glow-pulse 2.5s ease-in-out infinite;
}

/* ============================================================
   LANDING PAGE - Responsive overrides
   ============================================================ */

@media (max-width: 1199.98px) {
  footer .d-flex.justify-content-center {
    flex-direction: column !important;
    gap: 0.5rem;
  }

  footer .d-inline-flex {
    justify-content: center;
  }

  .display-3 {
    font-size: 2rem !important;
  }

  .display-4 {
    font-size: 1.75rem !important;
  }

  .lead {
    font-size: 1rem !important;
  }
}

@media (min-width: 992px) {
  #hero {
    min-height: calc(100vh - 200px);
  }
}

/* White glow when ETF X-RAY nav link is active (red background) */
.nav-link-active .glow-danger {
  color: #fff !important;
  text-shadow: 0 0 6px rgba(255,255,255,0.8), 0 0 14px rgba(255,255,255,0.4);
  animation: none;
}

@keyframes glow-pulse {
  0%, 100% {
    text-shadow:
      0 0 6px rgba(220, 53, 69, 0.9),
      0 0 18px rgba(220, 53, 69, 0.65),
      0 0 40px rgba(220, 53, 69, 0.35);
  }
  50% {
    text-shadow:
      0 0 10px rgba(220, 53, 69, 1),
      0 0 28px rgba(220, 53, 69, 0.85),
      0 0 60px rgba(220, 53, 69, 0.5);
  }
}


/* ============================================================
   NOTEBOOK PAGE

   Cards, buttons and console panels are Bootstrap-native.
   Only the code editor and console typography live here.
   ============================================================ */

.nb-code-editor {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: var(--bs-font-monospace);
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 14px 16px;
  tab-size: 4;
  white-space: pre;
  overflow-x: auto;
  resize: vertical;
  transition: border-color 0.15s;
}

.nb-code-editor:focus {
  border-color: var(--bs-danger);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-danger-rgb), 0.12);
  outline: none;
}

.nb-code-editor::placeholder {
  color: var(--bs-secondary-color);
}

.nb-console {
  font-family: var(--bs-font-monospace);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}
