:root {
  --primary: #1a1a1a;
  --accent: #d32f2f; /* Red accent based on logo vibe */
  --light: #f4f4f4;
  --dark-text: #333;
  --light-text: #fff;
  --color-persian-red-50: #fdf3f3;
  --color-persian-red-100: #fde3e3;
  --color-persian-red-200: #fbcdcd;
  --color-persian-red-300: #f8a9a9;
  --color-persian-red-400: #f17878;
  --color-persian-red-500: #e74c4c;
  --color-persian-red-600: #d32f2f;
  --color-persian-red-700: #b12424;
  --color-persian-red-800: #932121;
  --color-persian-red-900: #7a2222;
  --color-persian-red-950: #420d0d;

  --color-pickled-bluewood-50: #f5f7fa;
  --color-pickled-bluewood-100: #eaeef4;
  --color-pickled-bluewood-200: #d1dce6;
  --color-pickled-bluewood-300: #a8bed1;
  --color-pickled-bluewood-400: #799bb7;
  --color-pickled-bluewood-500: #597e9f;
  --color-pickled-bluewood-600: #456684;
  --color-pickled-bluewood-700: #39516b;
  --color-pickled-bluewood-800: #34495e;
  --color-pickled-bluewood-900: #2d3c4d;
  --color-pickled-bluewood-950: #1e2833;

  /* Theme-Agnostic Variables - Default to Limitless Legs (Red) */
  --theme-accent: var(--color-persian-red-600);
  --theme-accent-50: var(--color-persian-red-50);
  --theme-accent-100: var(--color-persian-red-100);
  --theme-accent-200: var(--color-persian-red-200);
  --theme-accent-300: var(--color-persian-red-300);
  --theme-accent-400: var(--color-persian-red-400);
  --theme-accent-500: var(--color-persian-red-500);
  --theme-accent-600: var(--color-persian-red-600);
  --theme-accent-700: var(--color-persian-red-700);
  --theme-accent-800: var(--color-persian-red-800);
  --theme-accent-900: var(--color-persian-red-900);
  --theme-accent-950: var(--color-persian-red-950);

  /* Sidebar Light Mode Variables */
  --sidebar-bg: white;
  --sidebar-border: #e0e0e0;
  --sidebar-text: #333;
  --sidebar-hover-bg: #f8f9fa;
  --sidebar-active-bg: #f8f9fa;
  --sidebar-active-color: var(--primary);
  --sidebar-active-border: var(--primary);

  /* Layout Variables */
  --header-height: 60px;
}

/* Begin Bodyweight Theme - Slate Blue */
[data-program='begin-bodyweight'] {
  --theme-accent: var(--color-pickled-bluewood-700);
  --theme-accent-50: var(--color-pickled-bluewood-50);
  --theme-accent-100: var(--color-pickled-bluewood-100);
  --theme-accent-200: var(--color-pickled-bluewood-200);
  --theme-accent-300: var(--color-pickled-bluewood-300);
  --theme-accent-400: var(--color-pickled-bluewood-400);
  --theme-accent-500: var(--color-pickled-bluewood-500);
  --theme-accent-600: var(--color-pickled-bluewood-600);
  --theme-accent-700: var(--color-pickled-bluewood-700);
  --theme-accent-800: var(--color-pickled-bluewood-800);
  --theme-accent-900: var(--color-pickled-bluewood-900);
  --theme-accent-950: var(--color-pickled-bluewood-950);
}

body {
  font-family: 'Rubik', sans-serif;
  margin: 0;
  background-color: var(--light);
  color: var(--dark-text);
  transition: background-color 0.3s ease, color 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Navigation */
.top-nav {
  background-color: var(--primary);
  color: var(--light-text);
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  height: var(--header-height);
  min-height: var(--header-height);
  box-sizing: border-box;
  width: 100%;
  z-index: 1000;
}

.app-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
  position: relative;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
}

/* Reset for sidebar nav */
aside nav {
  background-color: transparent;
  position: static;
  height: auto;
  min-height: 0;
  padding: 0;
  display: block;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--light-text);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s;
}

.logo:hover {
  color: var(--theme-accent);
}

