/* ==========================================================================
   DPGNotes Accessible Reading Themes & Contrast Engine
   Supports Light / Dark / Default DPG Midnight Blue + Font Scaling
   WCAG AA & AAA Compliance for Differentially Able Students & Readers
   ========================================================================== */

/* 1. DEFAULT THEME: DPGNotes Midnight Blue */
:root,
html[data-theme="default"],
body[data-theme="default"] {
  --r-theme-name: "default";
  --r-bg: #0b0f19;
  --r-surface: #111827;
  --r-surface-elevated: #1e293b;
  --r-border: rgba(255, 255, 255, 0.1);
  --r-border-strong: rgba(255, 255, 255, 0.2);
  --r-text: #f8fafc;
  --r-text-muted: #94a3b8;
  --r-heading: #ffffff;
  --r-accent: #6366f1;
  --r-accent-light: #818cf8;
  --r-code-bg: #0d1117;
  --r-pdf-canvas-filter: none;
  --r-topbar-bg: rgba(17, 24, 39, 0.9);
}

/* 2. LIGHT THEME: High-Contrast Academic Paper */
html[data-theme="light"],
body[data-theme="light"] {
  --r-theme-name: "light";
  --r-bg: #f8fafc;
  --r-surface: #ffffff;
  --r-surface-elevated: #f1f5f9;
  --r-border: #cbd5e1;
  --r-border-strong: #94a3b8;
  --r-text: #0f172a;           /* Jet Black: 16.2:1 contrast */
  --r-text-muted: #334155;     /* Dark slate: 7.8:1 contrast */
  --r-heading: #020617;
  --r-accent: #4338ca;         /* Deep Indigo: 7.5:1 contrast */
  --r-accent-light: #4f46e5;
  --r-code-bg: #f1f5f9;
  --r-pdf-canvas-filter: none;
  --r-topbar-bg: rgba(255, 255, 255, 0.95);

  /* Override solution viewers variables */
  --sol-bg: #f8fafc !important;
  --sol-surface: #ffffff !important;
  --sol-surface-elevated: #f1f5f9 !important;
  --sol-border: #cbd5e1 !important;
  --sol-text: #0f172a !important;
  --sol-text-muted: #334155 !important;
  --sol-code-bg: #f1f5f9 !important;
  --sol-primary: #4338ca !important;

  /* Override pdf viewer variables */
  --bg: #f8fafc !important;
  --sb: #ffffff !important;
  --surface: #f1f5f9 !important;
  --bdr: #cbd5e1 !important;
  --txt: #0f172a !important;
  --mut: #334155 !important;
  --pri: #4338ca !important;
  --pli: #4f46e5 !important;
}

/* Specific Light Theme DOM Overrides */
html[data-theme="light"] body {
  background-color: var(--r-bg) !important;
  color: var(--r-text) !important;
}

html[data-theme="light"] .sol-navbar,
html[data-theme="light"] .topbar {
  background: var(--r-topbar-bg) !important;
  border-bottom: 1px solid var(--r-border) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] .sol-brand,
html[data-theme="light"] .topbar .logo {
  color: #0f172a !important;
}

html[data-theme="light"] .sol-btn-secondary,
html[data-theme="light"] .nbtn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .sol-btn-secondary:hover,
html[data-theme="light"] .nbtn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] .sol-panel,
html[data-theme="light"] .scard,
html[data-theme="light"] .sol-serp-card,
html[data-theme="light"] .sol-meta-card,
html[data-theme="light"] .sol-card,
html[data-theme="light"] .sol-view-header,
html[data-theme="light"] .sol-block,
html[data-theme="light"] .sol-item-card,
html[data-theme="light"] .sol-engagement-bar,
html[data-theme="light"] .doc-blog-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="light"] .sol-title,
html[data-theme="light"] .sol-serp-title,
html[data-theme="light"] .doc-title,
html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4 {
  color: #0f172a !important;
}

html[data-theme="light"] .sol-subtext,
html[data-theme="light"] .doc-summary,
html[data-theme="light"] .mlabel,
html[data-theme="light"] .mval,
html[data-theme="light"] p {
  color: #1e293b !important;
}

html[data-theme="light"] .doc-full-details {
  color: #1e293b !important;
  border-top-color: #e2e8f0 !important;
}

