/* Theme System for BookGrill.net — Cyberpunk Edition */
/* Dark/Light mode with CSS variables */

/* Light Theme — cyberpunk blue accent */
:root {
  /* Backgrounds */
  --bg-primary: #fff;
  --bg-secondary: rgba(235, 242, 255, 0.8);
  --bg-secondary-hover: rgba(215, 230, 255, 0.8);
  --bg-tertiary: #f0f4ff;

  /* Text colors */
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-tertiary: #888;
  --text-white: #fff;

  /* Accent colors */
  --accent-primary: #0088ff;
  --accent-dark: #0055cc;
  --accent-hover: #fff;

  /* Link colors */
  --link-primary: #1a1a2e;
  --link-hover: #0088ff;

  /* Border colors */
  --border-primary: #0088ff;
  --border-secondary: rgba(0, 136, 255, 0.15);
  --border-dotted: #cce0ff;

  /* Code block */
  --code-bg: #f0f4ff;

  /* Tag colors */
  --tag-bg: rgba(0, 136, 255, 0.08);
  --tag-border: rgba(0, 136, 255, 0.2);
}

/* Dark Theme — cyberpunk neon blue */
[data-theme="dark"] {
  /* Backgrounds */
  --bg-primary: #0a0a1a;
  --bg-secondary: rgba(15, 15, 45, 0.6);
  --bg-secondary-hover: rgba(25, 25, 65, 0.6);
  --bg-tertiary: #0d0d2a;

  /* Text colors */
  --text-primary: #c5c5e0;
  --text-secondary: #7878a0;
  --text-tertiary: #e0e0ff;
  --text-white: #fff;

  /* Accent colors */
  --accent-primary: #00aaff;       /* neon blue */
  --accent-dark: #7b2fff;          /* electric purple */
  --accent-hover: #ff00ff;         /* magenta flash */

  /* Link colors */
  --link-primary: #a0a0d0;
  --link-hover: #00aaff;

  /* Border colors */
  --border-primary: #00aaff;
  --border-secondary: rgba(0, 170, 255, 0.2);
  --border-dotted: #1a1a3a;

  /* Code block */
  --code-bg: #0d0d2a;

  /* Tag colors */
  --tag-bg: rgba(0, 170, 255, 0.1);
  --tag-border: rgba(0, 170, 255, 0.3);
}

/* Apply CSS variables to theme elements */
body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

a {
  color: var(--link-primary);
}
a:hover {
  color: var(--accent-primary) !important;
}

/* All link hover states - override SCSS compiled #000 */
.post-title:hover,
a.post-title:hover,
.post-meta li a:hover,
.card-meta li a:hover,
.widget-list li a:hover,
.widget ul li a:hover,
.content a:hover,
.breadcrumbs a:hover,
footer a:hover,
.navigation .nav-link:hover {
  color: var(--accent-primary) !important;
}

.navigation {
  background-color: var(--bg-primary) !important;
}
.navigation .navbar-brand,
.navigation .nav-link {
  color: var(--text-primary) !important;
}
.navigation .nav-link:hover {
  color: var(--accent-primary) !important;
}

.bg-primary {
  background-color: var(--bg-tertiary) !important;
}

footer, footer a {
  color: var(--text-secondary) !important;
}

.copyright {
  color: var(--text-tertiary) !important;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary) !important;
}

.card, .widget {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-secondary) !important;
}

.sidebar .widget-title {
  color: var(--text-primary) !important;
}

.search input {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-secondary) !important;
}

.breadcrumb, .breadcrumb a {
  color: var(--text-secondary) !important;
}

/* Recommended widget */
.media-body h5, .media-body h5 a {
  color: var(--text-primary) !important;
}

/* Category list */
.widget ul li a {
  color: var(--text-primary) !important;
}

