:root {
  --bs-primary: #af26c1;
  --bs-primary-rgb: 175, 38, 193;
  --theme-purple: #af26c1;
  --theme-purple-hover: #911e9f;
  --bs-link-color: #af26c1;
  --bs-link-hover-color: #911e9f;
}

/* Override Bootstrap Primary Colors */
.btn-primary {
  --bs-btn-bg: #af26c1;
  --bs-btn-border-color: #af26c1;
  --bs-btn-hover-bg: #911e9f;
  --bs-btn-hover-border-color: #911e9f;
  --bs-btn-active-bg: #7a1986;
  --bs-btn-active-border-color: #7a1986;
}

.btn-outline-primary {
  --bs-btn-color: #af26c1;
  --bs-btn-border-color: #af26c1;
  --bs-btn-hover-bg: #af26c1;
  --bs-btn-hover-border-color: #af26c1;
}

.text-primary { color: #af26c1 !important; }
.bg-primary { background-color: #af26c1 !important; }
.border-primary { border-color: #af26c1 !important; }

/* Header & Footer layout styles */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
}
.logo {
  font-weight: 700;
  color: var(--theme-purple);
  text-decoration: none;
  font-size: 1.25rem;
}
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 0.25rem;
}
.nav-toggle .hamburger{
  display: inline-block;
  width: 22px;
  height: 2px;
  background: #333;
  position: relative;
}
.nav-toggle .hamburger::before,
.nav-toggle .hamburger::after{
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: #333;
}
.nav-toggle .hamburger::before{ top: -6px; }
.nav-toggle .hamburger::after{ top: 6px; }

.main-nav .nav-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Utility classes for interactive elements */
.transition-all { transition: all 0.2s ease-in-out; }
.hover-shadow:hover { 
  transform: translateY(-2px);
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
  background-color: #f8f9fa !important;
}
.main-nav .nav-list li a{
  text-decoration: none;
  color: #212529;
  padding: 0.25rem 0.5rem;
}

.search-form{
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.search-form input[type="search"]{
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}

/* Header Search Compact */
.header-search-box {
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    overflow: visible;
    position: relative;
    cursor: pointer;
}

.header-search-box:focus-within, .header-search-box.active {
    width: 200px;
    background: white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.header-search-box .bi-search {
    min-width: 32px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.header-search-box:focus-within .bi-search, .header-search-box.active .bi-search {
    color: #6c757d;
}

.header-search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 0;
    padding: 0;
    transition: width 0.3s ease;
    font-size: 0.85rem;
    color: #212529;
}

.header-search-box input::placeholder {
    color: #adb5bd;
}

.header-search-box:focus-within input, .header-search-box.active input {
    width: 150px;
    padding-left: 5px;
    color: #212529;
}

.header-search-box:focus-within input::placeholder {
    color: #6c757d;
}

.header-search-box .spinner-container {
    position: absolute;
    right: 10px;
    display: none;
}

.header-search-box:focus-within .spinner-container {
    display: block;
}

/* Suggestions for compact search */
#headerSearchSuggestions {
    top: 100%;
    right: 0;
    width: 250px;
    margin-top: 8px;
}

.rounded-pill-start {
    border-top-left-radius: 50rem !important;
    border-bottom-left-radius: 50rem !important;
}
.rounded-pill-end {
    border-top-right-radius: 50rem !important;
    border-bottom-right-radius: 50rem !important;
}
#headerSearchSuggestions .list-group-item,
#searchSuggestions .list-group-item {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-left: 0;
    border-right: 0;
}
#headerSearchSuggestions .list-group-item:first-child,
#searchSuggestions .list-group-item:first-child {
    border-top: 0;
}
#headerSearchSuggestions .list-group-item:hover,
#searchSuggestions .list-group-item:hover {
    background-color: #f8f9fa;
    color: var(--theme-purple);
}

/* Footer */
.site-footer{
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding-top: 1rem;
}
.site-footer{ width: 100%; }
.footer-inner{
  display: flex;
  gap: 2rem;
  /* Let the outer .container control max-width/centering */
  padding: 1.5rem 0;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-col{
  flex: 1 1 240px;
  min-width: 180px;
}
.footer-col h4{ margin-top: 0; }
.footer-bottom{ padding: 0.75rem 0; font-size: 0.9rem; color: #6c757d; }

/* Visual polish: make footer background subtle and content more prominent */
.site-footer{
  background: #ffffff; /* keep page light and match header */
  border-top: 1px solid #e9ecef;
}

/* Quick fix: ensure chart canvases have layout space when tabs become visible.
   This is an emergency UX patch to avoid 0x0 canvas sizes on initial selection.
   If you have a build step (SCSS + Autoprefixer) prefer a proper fix in source.
*/
#analysisTabsContent .tab-pane {
  min-height: 320px;
}

#analysisTabsContent canvas {
  display: block;
  width: 100% !important;
  height: 280px !important;
  max-height: 420px;
}
.footer-inner a{ color: var(--theme-purple); }
.footer-inner a:hover{ color: #0b5ed7; text-decoration: underline; }
.footer-col p, .footer-col li{ color: #34495e; }

/* Slightly larger spacing between main content and footer */
main { padding-bottom: 2rem; }

/* Make footer content stack on small screens */
@media (max-width: 768px) {
  .footer-inner{
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem;
  }
  .footer-col{ min-width: 0; }
  .footer-bottom{ text-align: center; }
}

/* Responsive behavior: collapse nav on small screens */
@media (max-width: 767.98px){
  .nav-toggle{ display: inline-flex; }
  .main-nav .nav-list{
    display: none; /* toggled by site.js */
    flex-direction: column;
    gap: 0;
    background: #fff;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    position: absolute;
    top: 56px;
    left: 12px;
    right: 12px;
    z-index: 1050;
  }
  .search-form{ display: none; }
}

/* Ensure footer sticks to bottom when page content is short */
html, body {
  height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main {
  flex: 1 0 auto;
}
.site-footer {
  margin-top: auto;
}

/* Temporary quick-badge click feedback */
.quick-badge-alert {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(25,135,84,0.95);
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  z-index: 3000;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Fade helpers for small UI elements (used for analysis header) */
.fade-transition {
  transition: opacity 220ms ease, transform 220ms ease;
}
.fade-hidden {
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
}
.fade-visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* Fullscreen Chart Mode */
.chart-container.fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background: white;
    padding: 20px;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

.chart-container.fullscreen canvas {
    flex-grow: 1;
    width: 100% !important;
    height: auto !important;
}

.chart-container.fullscreen .d-flex.justify-content-between {
    margin-bottom: 15px;
}

/* Fullscreen Financial Block Mode */
.financial-block.fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background: white;
    padding: 20px;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.financial-block.fullscreen .card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.financial-block.fullscreen .card-body {
    flex-grow: 1;
    overflow-y: auto;
}