/* Hamburger Toggle Button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--light-text);
  position: relative;
  transition: background-color 0.3s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background-color: var(--light-text);
  left: 0;
  transition: transform 0.3s ease;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

/* Hamburger animation when open */
.nav-toggle.open .hamburger {
  background-color: transparent;
}

.nav-toggle.open .hamburger::before {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open .hamburger::after {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Hide top nav links on desktop (sidebar is used instead) */
.nav-links {
  display: none;
}

.nav-links a {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1rem;
  margin-left: 20px;
  cursor: pointer;
  transition: color 0.3s;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--light-text);
}

.nav-links a.active {
  color: var(--light-text);
  border-bottom: 2px solid var(--theme-accent);
}

/* Sidebar Navigation (Desktop) */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg, #ffffff);
  border-right: 1px solid var(--sidebar-border, #e0e0e0);
  color: var(--sidebar-text, #333333);
  overflow-y: auto;
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    color 0.3s ease;
  flex: none;
  height: 100%;
}

.sidebar-nav {
  padding: 2rem 0 2rem 0;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: var(--sidebar-text, #333333);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.sidebar-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
  min-width: 24px;
  text-align: center;
}

.sidebar-text {
  flex: 1;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg, #e9ecef);
  color: var(--sidebar-active-color, #1a1a1a);
  border-left-color: var(--sidebar-active-border, #1a1a1a);
}

.sidebar-link.active {
  background: var(--sidebar-active-bg, #fff);
  color: var(--sidebar-active-color, #1a1a1a);
  border-left-color: var(--sidebar-active-border, #1a1a1a);
  font-weight: 600;
}

/* Main content with sidebar offset */
.main-content {
  flex: 1;
  overflow-y: auto;
  height: 100%;
  position: relative;
}

/* Remove old margin logic since we use flexbox now */
/* body:has(.sidebar[style*='display: block']) .main-content,
body:has(.sidebar:not([style*='display: none'])) .main-content {
  margin-left: 260px;
} */

/* Mobile Navigation Drawer */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  /* Hide sidebar on mobile */
  .sidebar {
    display: none !important;
  }

  /* Show mobile nav links */
  .nav-links {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 1000;
  }

  .nav-links.open {
    max-height: 200px;
    padding: 0.5rem 0;
  }

  .nav-links a {
    margin: 0;
    padding: 1rem 2rem;
    text-align: left;
    font-size: 1.1rem;
    border-bottom: none;
    width: 100%;
    display: block;
  }

  .nav-links a:active {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .nav-links a.active {
    color: var(--light-text);
    border-bottom: none;
    border-left: 3px solid var(--theme-accent);
    background-color: rgba(255, 255, 255, 0.05);
  }

  /* Remove sidebar margin on mobile */
  .main-content {
    margin-left: 0 !important;
  }
}

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #aaa;
  flex: 1;
  margin-left: 2rem;
}

.breadcrumb-link {
  color: #aaa;
  text-decoration: none;
  transition: color 0.3s;
}

.breadcrumb-link:hover {
  color: var(--light-text);
}

.breadcrumb-separator {
  color: #666;
}

.breadcrumb-program {
  color: var(--light-text);
  font-weight: 600;
}

.breadcrumb-section {
  color: var(--light-text);
}

@media (max-width: 768px) {
  .breadcrumb {
    display: none !important;
  }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Program Selector */
.selector-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--primary);
}

.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.program-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s ease;
  cursor: pointer;
}

.program-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.program-card-header {
  padding: 2.5rem 2rem;
  text-align: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 1px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.limitless-legs-header {
  background: linear-gradient(
    135deg,
    var(--color-persian-red-600),
    var(--color-persian-red-800)
  );
}

.begin-bodyweight-header {
  background: linear-gradient(135deg, #2c3e50, #34495e);
}

.program-card-body {
  padding: 1rem 2rem;
  color: var(--dark-text);
  line-height: 1.6;
}

/* Program Sections */
.program-section {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.overview-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

.overview-content h3 {
  color: var(--theme-accent);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.overview-content h3:first-of-type {
  margin-top: 1.5rem;
}

.overview-content p {
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* Search Bar */
.search-container {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

input#searchBar,
input#searchBarBB {
  width: 100%;
  max-width: 500px;
  padding: 10px 15px;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 25px;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

/* Sections */
.section {
  display: none; /* Hidden by default */
}
.section.active {
  display: block;
}

/* Grid for Exercises */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, background-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
}

/* Placeholder Image Styling */
.card-img {
  width: 100%;
  height: 180px;
  background-color: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-weight: bold;
  object-fit: cover;
}

.card-body {
  padding: 15px;
}

.card-title {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-block;
  background-color: var(--theme-accent);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  width: 90%;
  max-width: 800px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.modal-content > .video-container {
  flex-shrink: 0;
}

.modal-content > .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Modal Header - Contains title and close button */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem 1rem 2rem;
  background: white;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  flex: 1;
}

/* Video Selector Pills - Only contains video switching buttons */
.video-selector-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem 0;
  background: white;
  gap: 0;
}

.video-selector-btn {
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 2px solid var(--theme-accent);
  color: var(--theme-accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Rubik', sans-serif;
  min-width: 100px;
  text-transform: capitalize;
}

.video-selector-btn:first-child {
  border-radius: 20px 0 0 20px;
  border-right-width: 1px;
}

.video-selector-btn:last-child {
  border-radius: 0 20px 20px 0;
  border-left-width: 1px;
}

.video-selector-btn:only-child {
  border-radius: 20px;
}

.video-selector-btn:hover:not(.active) {
  background: var(--theme-accent-50);
}

.video-selector-btn.active {
  background: var(--theme-accent);
  color: white;
  border-color: var(--theme-accent);
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  background: black;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
}

.modal-body {
  padding: 0 2rem 2rem 2rem;
}

.modal-body .card-tags {
  margin-bottom: 1.5rem;
}

.close-btn {
  font-size: 1.8rem;
  cursor: pointer;
  color: #333;
  transition: color 0.3s ease;
  line-height: 1;
  padding: 0 0.25rem;
  flex-shrink: 0;
}

/* Plans Header Styling */
.plans-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.plans-header h2 {
  margin: 0;
}

/* Plan Selector Styling */
.plan-selectors {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  transition: background-color 0.3s ease;
}

select {
  padding: 8px;
  font-size: 1rem;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

/* Plan Grid and Cards */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.plan-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  gap: 15px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.plan-card-number {
  background-color: var(--theme-accent);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.plan-card-content {
  flex: 1;
}

.plan-exercise-name {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.plan-exercise-link {
  color: var(--theme-accent);
  text-decoration: none;
  transition: text-decoration 0.2s;
}

.plan-exercise-link:hover {
  text-decoration: underline;
}

.plan-card-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.plan-detail {
  display: flex;
  flex-direction: column;
}

.plan-label {
  font-size: 0.75rem;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.plan-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-text);
  width: fit-content;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  margin-top: 20px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.plan-table {
  display: table;
}

.plan-grid {
  display: none;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: border-color 0.3s ease;
}

th {
  background-color: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background-color 0.3s ease;
}

tbody tr {
  transition: background-color 0.2s;
}

tbody tr:hover {
  background-color: #fafafa;
}

.plan-exercise-link {
  color: var(--theme-accent);
  text-decoration: none;
  font-weight: 500;
  transition: text-decoration 0.2s;
}

.plan-exercise-link:hover {
  text-decoration: underline;
}

/* Help Button Styling */
.help-btn {
  background-color: transparent;
  color: var(--theme-accent);
  border: 2px solid var(--theme-accent);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-btn:hover {
  background-color: var(--theme-accent-50);
  border-color: var(--theme-accent-700);
  color: var(--theme-accent-700);
  transform: scale(1.1);
}

.help-btn:active {
  transform: scale(0.95);
  background-color: var(--theme-accent-100);
}

/* Help Modal Styling */
.help-modal-content {
  max-width: 700px;
}

.help-modal-title {
  color: var(--primary);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.help-callout {
  background-color: var(--theme-accent-100);
  border-left: 4px solid var(--theme-accent);
  padding: 1.25rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  transition: background-color 0.3s ease;
}

.help-callout h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--theme-accent-800);
  font-size: 1.1rem;
}

.help-callout p {
  margin: 0;
  line-height: 1.6;
  color: var(--dark-text);
}

.quick-guide-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.quick-guide-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
  line-height: 1.5;
  color: var(--dark-text);
  font-weight: 500;
}

.quick-guide-list li:last-child {
  margin-bottom: 0;
}

.quick-guide-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 0;
  height: 0;
  border-left: 8px solid var(--theme-accent);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.help-content h3 {
  color: var(--primary);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.help-content ol {
  margin: 0;
  padding-left: 1.5rem;
  line-height: 1.8;
}

.help-content li {
  margin-bottom: 1rem;
}

.help-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.help-content ul li {
  margin-bottom: 0.4rem;
}

.help-content strong {
  color: var(--theme-accent-700);
}

.help-content em {
  color: var(--theme-accent-600);
}

/* Mobile adjustment */
@media (max-width: 600px) {
  .plan-selectors {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  .plan-selectors > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .plan-selectors label {
    font-weight: 600;
    font-size: 0.9rem;
  }
  .selector-title {
    font-size: 2rem;
    margin-bottom: 2rem;
  }
  .help-btn {
    margin-left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 0;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
  .help-btn:hover {
    background-color: var(--theme-accent-50);
    border-color: var(--theme-accent-700);
    color: var(--theme-accent-700);
    transform: none;
  }
  .help-btn:active {
    transform: scale(0.95);
    background-color: var(--theme-accent-100);
  }
  .help-btn::after {
    content: none;
  }
  .plan-table {
    display: none;
  }
  .plan-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
  .modal-header {
    padding: 1rem;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 0 1rem 1rem 1rem;
  }

  .video-selector-pills {
    padding: 1rem 1rem 0;
  }

  .video-selector-btn {
    min-width: 90px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  .help-callout {
    padding: 1rem;
  }
  .help-content ol {
    padding-left: 1.2rem;
  }
}

/* Tempo tooltip styling - base styles */
.tempo-cell {
  font-weight: 500;
  position: relative;
  display: inline-block;
  padding: 0;
}

/* Only apply interactive styles when there's a tooltip */
.tempo-cell[data-tooltip]:not([data-tooltip='']) {
  cursor: help;
  border-bottom: 2px dotted var(--theme-accent);
}

/* Custom tooltip using data-tooltip attribute */
.tempo-cell[data-tooltip]:not([data-tooltip=''])::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 0;
  transform: none;
  background-color: var(--primary);
  color: var(--light-text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: normal;
  width: max-content;
  max-width: min(280px, calc(100vw - 128px));
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-weight: normal;
  text-align: left;
  line-height: 1.4;
}

/* Show tooltip on hover */
.tempo-cell[data-tooltip]:not([data-tooltip='']):hover::after {
  opacity: 1;
}

/* Arrow for tooltip */
.tempo-cell[data-tooltip]:not([data-tooltip=''])::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 12px;
  transform: none;
  border: 6px solid transparent;
  border-top-color: var(--primary);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tempo-cell[data-tooltip]:not([data-tooltip='']):hover::before {
  opacity: 1;
}

/* Desktop: center tooltip above the element */
@media (min-width: 768px) {
  .tempo-cell[data-tooltip]:not([data-tooltip=''])::after {
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }

  .tempo-cell[data-tooltip]:not([data-tooltip=''])::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Dark Mode - automatically follows system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #1e1e1e;
    --light: #121212;
    --dark-text: #e0e0e0;
    --light-text: #fff;
  }

  body {
    background-color: var(--light);
    color: var(--dark-text);
  }

  /* Program Selector */
  .selector-title {
    color: var(--dark-text);
  }

  .program-card {
    background: #1e1e1e;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  }

  .program-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  }

  .program-card-body {
    color: var(--dark-text);
  }

  /* Overview Content */
  .overview-content {
    background: #1e1e1e;
  }

  .overview-content h3 {
    color: var(--theme-accent-400);
  }

  /* Cards */
  .card {
    background: #1e1e1e;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  }

  .card-img {
    background-color: #2a2a2a;
    color: #888;
  }

  /* Search Bar */
  input#searchBar,
  input#searchBarBB {
    background-color: #1e1e1e;
    color: var(--dark-text);
    border: 1px solid #3a3a3a;
  }

  input#searchBar::placeholder,
  input#searchBarBB::placeholder {
    color: #888;
  }

  /* Modal */
  .modal-content {
    background-color: #1e1e1e;
    color: var(--dark-text);
  }

  /* Sidebar Dark Mode - Set CSS Variables */
  :root {
    --sidebar-bg: #1e1e1e;
    --sidebar-border: #3a3a3a;
    --sidebar-text: #e0e0e0;
    --sidebar-hover-bg: #2a2a2a;
    --sidebar-active-bg: #2a2a2a;
    --sidebar-active-color: var(--theme-accent-400);
    --sidebar-active-border: var(--theme-accent-400);
  }

  /* Modal Header Dark Mode */
  .modal-header {
    background: #1e1e1e;
  }

  /* Video Selector Pills Dark Mode */
  .video-selector-pills {
    background: #1e1e1e;
  }

  .video-selector-btn {
    background: transparent;
    border-color: var(--theme-accent-400);
    color: var(--theme-accent-400);
  }

  .video-selector-btn:hover:not(.active) {
    background: rgba(211, 47, 47, 0.1);
  }

  .video-selector-btn.active {
    background: var(--theme-accent-400);
    color: white;
    border-color: var(--theme-accent-400);
  }

  .close-btn {
    color: var(--dark-text);
  }

  /* Plan Selectors */
  .plan-selectors {
    background: #1e1e1e;
  }

  select {
    background-color: #2a2a2a;
    color: var(--dark-text);
    border: 1px solid #3a3a3a;
  }

  /* Plan Cards */
  .plan-card {
    background: #1e1e1e;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  }

  .plan-value {
    color: var(--dark-text);
  }

  /* Tables */
  table {
    background: #1e1e1e;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  }

  th {
    background-color: #0d0d0d;
  }

  td {
    border-bottom: 1px solid #2a2a2a;
  }

  tbody tr:hover {
    background-color: #252525;
  }

  /* Help Modal */
  .help-callout {
    background-color: #2a1515;
    border-left: 4px solid var(--theme-accent);
  }

  .help-callout h3 {
    color: var(--theme-accent-400);
  }

  .help-callout p {
    color: var(--dark-text);
  }

  .quick-guide-list li {
    color: var(--dark-text);
  }

  .help-content h3 {
    color: var(--dark-text);
  }

  .help-content strong {
    color: var(--theme-accent-400);
  }

  .help-content em {
    color: var(--theme-accent-400);
  }

  .help-modal-title {
    color: var(--dark-text);
  }

  /* Help Button Dark Mode */
  .help-btn:hover {
    background-color: rgba(211, 47, 47, 0.1);
    border-color: var(--theme-accent-400);
    color: var(--theme-accent-400);
  }

  .help-btn:active {
    background-color: rgba(211, 47, 47, 0.2);
  }

  /* Mobile nav dark adjustments */
  @media (max-width: 768px) {
    .help-btn:hover {
      background-color: rgba(211, 47, 47, 0.1);
      border-color: var(--theme-accent-400);
      color: var(--theme-accent-400);
    }

    .help-btn:active {
      background-color: rgba(211, 47, 47, 0.2);
    }
  }

  /* Begin Bodyweight Dark Mode - Adjust help callout background for bluewood */
  [data-program='begin-bodyweight'] .help-callout {
    background-color: #1e2833;
  }

  /* Begin Bodyweight Dark Mode - Adjust help button hover backgrounds */
  [data-program='begin-bodyweight'] .help-btn:hover {
    background-color: rgba(69, 102, 132, 0.1);
  }

  [data-program='begin-bodyweight'] .help-btn:active {
    background-color: rgba(69, 102, 132, 0.2);
  }

  @media (max-width: 768px) {
    [data-program='begin-bodyweight'] .help-btn:hover {
      background-color: rgba(69, 102, 132, 0.1);
    }

    [data-program='begin-bodyweight'] .help-btn:active {
      background-color: rgba(69, 102, 132, 0.2);
    }
  }
}