/* Theme Toggle Button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 10px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--accent-primary);
  color: var(--text-white);
  border-color: var(--accent-primary);
}

.theme-toggle:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.theme-icon {
  width: 20px;
  height: 20px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-sun {
  opacity: 0;
  position: absolute;
  transform: rotate(180deg);
}

.theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  position: relative;
  transform: rotate(0deg);
}

[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  position: absolute;
  transform: rotate(180deg);
}

/* Smooth color transitions */
html, body,
.navigation, .navigation a,
.theme-toggle,
.search input,
article, footer,
.card, .widget,
h1, h2, h3, h4, h5, h6,
.breadcrumb, .breadcrumb a {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Post content text - dark mode readability */
.content,
.content p,
.content li,
.content td,
.content th,
.content blockquote p,
.card-text,
article p {
  color: var(--text-primary) !important;
}

.content a {
  color: var(--accent-primary) !important;
}

/* Breadcrumbs */
.breadcrumbs,
.breadcrumbs a {
  color: var(--text-secondary) !important;
}
.breadcrumbs a:last-child {
  color: var(--accent-primary) !important;
}

/* Category/meta text - accent color */
.post-meta li a {
  color: var(--accent-primary) !important;
}
.post-meta li {
  color: var(--text-secondary) !important;
}

/* About widget text and button */
.widget-body p,
.widget-body .px-3 {
  color: var(--text-primary) !important;
}
.btn-outline-primary {
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  background-color: transparent !important;
}
.btn-outline-primary:hover {
  background-color: var(--accent-primary) !important;
  color: var(--accent-hover) !important;
}

/* Widget headers - clean style, no black bar */
.widget-header {
  background-color: transparent !important;
  color: var(--text-primary) !important;
  border: none !important;
  border-bottom: 2px solid var(--accent-primary) !important;
  border-radius: 0 !important;
  padding: 10px 0 !important;
}
.widget-header::before {
  display: none !important;
}
.widget-body {
  border-radius: 5px;
  border-color: var(--border-secondary) !important;
}

/* Copyright in dark mode */
.copyright {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-tertiary) !important;
}

/* Post tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.post-tag {
  display: inline-block;
  padding: 4px 12px;
  background-color: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary) !important;
  text-decoration: none !important;
}
.post-tag:hover {
  background-color: var(--accent-primary) !important;
  color: var(--accent-hover) !important;
  border-color: var(--accent-primary) !important;
}

/* Pagefind search - theme-aware */
.pagefind-ui {
  --pagefind-ui-text: var(--text-primary) !important;
  --pagefind-ui-background: var(--bg-primary) !important;
  --pagefind-ui-border: var(--border-secondary) !important;
  --pagefind-ui-primary: var(--accent-primary) !important;
}
.pagefind-ui .pagefind-ui__result-title,
.pagefind-ui .pagefind-ui__result-link {
  color: var(--text-primary) !important;
}
.pagefind-ui .pagefind-ui__result-excerpt {
  color: var(--text-primary) !important;
}
.pagefind-ui .pagefind-ui__result-nested .pagefind-ui__result-title {
  color: var(--accent-primary) !important;
}
.pagefind-ui .pagefind-ui__message {
  color: var(--text-secondary) !important;
}
.pagefind-ui .pagefind-ui__search-input {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-secondary) !important;
}
.pagefind-ui .pagefind-ui__search-clear {
  color: var(--text-secondary) !important;
  background-color: var(--bg-secondary) !important;
}
.pagefind-ui .pagefind-ui__result {
  border-top-color: var(--border-secondary) !important;
}
.pagefind-ui mark {
  background-color: var(--tag-bg) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-secondary);
  border-radius: 2px;
}

/* Section-level text (taxonomy pages, listings) */
.section p,
.book-summary,
.book-summary p {
  color: var(--text-primary) !important;
}

/* Book Cards */
.book-card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: block;
  height: 100%;
}
.book-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  padding: 24px;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.book-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .book-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.book-card-initial {
  width: 48px;
  height: 48px;
  background-color: var(--accent-primary);
  color: var(--accent-hover);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}
.book-card-title {
  font-size: 1.25rem;
  margin-bottom: 4px;
  color: var(--text-primary) !important;
}
.book-card-author {
  font-size: 0.9rem;
  color: var(--text-secondary) !important;
  margin-bottom: 12px;
}
.book-card-desc {
  font-size: 0.875rem;
  color: var(--text-primary) !important;
  margin-bottom: 12px;
  line-height: 1.5;
}
.book-card-count {
  display: inline-block;
  padding: 4px 10px;
  background-color: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary) !important;
}
.book-meta {
  font-size: 1rem;
  color: var(--text-secondary) !important;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