/* Solution Viewer Metadata & Typography Contrast */
html[data-theme="light"] .sol-meta-item strong {
  color: #0f172a !important;
}

html[data-theme="light"] .sol-meta-item {
  color: #334155 !important;
}

html[data-theme="light"] .sol-meta-row {
  border-top-color: #cbd5e1 !important;
  color: #334155 !important;
}

html[data-theme="light"] .sol-q-title {
  color: #0369a1 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .sol-answer-content {
  color: #1e293b !important;
}

html[data-theme="light"] .sol-answer-content h1,
html[data-theme="light"] .sol-answer-content h2,
html[data-theme="light"] .sol-answer-content h3,
html[data-theme="light"] .sol-answer-content h4,
html[data-theme="light"] .sol-answer-content strong {
  color: #0f172a !important;
}

html[data-theme="light"] .sol-answer-content pre {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .sol-answer-content code {
  background: #e2e8f0 !important;
  color: #be185d !important;
}

/* Light Theme Badges Contrast */
html[data-theme="light"] .sol-badge {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border: 1px solid #c4b5fd !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .sol-badge-teal {
  background: #ccfbf1 !important;
  color: #0f766e !important;
  border-color: #5eead4 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .sol-badge-red {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .sol-badge-green {
  background: #d1fae5 !important;
  color: #047857 !important;
  border-color: #6ee7b7 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .sol-badge-orange {
  background: #ffedd5 !important;
  color: #c2410c !important;
  border-color: #fdba74 !important;
  font-weight: 700 !important;
}

/* Password Lock Overlay in Light Mode */
html[data-theme="light"] #passwordLockOverlay {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

html[data-theme="light"] #passwordLockOverlay h2 {
  color: #0f172a !important;
}

html[data-theme="light"] #passwordLockOverlay p {
  color: #334155 !important;
}

html[data-theme="light"] .sol-input,
html[data-theme="light"] .sol-select,
html[data-theme="light"] .sol-textarea {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .sol-input:focus,
html[data-theme="light"] .sol-select:focus,
html[data-theme="light"] .sol-textarea:focus {
  background: #ffffff !important;
  border-color: #4338ca !important;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15) !important;
}

/* Light Theme Screentime / Engagement Bar */
html[data-theme="light"] .sol-screentime-tracker {
  color: #334155 !important;
}

html[data-theme="light"] #screentimeDisplay {
  color: #0f172a !important;
}

/* Light Theme SERP Cards */
html[data-theme="light"] .sol-serp-meta-pills {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .sol-serp-meta-pill {
  color: #334155 !important;
}

html[data-theme="light"] .sol-serp-meta-pill strong {
  color: #0f172a !important;
}

/* Light Theme Search Engine & SERP Contrast (Fixes Image 3) */
html[data-theme="light"] .sol-google-search-bar {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .sol-google-search-bar:focus-within,
html[data-theme="light"] .sol-google-search-bar:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15), 0 6px 20px rgba(0, 0, 0, 0.1) !important;
}
html[data-theme="light"] .sol-google-search-input {
  color: #0f172a !important;
}
html[data-theme="light"] .sol-google-search-input::placeholder {
  color: #64748b !important;
}
html[data-theme="light"] .sol-google-btn,
html[data-theme="light"] .sol-search-btn {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}
html[data-theme="light"] .sol-google-btn:hover,
html[data-theme="light"] .sol-search-btn:hover {
  background: #f1f5f9 !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}
html[data-theme="light"] .sol-search-chip {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}
html[data-theme="light"] .sol-search-chip:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}
html[data-theme="light"] .sol-home-brand-suffix {
  color: #0f172a !important;
}
html[data-theme="light"] .sol-home-subtext {
  color: #334155 !important;
}
html[data-theme="light"] .sol-topics-label {
  color: #475569 !important;
}

