/* Dark Mode Support for all pages */
:root {
  --bg-color: #FFFFFF;
  --text-color: #999999;
  --link-color: #999999;
  --border-color: #EEE;
  --table-bg: #FFFFFF;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #b0b0b0;
  --link-color: #b0b0b0;
  --border-color: #333;
  --table-bg: #1a1a1a;
}

/* Apply theme colors */
html, body {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Override inline font colors */
font[color],
h1, h2, h3, h4, h5, h6,
p, td, th, div, span,
.unnamed1 {
  color: var(--text-color) !important;
}

a, a:visited, a:active {
  color: var(--link-color) !important;
}

a:hover {
  opacity: 0.8;
}

/* Tables */
table, tr, td, th {
  background-color: var(--table-bg) !important;
  border-color: var(--border-color) !important;
}

/* Slideshow containers */
#slideshow-container {
  background: var(--bg-color) !important;
}

#caption {
  background: rgba(0, 0, 0, 0.5) !important;
  color: #fff !important;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background-color: #f0f0f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

[data-theme="dark"] .theme-toggle {
  background-color: #333;
}

.theme-toggle:hover {
  transform: scale(1.05);
}

[data-theme="dark"] .theme-toggle:hover {
  background-color: #444;
}

.theme-toggle:hover {
  background-color: #e0e0e0;
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  fill: #999;
  transition: fill 0.3s ease;
}

[data-theme="dark"] .theme-toggle svg {
  fill: #b0b0b0;
}

/* Hide the inactive icon */
.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}
