/* docs/_static/custom.css */

/* Brand colors - Corporate Sapphire & Silver */
:root {
  --theme-color-primary: #1e3a8a !important;  /* Sapphire blue */
  --theme-color-accent: #60a5fa !important;   /* Light sapphire */
  --theme-color-secondary: #94a3b8 !important; /* Silver-gray */
}

/* Removed author info from top of pages - now only in footer */

/* Enhanced footer styling */
.bd-footer-content {
  border-top: 1px solid #e0e0e0;
  padding-top: 15px;
  margin-top: 30px;
}

/* Simple footer formatting */
.bd-footer-content p {
  margin-bottom: 5px !important;
}

/* Customize "Skip to main content" accessibility link */
.skip-link {
  position: absolute !important;
  top: -40px !important;
  left: 6px !important;
  background-color: var(--theme-color-primary) !important;
  color: white !important;
  padding: 8px 12px !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  font-size: 14px !important;
  z-index: 10000 !important;
  transition: top 0.3s ease !important;
}

.skip-link:focus {
  top: 6px !important;
  color: white !important;
  text-decoration: none !important;
}

/* Title page styling */
.bd-main .bd-content .bd-article-container .bd-article[role="main"] h1:first-of-type {
  border-bottom: 2px solid var(--theme-color-primary);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* Consistent header styling across pages */
.bd-sidebar-primary .bd-sidebar-header {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
}

/* 1. De-emphasize code blocks */
.jp-Cell-inputWrapper {
  background-color: #f8f8f8 !important;
  border: 1px solid #ddd !important;
  opacity: 0.7;
}

.jp-Cell-inputWrapper pre,
.jp-Cell-inputWrapper code,
.jp-Cell-inputWrapper .highlight,
.jp-Cell-inputWrapper .highlight * {
  opacity: 0.5 !important;
  color: #999 !important;
}

/* Override any green borders in code blocks */
.jp-Cell-inputWrapper,
.jp-Cell-inputWrapper *,
.jp-Cell-inputWrapper pre,
.jp-Cell-inputWrapper code,
.jp-Cell-inputWrapper .highlight,
.jp-Cell-inputWrapper .highlight * {
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
}

/* 2. Header hierarchy */
h2 {
  color: #1e3a8a !important;  /* Primary sapphire */
}

h3 {
  color: #60a5fa !important;  /* Light sapphire accent */
}

/* 3. Blue bold markdown and inline code */
strong, b {
  color: #1e3a8a !important;  /* Primary sapphire */
}

code {
  color: #1e3a8a !important;  /* Primary sapphire */
  background-color: rgba(148, 163, 184, 0.1) !important;  /* Light silver background */
}

/* 4. TOC link colors */
.sidebar a {
  color: #000000 !important;
}

.sidebar a[href*="/exercises/E."] {
  color: #1e3a8a !important;  /* Primary sapphire */
}

.sidebar a[href*="/exercises/S."] {
  color: #60a5fa !important;  /* Light sapphire accent */
}

/* 5. Active page and navigation links - use sapphire blue */
.sidebar .current {
  color: #1e3a8a !important;
  background-color: rgba(148, 163, 184, 0.15) !important;  /* Light silver background */
}

.sidebar .current a {
  color: #1e3a8a !important;
}

/* Navigation links at bottom */
.prev-next-bottom a {
  color: #1e3a8a !important;
}

.prev-next-bottom a:hover {
  color: #162d6b !important;  /* Darker sapphire on hover */
}

/* 6. Blue hover effects */
a:hover,
.sidebar a:hover,
.sidebar a:focus {
  color: #1e3a8a !important;
  background-color: rgba(96, 165, 250, 0.1) !important;  /* Light accent background */
}

.sidebar a[href*="/exercises/E."]:hover {
  color: #162d6b !important;  /* Darker sapphire */
}

.sidebar a[href*="/exercises/S."]:hover {
  color: #3b82f6 !important;  /* Slightly darker light sapphire */
}

/* 7. Floating kill server button */
.kill-server-btn {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 1000 !important;
  background-color: #dc3545 !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 60px !important;
  height: 60px !important;
  font-size: 24px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
  transition: all 0.3s ease !important;
}

.kill-server-btn:hover {
  background-color: #c82333 !important;
  transform: scale(1.1) !important;
  box-shadow: 0 6px 12px rgba(0,0,0,0.4) !important;
}

.kill-server-btn:active {
  transform: scale(0.95) !important;
}

/* 8. Individual code toggle buttons - very subtle and muted */
.code-toggle-button {
  background-color: transparent !important;
  color: #999 !important;
  border: 1px solid #e0e0e0 !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  font-size: 10px !important;
  cursor: pointer !important;
  margin-bottom: 3px !important;
  transition: all 0.2s ease !important;
  opacity: 0.6 !important;
  float: right !important;
  margin-left: 10px !important;
}

.code-toggle-button:hover {
  background-color: #f5f5f5 !important;
  color: #666 !important;
  border-color: #ccc !important;
  opacity: 0.8 !important;
}

/* 9. Global code toggle button styling */
.global-code-toggle:hover {
  background-color: #1e3a8a !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(30, 58, 138, 0.3) !important;
}

/* 10. Style code cells for better visibility when shown */
.cell_input {
  background-color: #f8f9fa !important;
  border: 1px solid #e9ecef !important;
  border-radius: 4px !important;
  margin-bottom: 10px !important;
  transition: all 0.3s ease !important;
  clear: both !important;
}

.cell_input:hover {
  border-color: #60a5fa !important;  /* Light sapphire accent */
  box-shadow: 0 2px 4px rgba(96, 165, 250, 0.15) !important;
}

/* 11. Dataframe styling - override default pandas hover colors */
/* Change hover color to sapphire theme */
.dataframe tbody tr:hover {
  background-color: rgba(96, 165, 250, 0.1) !important;  /* Light sapphire tint */
}

.dataframe thead th:hover {
  background-color: rgba(148, 163, 184, 0.2) !important;  /* Silver tint */
}

.dataframe tbody td:hover {
  background-color: rgba(96, 165, 250, 0.15) !important;
}

/* Additional dataframe hover styles for different table classes */
table.dataframe tbody tr:hover,
.output_html table tbody tr:hover,
.jp-RenderedHTMLCommon table tbody tr:hover {
  background-color: rgba(96, 165, 250, 0.1) !important;
}

table.dataframe thead th:hover,
.output_html table thead th:hover,
.jp-RenderedHTMLCommon table thead th:hover {
  background-color: rgba(148, 163, 184, 0.2) !important;
}

/* Override any purple/violet hover colors specifically */
.dataframe tr:hover,
.dataframe td:hover,
.dataframe th:hover {
  background-color: rgba(96, 165, 250, 0.1) !important;
  color: #1e3a8a !important;
}

/* 12. Enhanced DataFrame Sticky Headers and Index */
/* Universal table scrolling containers - covers all DataFrame output formats */
.output_html,
.output.text_html,
.cell_output,
div.output,
.jp-RenderedHTMLCommon,
.jp-OutputArea-output,
div[data-mime-type="text/html"] {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-width: 100% !important;
}

/* Ensure all tables can scroll and have consistent layout */
.output_html table,
.output.text_html table,
.cell_output table,
div.output table,
.jp-RenderedHTMLCommon table,
table.dataframe,
table[border="1"].dataframe {
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  position: relative !important;
}

/* STICKY COLUMN HEADERS (horizontal scrolling) */
/* Make all column headers sticky at top */
.output_html table thead th,
.output.text_html table thead th,
.cell_output table thead th,
div.output table thead th,
.jp-RenderedHTMLCommon table thead th,
table.dataframe thead th,
table[border="1"].dataframe thead th,
table thead th.col_heading {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background-color: rgba(148, 163, 184, 0.1) !important;  /* Light silver background */
  border-bottom: 2px solid #94a3b8 !important;
  box-shadow: 0 2px 4px rgba(148, 163, 184, 0.2) !important;
}

/* STICKY INDEX COLUMNS (vertical scrolling) */
/* Make index columns sticky on left during horizontal scrolling */
.output_html table .row_heading,
.output_html table th.row_heading,
.output.text_html table .row_heading,
.output.text_html table th.row_heading,
.cell_output table .row_heading,
.cell_output table th.row_heading,
div.output table .row_heading,
div.output table th.row_heading,
.jp-RenderedHTMLCommon table .row_heading,
.jp-RenderedHTMLCommon table th.row_heading,
table .row_heading,
table th.row_heading,
table.dataframe .row_heading,
table[border="1"].dataframe .row_heading {
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  background-color: white !important;
  border-right: 2px solid #e0e0e0 !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1) !important;
}

/* CORNER CELL - highest z-index for top-left intersection */
/* Make sure the blank corner cell (top-left) is sticky in both directions */
.output_html table thead th.blank,
.output.text_html table thead th.blank,
.cell_output table thead th.blank,
div.output table thead th.blank,
.jp-RenderedHTMLCommon table thead th.blank,
table thead th.blank,
table.dataframe thead th.blank,
table[border="1"].dataframe thead th.blank,
table thead th.index_name {
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 30 !important;
  background-color: #f0f0f0 !important;
  border-right: 2px solid #e0e0e0 !important;
  border-bottom: 2px solid #e0e0e0 !important;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* MULTI-LEVEL INDEX SUPPORT */
/* Handle multi-level column headers */
.output_html table thead th[class*="level"],
.output.text_html table thead th[class*="level"],
.cell_output table thead th[class*="level"],
div.output table thead th[class*="level"],
table thead th[class*="level"] {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #e0e0e0 !important;
}

/* Handle multi-level row headers */
.output_html table th[class*="level0"],
.output.text_html table th[class*="level0"],
.cell_output table th[class*="level0"],
div.output table th[class*="level0"],
table th[class*="level0"] {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  background-color: white !important;
  border-right: 2px solid #e0e0e0 !important;
}

/* HOVER EFFECTS for sticky elements */
/* Ensure sticky elements have proper hover effects */
.output_html table .row_heading:hover,
.output.text_html table .row_heading:hover,
.cell_output table .row_heading:hover,
div.output table .row_heading:hover,
.jp-RenderedHTMLCommon table .row_heading:hover,
table .row_heading:hover,
table.dataframe .row_heading:hover {
  background-color: rgba(96, 165, 250, 0.15) !important;
  color: #1e3a8a !important;
}

.output_html table thead th:hover,
.output.text_html table thead th:hover,
.cell_output table thead th:hover,
div.output table thead th:hover,
.jp-RenderedHTMLCommon table thead th:hover,
table.dataframe thead th:hover {
  background-color: rgba(148, 163, 184, 0.25) !important;
  color: #1e3a8a !important;
}

/* PANDAS STYLER SPECIFIC */
/* Handle pandas Styler tables (with id like T_xxxxx) */
table[id^="T_"] {
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

table[id^="T_"] thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #e0e0e0 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

table[id^="T_"] th.row_heading {
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  background-color: white !important;
  border-right: 2px solid #e0e0e0 !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1) !important;
}

table[id^="T_"] th.blank {
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 30 !important;
  background-color: #f0f0f0 !important;
  border-right: 2px solid #e0e0e0 !important;
  border-bottom: 2px solid #e0e0e0 !important;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* 13. Sphinx Design Cards - distinctive styling */
.sd-card {
  background-color: #f8f9fa !important;
  border: 2px solid #e9ecef !important;
  border-left: 4px solid #1e3a8a !important;  /* Sapphire accent */
  border-radius: 8px !important;
  padding: 20px !important;
  margin-bottom: 20px !important;
  box-shadow: 0 3px 8px rgba(148, 163, 184, 0.2) !important;
  transition: all 0.3s ease !important;
}

.sd-card:hover {
  background-color: rgba(148, 163, 184, 0.05) !important;  /* Very light silver tint */
  border-color: #94a3b8 !important;
  border-left-color: #60a5fa !important;  /* Light sapphire on hover */
  box-shadow: 0 5px 15px rgba(30, 58, 138, 0.15) !important;
  transform: translateY(-2px) !important;
}

/* Keep the existing font color and links styling within cards */
.sd-card a {
  color: #1e3a8a !important;
  text-decoration: none !important;
}

.sd-card a:hover {
  color: #162d6b !important;
  text-decoration: underline !important;
}

/* Card title styling */
.sd-card-title {
  color: #1e3a8a !important;
  margin-bottom: 8px !important;
}

/* Make card headlines bigger and more prominent */
.sd-card strong,
.sd-card-body strong {
  font-size: 1.2em !important;
  line-height: 1.3 !important;
  display: block !important;
  margin-bottom: 10px !important;
  color: #1e3a8a !important;
}

/* Ensure linked headlines maintain proper styling */
.sd-card strong a,
.sd-card-body strong a {
  font-size: inherit !important;
  color: inherit !important;
  text-decoration: none !important;
}

.sd-card strong a:hover,
.sd-card-body strong a:hover {
  color: #162d6b !important;
  text-decoration: none !important;
}

/* Grid layout cards - ensure consistent spacing */
.sd-container-fluid .sd-card {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Hide URL display from sphinx cards with :link: directive
   This targets the specific issue where :link: URLs are shown as text */
.sd-card-body a[href*="wsj.com"][href*="?"] {
  display: none !important;
}

/* Hide any URL text that appears to be from the :link: directive */
.sd-card-body p:contains("https://www.wsj.com") {
  display: none !important;
}

/* Alternative: Hide any standalone URL links in card bodies */
.sd-card-body > p > a:only-child[href^="https://"] {
  display: none !important;
}

/* Hide paragraph containing only a URL */
.sd-card-body > p:has(> a:only-child[href^="https://"]) {
  display: none !important;
}