/* Light Theme Global Modals & Custom Alerts / Confirms */
html[data-theme="light"] .dpg-modal-box {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15) !important;
}
html[data-theme="light"] .dpg-modal-title {
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-modal-text {
  color: #334155 !important;
}
html[data-theme="light"] .dpg-modal-btn.cancel {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-modal-btn.cancel:hover {
  background: #e2e8f0 !important;
  color: #020617 !important;
}

/* Light Theme Responsiveness & Platform Rating Modals (Fixes Image 4) */
html[data-theme="light"] #dpgResponsivenessModal,
html[data-theme="light"] #dpgPlatformRatingModal,
html[data-theme="light"] .dpg-rating-modal {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15), 0 0 20px rgba(99, 102, 241, 0.12) !important;
  color: #0f172a !important;
}
html[data-theme="light"] #dpgResponsivenessModal h4,
html[data-theme="light"] #dpgPlatformRatingModal h4,
html[data-theme="light"] .dpg-rating-modal h4 {
  color: #0f172a !important;
}
html[data-theme="light"] #dpgResponsivenessModal p,
html[data-theme="light"] #dpgPlatformRatingModal p,
html[data-theme="light"] .dpg-rating-modal p {
  color: #334155 !important;
}
html[data-theme="light"] #dpgDismissRespBtn,
html[data-theme="light"] #dpgDismissRatingBtn {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}
html[data-theme="light"] #dpgDismissRespBtn:hover,
html[data-theme="light"] #dpgDismissRatingBtn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
html[data-theme="light"] #dpgRespFeedbackText,
html[data-theme="light"] #dpgRatingFeedbackText {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}
html[data-theme="light"] #dpgRespFeedbackText::placeholder,
html[data-theme="light"] #dpgRatingFeedbackText::placeholder {
  color: #64748b !important;
}
html[data-theme="light"] .dpg-star-btn {
  color: #94a3b8;
}

/* PDF Viewer Specific Light Theme Styles */
html[data-theme="light"] .pdfmain {
  background: #e2e8f0 !important;
}

html[data-theme="light"] .sidebar {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .ai-out {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .ai-out strong {
  color: #4338ca !important;
}

html[data-theme="light"] .ai-out h1,
html[data-theme="light"] .ai-out h2,
html[data-theme="light"] .ai-out h3 {
  color: #3730a3 !important;
}

html[data-theme="light"] .chat-msg.ai {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] #aiChatInput,
html[data-theme="light"] #sidebarSearchInput {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #aiChatInput::placeholder,
html[data-theme="light"] #sidebarSearchInput::placeholder {
  color: #64748b !important;
}

html[data-theme="light"] .scard details {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] #endPdfRecommendations {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="light"] #endPdfRecommendations h2 {
  color: #0f172a !important;
}

html[data-theme="light"] #endPdfRecommendations h3 {
  color: #334155 !important;
}

