/* theme/style.css */
:root {
    --bg-color: #ffffff;
    --text-color: #111111;
    --card-bg: #f9f9f9;
    --card-border: rgba(0, 0, 0, 0.05);
    --header-text: #111111;
    --link-color: #0056b3;
}

body.dark-mode {
    --bg-color: #1a1a2e;
    /* Fallback */
    --text-color: #e0e0e0;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --header-text: #ffffff;
    --link-color: #f093fb;
}

/* Base override */
body.light-mode {
    background: #ffffff !important;
    background-image: none !important;
    color: #111111 !important;
}

body.light-mode::before {
    display: none !important;
}

body.dark-mode {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%) fixed !important;
    color: #e0e0e0 !important;
}

body.dark-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    display: block !important;
}

/* Card Overrides */
body.light-mode .section-card,
body.light-mode .content-card,
body.light-mode .content-section,
body.light-mode .section-card,
body.light-mode .typo-box,
body.light-mode .toc-collapsible,
body.light-mode .container,
body.light-mode .jpblock,
body.light-mode .toc,
body.light-mode [data-bible-nav] {
    background: #ffffff !important;
    color: #111111 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    backdrop-filter: none !important;
}

body.dark-mode .section-card,
body.dark-mode .content-card,
body.dark-mode .content-section,
body.dark-mode .typo-box,
body.dark-mode .toc-collapsible,
body.dark-mode .jpblock,
body.dark-mode .toc {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(20px) !important;
}

/* Typography */
body.light-mode h1,
body.light-mode h1 a,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode h5,
body.light-mode h6,
body.light-mode b,
body.light-mode strong,
body.light-mode .toc-header,
body.light-mode .volume-title,
body.light-mode .typo-title {
    color: #111111 !important;
    -webkit-text-fill-color: initial !important;
    background: none !important;
    text-shadow: none !important;
}

body.light-mode p,
body.light-mode li,
body.light-mode div,
body.light-mode span,
body.light-mode label,
body.light-mode input,
body.light-mode textarea,
body.light-mode button,
body.light-mode blockquote,
body.light-mode summary,
body.light-mode summary::after,
body.light-mode .volume-title,
body.light-mode .chapter-link,
body.light-mode .section-link,
body.light-mode .details-content {
    color: #111111 !important;
}

body.light-mode summary:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode details {
    background: #f9f9f9 !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode ruby rt {
    color: #555555 !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode b,
body.dark-mode strong {
    color: #ffffff !important;
}

/* Links */
body.light-mode a {
    color: #0056b3 !important;
}

body.light-mode a:hover {
    color: #003d80 !important;
}

body.light-mode a.verse-link {
    color: #d32f2f !important;
}

body.dark-mode a {
    color: #a5b4fc !important;
}

body.dark-mode a:hover {
    color: #c7d2fe !important;
}

body.dark-mode a.verse-link {
    color: #fca5a5 !important;
}

/* Navigation buttons */
body.light-mode .nav-btn,
body.light-mode .back-link,
body.light-mode .search-btn {
    background: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
}

body.dark-mode .nav-btn,
body.dark-mode .back-link,
body.dark-mode .search-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #e0e0e0 !important;
}

/* Specific for Bible pages */
body.dark-mode[data-bible] {
    background: #1a1a2e !important;
}

/* Theme Toggle Button */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body.light-mode #theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* --- Global Verse Highlight Fix (Verified) --- */
/* --- Global Verse Highlight Fix (High Specificity) --- */
/* Overrides inline styles in Bible pages */
body [id^="v"]:target {
  scroll-margin-top: 5rem;
  padding: 6px 10px;
  border-radius: 6px;
  display: block;
  animation: highlightFade 0.5s ease-out;
}

/* Light Mode Highlight */
body:not(.dark-mode) [id^="v"]:target {
  background-color: #fff3cd !important;
  color: #111111 !important;
  border-left: 4px solid #ffc107;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Dark Mode Highlight */
body.dark-mode [id^="v"]:target {
  background-color: rgba(255, 193, 7, 0.15) !important;
  color: #ffffff !important;
  border-left: 4px solid #ffc107;
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.1);
  outline: none !important; /* Reset legacy outline */
}

/* System Dark Mode Fallback */
@media (prefers-color-scheme: dark) {
  body:not(.light-mode) [id^="v"]:target {
    background-color: rgba(255, 193, 7, 0.15) !important;
    color: #ffffff !important;
    border-left: 4px solid #ffc107;
  }
}

/* --- Modern Navigation Bar --- */
body [data-bible-nav] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 4rem !important; /* Increased spacing */
    padding: 2rem !important;
    border-radius: 16px;
    background: transparent !important;
    border: none !important;
}

/* Hide legacy separator elements inside nav */
body [data-bible-nav] hr { display: none !important; }

/* Layout adjustments for paragraphs */
body [data-bible-nav] p {
    margin: 0 !important;
    flex: 1;
    display: flex;
    justify-content: center;
}
body [data-bible-nav] p:first-of-type { justify-content: flex-start; }
body [data-bible-nav] p:last-of-type { justify-content: flex-end; }
body [data-bible-nav] p:nth-child(2) { justify-content: center; }

/* Button Styles */
body [data-bible-nav] a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.95em;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
}

/* Button Active State */
body [data-bible-nav] a:active { transform: scale(0.96); }

/* Light Mode Buttons */
body:not(.dark-mode) [data-bible-nav] a {
    background-color: #ffffff;
    color: #444444 !important;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
body:not(.dark-mode) [data-bible-nav] a:hover {
    background-color: #f8f9fa;
    border-color: #bbbbbb;
    color: #000000 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Dark Mode Buttons */
body.dark-mode [data-bible-nav] a {
    background-color: rgba(255, 255, 255, 0.05);
    color: #a5b4fc !important; /* Indigo accent */
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}
body.dark-mode [data-bible-nav] a:hover {
    background-color: rgba(165, 180, 252, 0.15);
    border-color: rgba(165, 180, 252, 0.4);
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(165, 180, 252, 0.15);
    transform: translateY(-2px);
}
