:root {
  /* Default: Pure Black OLED Dark Theme */
  --bg: #000000;
  --bg-card: #0c0d0e;
  --border: #1e2023;
  --border-table: #23272e;
  --text-main: #ffffff;
  --text-muted: #9499a1;
  --text-dim: #606773;
  --header-bg: #14161a;
  --day-bg: #082115;
  --day-text: #4ade80;
  --type-bg: #0c1c33;
  --type-text: #60a5fa;
  --btn-blue: #2563eb;
  --btn-blue-hover: #1d4ed8;
}

html.light-theme,
body.light-theme {
  --bg: #ffffff;
  --bg-card: #f8fafc;
  --border: #e2e8f0;
  --border-table: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --header-bg: #f1f5f9;
  --day-bg: #ecfdf5;
  --day-text: #065f46;
  --type-bg: #eff6ff;
  --type-text: #1e40af;
  --btn-blue: #2563eb;
  --btn-blue-hover: #1d4ed8;
}

html.dark-theme,
body.dark-theme {
  --bg: #000000;
  --bg-card: #0c0d0e;
  --border: #1e2023;
  --border-table: #23272e;
  --text-main: #ffffff;
  --text-muted: #9499a1;
  --text-dim: #606773;
  --header-bg: #14161a;
  --day-bg: #082115;
  --day-text: #4ade80;
  --type-bg: #0c1c33;
  --type-text: #60a5fa;
  --btn-blue: #2563eb;
  --btn-blue-hover: #1d4ed8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.workout-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  animation: pageEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Top Navigation Bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* shadcn-style Button */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.button svg {
  display: block;
}

.button:hover {
  background-color: #15171a;
  border-color: #2563eb;
  color: #2563eb;
}

html.light-theme .button:hover,
body.light-theme .button:hover {
  background-color: #f1f5f9;
  border-color: #2563eb;
  color: #2563eb;
}

.button:active {
  transform: scale(0.97);
}

/* shadcn-inspired Theme Dropdown Menu */
.theme-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 2px;
  transform-origin: top right;
  animation: themeDropdownPop 0.14s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes themeDropdownPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.theme-dropdown.open {
  display: flex;
}

.theme-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: background-color 0.12s ease, color 0.12s ease;
  user-select: none;
  text-align: left;
}

.theme-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-dropdown-item:hover,
.theme-dropdown-item:focus-visible {
  background-color: #15171a;
  color: var(--text-main);
}

html.light-theme .theme-dropdown-item:hover,
body.light-theme .theme-dropdown-item:hover,
html.light-theme .theme-dropdown-item:focus-visible,
body.light-theme .theme-dropdown-item:focus-visible {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.theme-dropdown-item .check-icon {
  opacity: 0;
  color: var(--btn-blue);
  transition: opacity 0.12s ease;
}

.theme-dropdown-item.active {
  color: var(--text-main);
  font-weight: 600;
  background-color: #15171a;
}

html.light-theme .theme-dropdown-item.active,
body.light-theme .theme-dropdown-item.active {
  background-color: #f1f5f9;
}

.theme-dropdown-item.active .check-icon {
  opacity: 1;
}

/* Page Heading */
h2 {
  text-align: left;
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 32px;
  border: 1px solid var(--border-table);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background-color: var(--bg-card);
}

th,
td {
  border-bottom: 1px solid var(--border-table);
  border-right: 1px solid var(--border-table);
  padding: 10px 14px;
  vertical-align: middle;
  background-color: var(--bg-card);
  color: var(--text-main);
}

tr:hover td {
  background-color: #15171a;
}

html.light-theme tr:hover td,
body.light-theme tr:hover td {
  background-color: #f1f5f9;
}

th:last-child,
td:last-child {
  border-right: none;
}

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

/* Column Alignments - Fix "Everything in Middle" */
th {
  background-color: var(--header-bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Column 1: S.No */
th:nth-child(1),
td:nth-child(1) {
  width: 54px;
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Column 2: Exercise Name (Left Aligned for readability) */
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
  font-weight: 500;
  color: var(--text-main);
}

/* Column 3: Sets */
th:nth-child(3),
td:nth-child(3) {
  width: 70px;
  text-align: center;
}

/* Column 4: Reps */
th:nth-child(4),
td:nth-child(4) {
  width: 130px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  letter-spacing: -0.01em;
}

/* Column 5: Tutorial Link */
th:nth-child(5),
td:nth-child(5) {
  width: 110px;
  text-align: center;
}

/* Day Title Header (Monday, Tuesday, etc.) */
.day-title {
  background-color: var(--day-bg) !important;
  color: var(--day-text) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  text-align: left !important;
  padding: 12px 16px !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

/* Exercise Type Section Header */
.exercise-type {
  background-color: var(--type-bg) !important;
  color: var(--type-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-align: left !important;
  padding: 9px 16px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

/* Tutorial Action Links - Fix "Text Bluered" */
td a,
.tutorial-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  background-color: var(--btn-blue);
  color: #ffffff !important;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: all 0.15s ease;
  white-space: nowrap;
}

td a:visited,
.tutorial-link:visited {
  color: #ffffff !important;
}

td a:hover,
.tutorial-link:hover {
  background-color: var(--btn-blue-hover);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
  color: #ffffff !important;
}

td a:active,
.tutorial-link:active {
  transform: translateY(0);
}

/* Print Styles */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .top-nav,
  .button,
  td a {
    display: none !important;
  }

  table {
    box-shadow: none !important;
    page-break-inside: avoid;
    border: 1px solid #000000 !important;
  }

  th,
  td {
    border: 1px solid #000000 !important;
  }
}

/* Responsive Styles */
@media (max-width: 768px) {
  .workout-wrapper {
    padding: 16px 10px 60px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 8px 10px;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: 100px;
    font-size: 12px;
  }
}