/* ═══════════════════════════════════════════════════════════════
   TEXT VISIBILITY FIX — Cream Theme Compatibility Layer
   Ensures all hardcoded dark-theme text colors are readable on
   the cream/paper background. Only activates in light/cream mode.
   ═══════════════════════════════════════════════════════════════ */

/* ── OTTLIB Library Cards (cards are white on cream bg) ──────── */
body.light .ottlib-card-title,
body.light .pdl-ott-card-title {
  color: #1c1b1a !important;
}

body.light .ottlib-card-info {
  background: rgba(28,27,26,0.02) !important;
}

body.light .ottlib-card-meta {
  color: #6b6358 !important;
  background: rgba(28,27,26,0.05) !important;
}

body.light .ottlib-card-rating,
body.light .ottlib-star {
  color: #d97706 !important;
}

body.light .ottlib-card-price {
  color: #a6192e !important;
}

body.light .ottlib-card-price.is-free {
  color: #059669 !important;
}

body.light .ottlib-card-price-orig {
  color: rgba(28,27,26,0.35) !important;
}

body.light .ottlib-progress-bar {
  background: rgba(28,27,26,0.08) !important;
}

body.light .ottlib-dl-badge {
  background: rgba(28,27,26,0.55) !important;
  color: rgba(255,255,255,0.85) !important;
}

body.light .ottlib-wish {
  background: rgba(28,27,26,0.08) !important;
}

body.light .ottlib-wish:hover,
body.light .ottlib-wish.active {
  background: rgba(166,25,46,0.12) !important;
}

/* ── OTTLIB Section Headers (below hero, on cream) ───────────── */
body.light .ottlib-section-text {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

body.light .ottlib-section-badge {
  color: #a6192e !important;
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.2) !important;
}

body.light .ottlib-see-all {
  color: #a6192e !important;
  background: rgba(166,25,46,0.06) !important;
  border-color: rgba(166,25,46,0.15) !important;
}

body.light .ottlib-see-all:hover {
  background: rgba(166,25,46,0.12) !important;
  border-color: rgba(166,25,46,0.3) !important;
}

/* ── OTTLIB Category Pills (on cream) ────────────────────────── */
body.light .ottlib-cat-pill {
  background: rgba(28,27,26,0.05) !important;
  border-color: rgba(28,27,26,0.1) !important;
  color: #6b6358 !important;
}

body.light .ottlib-cat-pill:hover,
body.light .ottlib-cat-pill.active {
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.25) !important;
  color: #a6192e !important;
}

/* ── OTTLIB Badges (on white cards, need darker colors) ──────── */
body.light .ottlib-badge-new {
  background: rgba(5,150,105,0.1) !important;
  border-color: rgba(5,150,105,0.3) !important;
  color: #059669 !important;
}

body.light .ottlib-badge-trending {
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.3) !important;
  color: #a6192e !important;
}

body.light .ottlib-badge-free {
  background: rgba(5,150,105,0.08) !important;
  border-color: rgba(5,150,105,0.25) !important;
  color: #059669 !important;
}

body.light .ottlib-badge-reading {
  background: rgba(124,58,237,0.1) !important;
  border-color: rgba(124,58,237,0.3) !important;
  color: #6d28d9 !important;
}

body.light .ottlib-discount-badge {
  background: rgba(217,119,6,0.12) !important;
  border-color: rgba(217,119,6,0.35) !important;
  color: #b45309 !important;
}

/* ── OTTLIB Streak / AI Banner (on cream) ────────────────────── */
body.light .ottlib-streak-label {
  color: #b45309 !important;
}

body.light .ottlib-streak-sub {
  color: #6b6358 !important;
}

body.light .ottlib-ai-banner-inner {
  background: rgba(124,58,237,0.06) !important;
  border-color: rgba(124,58,237,0.2) !important;
}

body.light .ottlib-ai-title {
  color: #6d28d9 !important;
}

body.light .ottlib-ai-sub {
  color: #6b6358 !important;
}