html[data-theme="light"] code,
html[data-theme="light"] pre {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

/* 3. DARK THEME: Pure OLED Contrast Night */
html[data-theme="dark"],
body[data-theme="dark"] {
  --r-theme-name: "dark";
  --r-bg: #000000;
  --r-surface: #121212;
  --r-surface-elevated: #1a1a1a;
  --r-border: #27272a;
  --r-border-strong: #3f3f46;
  --r-text: #ffffff;           /* 21:1 pure contrast */
  --r-text-muted: #a1a1aa;
  --r-heading: #ffffff;
  --r-accent: #c084fc;
  --r-accent-light: #d8b4fe;
  --r-code-bg: #09090b;
  --r-pdf-canvas-filter: invert(0.92) hue-rotate(180deg);
  --r-topbar-bg: rgba(0, 0, 0, 0.95);

  /* Override solution viewers variables */
  --sol-bg: #000000 !important;
  --sol-surface: #121212 !important;
  --sol-surface-elevated: #1a1a1a !important;
  --sol-border: #27272a !important;
  --sol-text: #ffffff !important;
  --sol-text-muted: #a1a1aa !important;
  --sol-code-bg: #09090b !important;
  --sol-primary: #a855f7 !important;

  /* Override pdf viewer variables */
  --bg: #000000 !important;
  --sb: #0a0a0a !important;
  --surface: #141414 !important;
  --bdr: #27272a !important;
  --txt: #ffffff !important;
  --mut: #a1a1aa !important;
  --pri: #a855f7 !important;
  --pli: #c084fc !important;
}

html[data-theme="dark"] body {
  background-color: var(--r-bg) !important;
  color: var(--r-text) !important;
}

html[data-theme="dark"] .pdfmain {
  background: #000000 !important;
}

html[data-theme="dark"] .sidebar {
  background: #0a0a0a !important;
  border-color: #27272a !important;
}

html[data-theme="dark"] .pdfpage canvas {
  filter: var(--r-pdf-canvas-filter);
  border: 1px solid #333333;
}

/* ==========================================================================
   USER ACCESSIBILITY FONT SIZE SCALING
   ========================================================================== */
html[data-font-size="sm"] { font-size: 14px !important; }
html[data-font-size="md"] { font-size: 16px !important; }
html[data-font-size="lg"] { font-size: 18px !important; }
html[data-font-size="xl"] { font-size: 21px !important; } /* Low-vision accessibility */

/* ==========================================================================
   READER CONTROLS WIDGET UI
   ========================================================================== */
.dpg-reader-controls {
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px 6px;
  gap: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  user-select: none;
}

html[data-theme="light"] .dpg-reader-controls {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .dpg-reader-controls {
  background: #121212;
  border-color: #27272a;
}

.dpg-rc-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.dpg-rc-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="light"] .dpg-rc-btn:hover {
  background: #f1f5f9;
}

.dpg-rc-btn.active {
  background: var(--r-accent);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.dpg-rc-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

html[data-theme="light"] .dpg-rc-divider {
  background: #cbd5e1;
}

/* Floating widget placement when no header slot exists */
.dpg-reader-controls-floating {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99990;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Mobile & Tablet Compact Mode: Icon-only Theme Switches */
@media (max-width: 768px) {
  .dpg-reader-controls {
    padding: 2px 4px !important;
    gap: 2px !important;
    max-width: 100% !important;
  }
  .dpg-rc-btn {
    padding: 3px 6px !important;
    font-size: 0.74rem !important;
  }
  .dpg-rc-theme-text {
    display: none !important;
  }
  .dpg-rc-divider {
    height: 12px !important;
    margin: 0 1px !important;
  }
}

/* ==========================================================================
   6. IN-DOCUMENT NOTES (.added-notes) & PDF RECOMMENDATIONS THEME SUPPORT
   ========================================================================== */

/* ── Light Theme (.added-notes & End-of-PDF Recommendations) ── */
html[data-theme="light"] .added-notes {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-left: 5px solid #4338ca !important;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(67, 56, 202, 0.06) !important;
  color: #0f172a !important;
}

html[data-theme="light"] .added-notes::before {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%) !important;
}

html[data-theme="light"] .added-notes-header {
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .added-notes-title {
  color: #0f172a !important;
  text-shadow: none !important;
  font-weight: 750 !important;
}

html[data-theme="light"] .added-notes-tags-label {
  color: #4338ca !important;
}

html[data-theme="light"] .added-notes-tag {
  background: #eef2ff !important;
  border: 1px solid #c7d2fe !important;
  color: #4338ca !important;
  font-weight: 600 !important;
}

html[data-theme="light"] .added-notes-tag:hover {
  background: #e0e7ff !important;
  border-color: #818cf8 !important;
  color: #312e81 !important;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.15) !important;
}

html[data-theme="light"] .note-like-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html[data-theme="light"] .note-like-btn:hover {
  background: #fff1f2 !important;
  border-color: #fca5a5 !important;
  color: #e11d48 !important;
}

html[data-theme="light"] .note-like-btn.liked {
  background: #ffe4e6 !important;
  border-color: #fb7185 !important;
  color: #e11d48 !important;
}

html[data-theme="light"] .note-share-btn {
  background: #eef2ff !important;
  border-color: #c7d2fe !important;
  color: #4338ca !important;
}

html[data-theme="light"] .note-share-btn:hover {
  background: #e0e7ff !important;
  border-color: #818cf8 !important;
  color: #312e81 !important;
}

html[data-theme="light"] .added-notes-body {
  color: #1e293b !important;
}

html[data-theme="light"] .added-notes-body h1,
html[data-theme="light"] .added-notes-body h2 {
  color: #0f172a !important;
  font-weight: 750 !important;
}

html[data-theme="light"] .added-notes-body h3,
html[data-theme="light"] .added-notes-body h4 {
  color: #1e1b4b !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .added-notes-body p,
html[data-theme="light"] .added-notes-body li {
  color: #334155 !important;
  line-height: 1.75 !important;
}

html[data-theme="light"] .added-notes-body a {
  color: #4338ca !important;
}

html[data-theme="light"] .added-notes-body a:hover {
  color: #312e81 !important;
}

html[data-theme="light"] .added-notes-body code {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #be185d !important;
}

html[data-theme="light"] .dpg-native-ad-block {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .dpg-native-ad-badge {
  color: #4338ca !important;
}

html[data-theme="light"] .note-adsense-unit {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

/* End of PDF Recommendations - Light Theme */
html[data-theme="light"] #endPdfRecommendations {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="light"] #endPdfRecommendations h2 {
  color: #0f172a !important;
}

html[data-theme="light"] #endPdfRecommendations h3 {
  color: #334155 !important;
}

html[data-theme="light"] .pdf-recommendation-card,
html[data-theme="light"] #relevantResourcesGrid > div,
html[data-theme="light"] #moreFromContributorGrid > div,
html[data-theme="light"] #highRatedResourcesGrid > div {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .pdf-recommendation-card div:nth-child(2),
html[data-theme="light"] #relevantResourcesGrid > div div:nth-child(2),
html[data-theme="light"] #moreFromContributorGrid > div div:nth-child(2),
html[data-theme="light"] #highRatedResourcesGrid > div div:nth-child(2) {
  color: #0f172a !important;
}

html[data-theme="light"] #sbDomainGrid a,
html[data-theme="light"] #sbRelGrid a,
html[data-theme="light"] #sbSameGrid a,
html[data-theme="light"] #sbTopLikedGrid a,
html[data-theme="light"] #sbTopSharedGrid a {
  color: #1e293b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #sbDomainGrid a:hover,
html[data-theme="light"] #sbRelGrid a:hover,
html[data-theme="light"] #sbSameGrid a:hover,
html[data-theme="light"] #sbTopLikedGrid a:hover,
html[data-theme="light"] #sbTopSharedGrid a:hover {
  color: #4338ca !important;
}

/* ── Dark Theme (.added-notes & End-of-PDF Recommendations) ── */
html[data-theme="dark"] .added-notes {
  background: linear-gradient(145deg, #05070f 0%, #0d1222 50%, #151a30 100%) !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  border-left: 5px solid #a855f7 !important;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.8), 0 0 24px rgba(139, 92, 246, 0.15) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .added-notes-title {
  color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .added-notes-tags-label {
  color: #c4b5fd !important;
}

html[data-theme="dark"] .added-notes-tag {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .added-notes-body h1,
html[data-theme="dark"] .added-notes-body h2 {
  color: #e0e7ff !important;
}

html[data-theme="dark"] .added-notes-body h3 {
  color: #c4b5fd !important;
}

html[data-theme="dark"] .added-notes-body p,
html[data-theme="dark"] .added-notes-body li {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] #endPdfRecommendations {
  background: #090d16 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] #relevantResourcesGrid > div,
html[data-theme="dark"] #moreFromContributorGrid > div,
html[data-theme="dark"] #highRatedResourcesGrid > div {
  background: #111827 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   MINI SEARCH ENGINE ITEMS (Default & Accessible Themes)
   ========================================================================== */
.mini-search-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 8px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
}
.mini-search-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
}
.mini-search-item-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-search-item-meta {
  font-size: 0.68rem;
  color: #94a3b8;
}

/* Light Theme Mini Search Engine Overrides (High-Contrast Academic Paper) */
html[data-theme="light"] .mini-search-item {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}
html[data-theme="light"] .mini-search-item:hover {
  background: #f1f5f9 !important;
  border-color: #6366f1 !important;
}
html[data-theme="light"] .mini-search-item-title {
  color: #0f172a !important; /* Pure high-contrast Jet Black (16.2:1) */
}
html[data-theme="light"] .mini-search-item-meta {
  color: #475569 !important; /* Slate Gray (7.8:1) */
}

/* Light Theme Native Ads Card Overrides */
html[data-theme="light"] .dpg-native-ad-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-native-ad-card h4,
html[data-theme="light"] .dpg-native-ad-card .dpg-ad-title {
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-native-ad-card .dpg-ad-user-name,
html[data-theme="light"] .dpg-native-ad-card span.dpg-ad-user-name {
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-native-ad-card a span {
  color: #0f172a !important;
}
html[data-theme="light"] .dpg-native-ad-card .ad-media-box {
  border: 1px solid #e2e8f0 !important;
}
html[data-theme="light"] .dpg-ad-header-controls a,
html[data-theme="light"] .dpg-ad-header-controls button {
  background: rgba(241, 245, 249, 0.95) !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}
html[data-theme="light"] .dpg-ad-header-controls a:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}

