/* Edge Analytics Lab Book - Companion Website Styles */
/* Color scheme matched to PDF cover: Steel Blue + Golden Amber */

/* ============================================
   ROOT VARIABLES - MATCHING BOOK COVER
   ============================================ */
:root {
  /* Primary colors from cover */
  --cover-blue: #4A6FA5;
  --cover-blue-dark: #3D5A80;
  --cover-blue-darker: #2C3E50;
  --cover-blue-light: #7FB3D5;
  --cover-amber: #F5A623;
  --cover-amber-light: #FFD166;
  --cover-amber-dark: #E09F3E;

  /* Gradients */
  --primary-gradient: linear-gradient(135deg, #4A6FA5 0%, #3D5A80 100%);
  --accent-gradient: linear-gradient(135deg, #F5A623 0%, #FFD166 100%);
  --dark-gradient: linear-gradient(135deg, #2C3E50 0%, #1a252f 100%);
  --light-gradient: linear-gradient(135deg, #7FB3D5 0%, #a8d4ea 100%);

  /* Functional colors */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;

  /* UI colors */
  --text-primary: #1a252f;
  --text-secondary: #4a5568;
  --text-light: #718096;
  --bg-light: #f7fafc;
  --bg-white: #ffffff;
  --border-color: #e2e8f0;

  /* Design tokens */
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(74, 111, 165, 0.08);
  --shadow-md: 0 4px 12px rgba(74, 111, 165, 0.12);
  --shadow-lg: 0 10px 40px rgba(74, 111, 165, 0.2);
  --shadow-amber: 0 4px 20px rgba(245, 166, 35, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE STYLES
   ============================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-light);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.875rem;
  color: var(--cover-blue-dark);
  border-bottom: 3px solid var(--cover-amber);
  padding-bottom: 0.5rem;
  display: inline-block;
}

h3 {
  font-size: 1.5rem;
  color: var(--cover-blue);
}

h4 {
  font-size: 1.25rem;
  color: var(--cover-blue-dark);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  background: var(--accent-gradient);
  border: none;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cover-blue-darker);
  border-radius: 50px;
  box-shadow: var(--shadow-amber);
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(245, 166, 35, 0.4);
  filter: brightness(1.05);
  color: var(--cover-blue-darker);
}

.btn-secondary {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 0.875rem 2rem;
  font-weight: 600;
  border-radius: 50px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-lg {
  padding: 1.25rem 2.5rem;
  font-size: 1.125rem;
}

/* ============================================
   CALLOUTS - Matching Cover Style
   ============================================ */
.callout {
  border-radius: var(--border-radius);
  border: none !important;
  box-shadow: var(--shadow-md);
  margin: 1.5rem 0;
  overflow: hidden;
  transition: var(--transition);
}

.callout:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.callout-note {
  background: linear-gradient(135deg, #e8f4fd 0%, #d1e9fa 100%);
  border-left: 4px solid var(--cover-blue) !important;
}

.callout-note .callout-title {
  background: var(--primary-gradient);
  color: white;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.callout-tip {
  background: linear-gradient(135deg, #fef9e7 0%, #fcf3cf 100%);
  border-left: 4px solid var(--cover-amber) !important;
}

.callout-tip .callout-title {
  background: var(--accent-gradient);
  color: var(--cover-blue-darker);
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.callout-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid var(--warning-color) !important;
}

.callout-warning .callout-title {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.callout-important {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-left: 4px solid var(--danger-color) !important;
}

.callout-important .callout-title {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.callout-body {
  padding: 1rem 1.25rem;
}

/* ============================================
   CODE BLOCKS - Light Theme for Readability
   ============================================ */
pre {
  background: #f8fafc !important;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem !important;
  margin: 1.5rem 0;
  overflow-x: auto;
}

pre code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #334155;
  background: transparent !important;
}

/* Syntax highlighting colors for light theme */
pre .hljs-keyword, pre .token.keyword { color: #8b5cf6; }
pre .hljs-string, pre .token.string { color: #059669; }
pre .hljs-number, pre .token.number { color: #d97706; }
pre .hljs-comment, pre .token.comment { color: #94a3b8; font-style: italic; }
pre .hljs-function, pre .token.function { color: #3b82f6; }
pre .hljs-class, pre .token.class-name { color: #ec4899; }
pre .hljs-variable, pre .token.variable { color: #0891b2; }

/* Code fold button */
.code-fold-btn {
  background: var(--accent-gradient) !important;
  border: none !important;
  border-radius: 20px !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--cover-blue-darker) !important;
  transition: var(--transition);
}

.code-fold-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-amber);
}

/* ============================================
   TABLES
   ============================================ */
table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

table thead {
  background: var(--primary-gradient);
}

table th {
  color: white;
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  border: none;
}

table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: white;
}

table tbody tr:hover {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

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

/* ============================================
   TAB PANELS
   ============================================ */
.panel-tabset {
  margin: 1.5rem 0;
}

.panel-tabset .nav-tabs {
  border-bottom: 2px solid var(--border-color);
  gap: 0.5rem;
}

.panel-tabset .nav-link {
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  transition: var(--transition);
}

.panel-tabset .nav-link:hover {
  color: var(--cover-blue);
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

.panel-tabset .nav-link.active {
  color: white;
  background: var(--primary-gradient);
  border-bottom: none;
}

.tab-content {
  padding: 1.5rem;
  background: white;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   FIGURES & IMAGES
   ============================================ */
figure {
  margin: 2rem 0;
  text-align: center;
}

figure img,
.cell-output-display img {
  max-width: 100%;
  height: auto !important;
  object-fit: contain;
  border-radius: var(--border-radius);
}

/* Allow inline images to respect their set height */
p img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: none !important;
}

figure img {
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

figure img:hover {
  transform: scale(1.01);
}

figcaption {
  margin-top: 1rem;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Matplotlib/Plot output images */
.cell-output-display {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.cell-output-display img {
  max-width: 100%;
  height: auto !important;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  background: white;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
}

/* ============================================
   SIDEBAR - Matching Cover Theme
   ============================================ */
/* Note: Sidebar width is controlled via grid option in _quarto.yml */

/* Sidebar container styling */
.sidebar, #quarto-sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 10px rgba(74, 111, 165, 0.05);
}

/* Sidebar title/brand */
.sidebar-title, .sidebar-brand {
  font-weight: 800;
  color: var(--cover-blue-dark);
  font-size: 1rem !important;
  padding: 1rem 0.75rem !important;
  border-bottom: 3px solid var(--cover-amber);
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
  margin-bottom: 0.5rem;
}

/* Sidebar navigation items */
.sidebar-item-text {
  font-size: 0.78rem;
  font-weight: 500;
  transition: var(--transition);
  line-height: 1.3;
  padding: 0.3rem 0;
}

/* Remove indentation - keep chapters at same level */
.sidebar-item {
  padding: 0.2rem 0.5rem;
  margin: 1px 0.25rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

/* Remove nested indentation */
#quarto-sidebar .sidebar-item-container > ul {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

#quarto-sidebar ul ul {
  padding-left: 0 !important;
}

.sidebar-item:hover {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

.sidebar-item:hover .sidebar-item-text {
  color: var(--cover-blue);
}

/* Part/Section headers in sidebar - style the menu-text span */
.sidebar-section .menu-text {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cover-blue-dark);
  display: inline-block;
  padding: 0.4rem 0.6rem;
  background: linear-gradient(135deg, #e8f4fd 0%, #d1e9fa 100%);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--cover-amber);
  margin: 0.5rem 0 0.25rem 0;
}

/* Chapter items styling - normal text */
.sidebar-section .sidebar-item .sidebar-item-text {
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-primary);
  padding: 0.3rem 0;
  background: transparent;
}

/* Active/current page in sidebar */
.sidebar-navigation .active,
.sidebar-item.active {
  background: var(--primary-gradient) !important;
  color: white !important;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
}

.sidebar-navigation .active .sidebar-item-text,
.sidebar-item.active .sidebar-item-text {
  color: white !important;
  font-weight: 600;
}

/* Sidebar search box */
#quarto-search {
  margin: 1rem 0.75rem;
}

#quarto-search input {
  border-radius: 25px !important;
  border: 2px solid var(--border-color) !important;
  padding: 0.6rem 1rem !important;
  font-size: 0.875rem;
  transition: var(--transition);
}

#quarto-search input:focus {
  border-color: var(--cover-blue) !important;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15) !important;
}

/* Collapsible sidebar sections */
.sidebar-item-toggle {
  color: var(--cover-blue);
  transition: var(--transition);
}

.sidebar-item-toggle:hover {
  color: var(--cover-amber);
}

/* ============================================
   FOOTER - Cover Theme
   ============================================ */
.nav-footer {
  background: var(--dark-gradient);
  border-top: 4px solid var(--cover-amber);
  color: white;
  padding: 2rem 0;
}

.nav-footer a {
  color: var(--cover-blue-light);
  transition: var(--transition);
}

.nav-footer a:hover {
  color: var(--cover-amber);
}

/* ============================================
   BADGES & TAGS
   ============================================ */
img[alt="Open In Colab"] {
  margin: 0.5rem 0;
  border-radius: 6px;
  transition: var(--transition);
}

img[alt="Open In Colab"]:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* Level indicators matching cover colors */
.level-1 {
  color: white;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.level-2 {
  color: var(--cover-blue-darker);
  background: var(--accent-gradient);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.level-3 {
  color: white;
  background: var(--primary-gradient);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================
   SIMULATION CARDS
   ============================================ */
.simulation-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.simulation-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cover-amber);
}

/* ============================================
   HERO SECTION - Cover Style
   ============================================ */
.hero-section {
  background: var(--primary-gradient);
  padding: 3rem 2rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-section h1 {
  color: white !important;
  -webkit-text-fill-color: white;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.hero-section p {
  opacity: 0.9;
  font-size: 1.125rem;
  position: relative;
  z-index: 1;
}

/* ============================================
   FEATURE BOXES - Inspired by Cover Icons
   ============================================ */
.feature-box {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 2px solid transparent;
}

.feature-box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cover-amber);
}

.feature-box-icon {
  width: 60px;
  height: 60px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--cover-blue-darker);
  font-size: 1.5rem;
}

/* ============================================
   MATH & FORMULAS
   ============================================ */
.math {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
  border-left: 4px solid var(--cover-blue);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.content {
  animation: fadeInUp 0.5s ease-out;
}

html {
  scroll-behavior: smooth;
}

/* ============================================
   CHECKLIST ITEMS
   ============================================ */
input[type="checkbox"] {
  accent-color: var(--cover-amber);
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* ============================================
   BLOCKQUOTES
   ============================================ */
blockquote {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
  border-left: 4px solid var(--cover-amber);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p {
  margin: 0;
}

/* ============================================
   LINKS
   ============================================ */
a {
  color: var(--cover-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--cover-amber);
  text-decoration: underline;
}

/* ============================================
   NETWORK PATTERN OVERLAY (like cover)
   ============================================ */
.network-bg {
  background-image:
    radial-gradient(circle at 20% 80%, rgba(127, 179, 213, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245, 166, 35, 0.1) 0%, transparent 50%);
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 768px) {
  h1 {
    font-size: 1.875rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  pre {
    padding: 1rem !important;
  }

  pre code {
    font-size: 0.75rem;
  }

  .callout {
    margin: 1rem 0;
  }

  .hero-section {
    padding: 2rem 1rem;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
[data-bs-theme="dark"] {
  --text-primary: #e2e8f0;
  --text-secondary: #a0aec0;
  --bg-light: #1a202c;
  --bg-white: #2d3748;
  --border-color: #4a5568;
}

[data-bs-theme="dark"] body {
  background: var(--bg-light);
}

[data-bs-theme="dark"] .callout-note {
  background: linear-gradient(135deg, #2d3a4f 0%, #1a252f 100%);
}

[data-bs-theme="dark"] table td {
  background: #2d3748;
  border-color: #4a5568;
}

[data-bs-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
}

[data-bs-theme="dark"] .simulation-card,
[data-bs-theme="dark"] .feature-box {
  background: #2d3748;
  border-color: #4a5568;
}

/* ============================================
   SPECIAL COMPONENTS
   ============================================ */
/* Progress bar */
.progress-bar {
  background: var(--accent-gradient);
  border-radius: 10px;
}

/* Badge */
.badge {
  background: var(--accent-gradient);
  color: var(--cover-blue-darker);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Icon styling */
.bi, .fa, .fas, .far {
  margin-right: 0.5rem;
}

/* Divider with amber accent */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cover-amber), transparent);
  margin: 2rem 0;
}

/* Print styles */
@media print {
  .sidebar, .nav-footer, .code-fold-btn {
    display: none !important;
  }

  .content {
    max-width: 100% !important;
  }

  pre {
    background: #f8f8f8 !important;
    color: #333 !important;
  }
}

/* ============================================
   TITLE PAGE MATCHING COVER
   ============================================ */
.title-block {
  background: var(--primary-gradient);
  color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  text-align: center;
}

.title-block h1 {
  color: white !important;
  -webkit-text-fill-color: white;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.title-block .subtitle {
  color: var(--cover-amber);
  font-size: 1.25rem;
  font-weight: 600;
}

/* ============================================
   LAB NUMBER BADGES
   ============================================ */
.lab-badge {
  display: inline-block;
  background: var(--accent-gradient);
  color: var(--cover-blue-darker);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-amber);
}

/* ============================================
   PAGE HEADER & TITLE - Modern Style
   ============================================ */
.quarto-title {
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.quarto-title h1.title {
  font-size: 2.75rem !important;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.quarto-title .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Breadcrumb styling */
.breadcrumb {
  background: transparent;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.breadcrumb-item a {
  color: var(--cover-blue);
}

.breadcrumb-item.active {
  color: var(--text-secondary);
}

/* ============================================
   OPEN IN COLAB BUTTON - Enhanced
   ============================================ */
img[alt="Open In Colab"] {
  margin: 1rem auto;
  border-radius: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

img[alt="Open In Colab"]:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Colab link container */
a[href*="colab.research.google.com"] {
  display: inline-block;
  text-align: center;
}

/* Custom Colab button style */
.colab-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #F9AB00 0%, #F57C00 100%);
  color: white !important;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  box-shadow: 0 4px 15px rgba(249, 171, 0, 0.3);
  transition: var(--transition);
}

.colab-badge:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(249, 171, 0, 0.4);
}

/* ============================================
   RIGHT SIDEBAR TOC - Modern Style
   ============================================ */
#TOC, .toc, #quarto-sidebar-toc-left {
  font-size: 0.68rem;
}

#TOC .toc-title,
.sidebar-toc .toc-title,
#toc-title {
  font-weight: 700;
  color: var(--cover-blue-dark);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--cover-amber);
  margin-bottom: 0.5rem;
}

#TOC ul, .toc ul {
  list-style: none;
  padding-left: 0;
}

#TOC li, .toc li {
  margin: 0.1rem 0;
  padding: 0;
}

#TOC a, .toc a {
  display: block;
  padding: 0.2rem 0.4rem;
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  font-weight: 500;
  border-left: 2px solid transparent;
  line-height: 1.25;
}

#TOC a:hover, .toc a:hover {
  color: var(--cover-blue);
  background: linear-gradient(90deg, rgba(74, 111, 165, 0.08) 0%, transparent 100%);
  border-left-color: var(--cover-blue);
  text-decoration: none;
}

#TOC a.active, .toc a.active {
  color: var(--cover-amber-dark);
  font-weight: 600;
  border-left-color: var(--cover-amber);
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.1) 0%, transparent 100%);
}

/* Nested TOC items */
#TOC ul ul, .toc ul ul {
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
  margin-left: 0.3rem;
}

/* ============================================
   MAIN CONTENT AREA - Enhanced
   ============================================ */
#quarto-document-content,
.quarto-document-content,
main.content {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem !important;
  margin: 1rem;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   LISTS - Modern Style
   ============================================ */
ul, ol {
  padding-left: 1.5rem;
}

li {
  margin: 0.5rem 0;
  line-height: 1.7;
}

ul li::marker {
  color: var(--cover-blue);
}

ol li::marker {
  color: var(--cover-amber);
  font-weight: 600;
}

/* ============================================
   CODE TOOLBAR - Enhanced
   ============================================ */
.code-tools {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.code-tools-button {
  background: var(--bg-light) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  padding: 0.4rem 0.8rem !important;
  border-radius: 20px !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  transition: var(--transition);
}

.code-tools-button:hover {
  background: var(--primary-gradient) !important;
  border-color: var(--cover-blue) !important;
  color: white !important;
}

/* ============================================
   OTHER LINKS SECTION - Right Sidebar
   ============================================ */
.other-links {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.other-links h2, .quarto-other-links h2 {
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  border-bottom: none !important;
  padding-bottom: 0;
}

.other-links a, .quarto-other-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  border-radius: var(--border-radius-sm);
  color: var(--cover-blue);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.other-links a:hover, .quarto-other-links a:hover {
  background: linear-gradient(90deg, rgba(74, 111, 165, 0.1) 0%, transparent 100%);
  color: var(--cover-blue-dark);
  text-decoration: none;
}

/* PDF download link special styling */
a[href*=".pdf"] {
  color: var(--danger-color);
}

a[href*=".pdf"]:hover {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, transparent 100%) !important;
}

/* ============================================
   GITHUB/EDIT LINKS
   ============================================ */
.quarto-code-links, .repo-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.quarto-code-links a, .repo-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: var(--bg-light);
  transition: var(--transition);
}

.quarto-code-links a:hover, .repo-actions a:hover {
  background: var(--cover-blue);
  color: white;
  text-decoration: none;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
/* Note: Quarto handles sidebar responsiveness via grid option in _quarto.yml */

@media (max-width: 991px) {
  #quarto-document-content,
  .quarto-document-content,
  main.content {
    padding: 1.5rem !important;
    margin: 0.5rem;
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--cover-blue-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cover-blue);
}

/* ============================================
   SELECTION HIGHLIGHT
   ============================================ */
::selection {
  background: rgba(74, 111, 165, 0.2);
  color: var(--cover-blue-darker);
}

/* ============================================
   FOCUS STATES - Accessibility
   ============================================ */
a:focus, button:focus, input:focus {
  outline: 2px solid var(--cover-amber);
  outline-offset: 2px;
}

/* ============================================
   NOTEBOOK DOWNLOAD LINK
   ============================================ */
a[href*="Download Notebook"],
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-light);
  border: 2px solid var(--cover-blue);
  color: var(--cover-blue);
  padding: 0.6rem 1.25rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  text-decoration: none !important;
}

a[href*="Download Notebook"]:hover,
.btn-download:hover {
  background: var(--cover-blue);
  color: white;
}