body.light .ottlib-ai-cta {
  background: rgba(124,58,237,0.1) !important;
  border-color: rgba(124,58,237,0.25) !important;
  color: #6d28d9 !important;
}

/* ── OTTLIB Free Filter Button ───────────────────────────────── */
body.light .ottlib-free-btn {
  background: rgba(5,150,105,0.08) !important;
  border-color: rgba(5,150,105,0.25) !important;
  color: #059669 !important;
}

body.light .ottlib-free-btn:hover,
body.light .ottlib-free-btn.active {
  background: rgba(5,150,105,0.15) !important;
  border-color: rgba(5,150,105,0.4) !important;
}

/* ── OTTLIB Category Row Titles ──────────────────────────────── */
body.light .ottlib-cat-row-title {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

body.light .ottlib-ach-name {
  color: #1c1b1a !important;
}

body.light .ottlib-ach {
  background: rgba(28,27,26,0.03) !important;
  border-color: rgba(28,27,26,0.08) !important;
}

body.light .ottlib-ach.unlocked {
  border-color: rgba(217,119,6,0.3) !important;
  background: rgba(217,119,6,0.06) !important;
}

/* ── OTTLIB Stats (outside hero, on cream) ───────────────────── */
body.light .ottlib-stat {
  background: rgba(28,27,26,0.03) !important;
  border-color: rgba(28,27,26,0.08) !important;
}

body.light .ottlib-stat-num {
  color: #1c1b1a !important;
}

body.light .ottlib-stat-label {
  color: #6b6358 !important;
}

/* ── PDL-OTT (Related Products on PDP) ───────────────────────── */
body.light .pdl-ott-body {
  background: rgba(28,27,26,0.02) !important;
}

body.light .pdl-ott-price.price-free {
  color: #059669 !important;
}

body.light .pdl-ott-btn {
  background: linear-gradient(135deg, #a6192e, #7d1122) !important;
  color: #fff !important;
}

/* ── SRV (Reviews) ───────────────────────────────────────────── */
body.light .srv-card {
  background: #fff !important;
  border: 1px solid rgba(28,27,26,0.12) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.light .srv-card-stars-num {
  color: #6b6358 !important;
}

body.light .srv-card-text {
  color: #4a4239 !important;
}

body.light .srv-author-name {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

body.light .srv-avatar {
  border-color: rgba(28,27,26,0.1) !important;
}

body.light .srv-card:hover {
  border-color: rgba(166,25,46,0.2) !important;
  box-shadow: 0 12px 36px rgba(28,27,26,0.1) !important;
}

/* ── SRV Form (Write Review) ─────────────────────────────────── */
body.light .srv-form-panel {
  background: #fff !important;
  border: 1px solid rgba(28,27,26,0.12) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.light .srv-form-title {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
}

body.light .srv-form-label,
body.light .srv-form-input,
body.light .srv-form-textarea {
  color: #1c1b1a !important;
}

body.light .srv-form-input,
body.light .srv-form-textarea {
  background: rgba(28,27,26,0.03) !important;
  border-color: rgba(28,27,26,0.12) !important;
}

body.light .srv-form-input:focus,
body.light .srv-form-textarea:focus {
  border-color: rgba(166,25,46,0.3) !important;
  background: rgba(166,25,46,0.03) !important;
}

body.light .srv-arrow {
  color: #1c1b1a !important;
  backdrop-filter: none !important;
  background: rgba(255,255,255,0.9) !important;
  border: 1px solid rgba(28,27,26,0.12) !important;
}

/* ── ARV (Admin Review Cards) ───────────────────────────────── */
body.light .arv-card {
  background: #fff !important;
  border: 1px solid rgba(28,27,26,0.12) !important;
}

body.light .arv-card-name {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
}

/* ── Dynamic content generator (inline #eef2ff) ──────────────── */
body.light [style*="color:#eef2ff"],
body.light [style*="color: #eef2ff"] {
  color: #1c1b1a !important;
}

/* ── Homepage section badges with inline light colors ───────── */
body.light .sh-section-badge[style*="color:#c4b5fd"] {
  color: #6d28d9 !important;
  background: rgba(124,58,237,0.1) !important;
  border-color: rgba(124,58,237,0.25) !important;
}

body.light .sh-section-badge[style*="color:#ff8fa8"] {
  color: #a6192e !important;
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.2) !important;
}

body.light .sh-section-badge[style*="color:#34d399"] {
  color: #059669 !important;
  background: rgba(5,150,105,0.08) !important;
  border-color: rgba(5,150,105,0.2) !important;
}

/* ── Sort dropdown (library) ─────────────────────────────────── */
body.light .ottlib-sort-select {
  background: rgba(28,27,26,0.05) !important;
  border-color: rgba(28,27,26,0.1) !important;
  color: #1c1b1a !important;
}

body.light .ottlib-sort-select option {
  background: #fff !important;
  color: #1c1b1a !important;
}

/* ── PWA install card text ────────────────────────────────────── */
body.light .pwa-card-text,
body.light .pwa-card-title {
  color: #1c1b1a !important;
}

/* ── Dashboard inline light text fixes ──────────────────────── */
body.light [style*="color:#e2d9f3"],
body.light [style*="color: #e2d9f3"] {
  color: #6d28d9 !important;
}

body.light [style*="color:#e2eaf8"],
body.light [style*="color: #e2eaf8"] {
  color: #1c1b1a !important;
}

/* ── OTTLIB hero gradient title fix for cream theme ──────────── */
body.light .ottlib-hero-title {
  background: linear-gradient(135deg, #1c1b1a 0%, #a6192e 50%, #c99a3c 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

body.light .ottlib-hero-sub {
  color: #6b6358 !important;
}

body.light .ottlib-search-input {
  background: rgba(28,27,26,0.05) !important;
  border-color: rgba(28,27,26,0.12) !important;
  color: #1c1b1a !important;
}

body.light .ottlib-search-input::placeholder {
  color: rgba(28,27,26,0.4) !important;
}

body.light .ottlib-search-icon {
  color: rgba(28,27,26,0.35) !important;
}

/* ── Pending Reviews heading (inline JS) ─────────────────────── */
body.light h3[style*="color:#e4e8f0"],
body.light h3[style*="color: #e4e8f0"] {
  color: #1c1b1a !important;
}

/* ── Rank numbers (leaderboard) ──────────────────────────────── */
body.light .rank-other {
  color: rgba(28,27,26,0.3) !important;
}

/* ── Premium Library page text ──────────────────────────────── */
body.light .prm-shelf-title {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

body.light .prm-shelf-label {
  color: #6b6358 !important;
}

body.light .prm-empty-text {
  color: #6b6358 !important;
}

/* ── Cart/Checkout text fixes ───────────────────────────────── */
body.light .cart-item-title,
body.light .cart-item-price {
  color: #1c1b1a !important;
}

body.light .cart-item-meta {
  color: #6b6358 !important;
}

body.light .cart-empty-text {
  color: #6b6358 !important;
}

/* ── Generic catch-all for any remaining hardcoded light text ── */
body.light [style*="color:#e4e8f0"],
body.light [style*="color: #e4e8f0"] {
  color: #1c1b1a !important;
}

body.light [style*="color:#eef2ff"],
body.light [style*="color: #eef2ff"] {
  color: #1c1b1a !important;
}

/* ── Professional font upgrade for card titles ──────────────── */
body.light .ottlib-card-title,
body.light .pdl-ott-card-title,
body.light .srv-form-title,
body.light .arv-card-name {
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

/* ── Additional fixes found during library page inspection ──── */
body.light .ottlib-cat-row-see-all {
  color: #6b6358 !important;
}

body.light .ottlib-cat-row-see-all:hover {
  color: #a6192e !important;
}

/* ottlib-see-all default (non-inline) uses #930205 - needs brand color */
body.light .ottlib-see-all {
  color: #a6192e !important;
  background: rgba(166,25,46,0.06) !important;
  border-color: rgba(166,25,46,0.15) !important;
}

body.light .ottlib-see-all:hover {
  background: rgba(166,25,46,0.12) !important;
  border-color: rgba(166,25,46,0.3) !important;
}

/* OTTLIB hero badge (inside dark hero - keep visible) */
body.light .ottlib-hero-badge {
  background: rgba(147,2,5,0.12) !important;
  border-color: rgba(147,2,5,0.25) !important;
}

/* OTTLIB section dots (visible on cream) */
body.light .ottlib-section-dot {
  box-shadow: 0 0 8px currentColor !important;
}

/* Inline section badges (on cream, not in hero) */
body.light .ottlib-section-badge[style*="color:#c4b5fd"] {
  color: #6d28d9 !important;
  background: rgba(124,58,237,0.1) !important;
  border-color: rgba(124,58,237,0.25) !important;
}

body.light .ottlib-section-badge[style*="color:#ff8fa8"] {
  color: #a6192e !important;
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.2) !important;
}

body.light .ottlib-section-badge[style*="color:#34d399"] {
  color: #059669 !important;
  background: rgba(5,150,105,0.08) !important;
  border-color: rgba(5,150,105,0.2) !important;
}

/* Sort/filter buttons (below hero, on cream) */
body.light .ottlib-sort-btn {
  background: rgba(28,27,26,0.05) !important;
  border-color: rgba(28,27,26,0.1) !important;
  color: #6b6358 !important;
}

body.light .ottlib-sort-btn:hover,
body.light .ottlib-sort-btn.active {
  background: rgba(166,25,46,0.08) !important;
  border-color: rgba(166,25,46,0.2) !important;
  color: #a6192e !important;
}

/* Achievement lock text */
body.light .ottlib-ach-lock {
  color: rgba(28,27,26,0.3) !important;
}

/* Empty state text */
body.light .ottlib-empty-text,
body.light .ottlib-empty {
  color: #6b6358 !important;
}

/* Wishlist text on library */
body.light .ottlib-wish-count {
  color: #6b6358 !important;
}

/* AI banner section header (on cream) */
body.light .ottlib-ai-banner {
  background: transparent !important;
}

/* Trust badges section (below library cards, on cream) */
body.light .trust-badge {
  color: #6b6358 !important;
}

body.light .trust-title {
  color: #1c1b1a !important;
}

/* Newsletter/subscribe section (on cream) */
body.light .subscribe-text,
body.light .subscribe-sub {
  color: #6b6358 !important;
}

body.light .subscribe-title {
  color: #1c1b1a !important;
}

/* ── Cat pill hover color fix ── */
body.light .ottlib-cat-pill:hover {
  color: #a6192e !important;
}

/* ── Sort dropdown wrapper ── */
body.light .ottlib-sort-wrap {
  background: transparent !important;
}

/* ── Achievement lock icon ── */
body.light .ottlib-ach-lock svg,
body.light .ottlib-ach-lock {
  opacity: 0.4 !important;
}

/* ── Browse grid heading ── */
body.light .ottlib-browse-title {
  color: #1c1b1a !important;
  font-family: 'Georgia', serif !important;
  letter-spacing: -0.01em !important;
}

body.light .ottlib-browse-count {
  color: #6b6358 !important;
}

/* ── Achievement description (on cream) ── */
body.light .ottlib-ach-desc {
  color: #6b6358 !important;
}

/* ── Cover fallback (has its own dark bg, keep as-is) ── */
/* ottlib-cover-fallback: dark bg + faint white = fine */

/* ── Card meta row (on cream) ── */
body.light .ottlib-card-meta-row {
  color: #6b6358 !important;
}

/* ── Inline mini preview label (admin dashboard) ── */
body.light [style*="color:rgba(255,255,255,0.3)"] {
  color: rgba(28,27,26,0.3) !important;
}
