/*
 * Light theme — comprehensive overrides.
 * Linked from all user-app + landing + admin pages AFTER their inline <style>
 * so these rules take precedence.
 *
 * Why this exists: Original CSS used rgba(255,255,255,X) and hardcoded
 * #16161f / #0f0f17 for cards/backgrounds. On light theme (white page bg),
 * these become invisible. This file remaps each dark token to a working
 * light equivalent.
 */

html[data-theme="light"] {
  color-scheme: light;
}

/* ── Base body + meshes ── */
html[data-theme="light"] body,
html[data-theme="light"] .bg-mesh,
html[data-theme="light"] .bg-base {
  background: #f8fafc !important;
  background-image:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(99,102,241,.08) 0%, transparent 60%),
    radial-gradient(ellipse 55% 35% at 85% 105%, rgba(139,92,246,.06) 0%, transparent 60%) !important;
  color: #0f172a !important;
}

/* ── Page-level dark backgrounds → white ── */
html[data-theme="light"] [style*="background:#0f0f17"],
html[data-theme="light"] [style*="background: #0f0f17"],
html[data-theme="light"] [style*="background:#16161f"],
html[data-theme="light"] [style*="background: #16161f"],
html[data-theme="light"] [style*="background:#1a1a28"],
html[data-theme="light"] [style*="background: #1a1a28"],
html[data-theme="light"] [style*="background:#0c0c14"],
html[data-theme="light"] [style*="background: #0c0c14"] {
  background: #ffffff !important;
}

/* ── Cards ── */
html[data-theme="light"] .card,
html[data-theme="light"] .post-card,
html[data-theme="light"] .ex-card,
html[data-theme="light"] .modal-box,
html[data-theme="light"] .user-card,
html[data-theme="light"] .reply-card {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.08) !important;
  box-shadow: 0 1px 3px rgba(15,23,42,.04) !important;
}
html[data-theme="light"] .card-done {
  background: linear-gradient(135deg, #ffffff, #f0fdf4) !important;
  border-color: rgba(52,211,153,.35) !important;
}
html[data-theme="light"] .card-error {
  background: linear-gradient(135deg, #ffffff, #fef2f2) !important;
  border-color: rgba(239,68,68,.35) !important;
}
html[data-theme="light"] .card-processing {
  background: #ffffff !important;
  border-color: rgba(99,102,241,.35) !important;
}

/* ── Sidebar ── */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .admin-sidebar {
  background: #ffffff !important;
  border-right-color: rgba(15,23,42,.08) !important;
}
html[data-theme="light"] .sidebar-brand,
html[data-theme="light"] .sidebar-logo {
  border-bottom-color: rgba(15,23,42,.06) !important;
}
html[data-theme="light"] .sidebar-brand-text { color: #0f172a !important; }
html[data-theme="light"] .sidebar-section-label { color: #94a3b8 !important; }
html[data-theme="light"] .sidebar-footer { border-top-color: rgba(15,23,42,.06) !important; }
html[data-theme="light"] .nav-item,
html[data-theme="light"] .sidebar-item {
  color: #475569 !important;
}
html[data-theme="light"] .nav-item:hover,
html[data-theme="light"] .sidebar-item:hover {
  background: rgba(15,23,42,.04) !important;
  color: #0f172a !important;
}
html[data-theme="light"] .nav-item.active,
html[data-theme="light"] .sidebar-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08)) !important;
  color: #4f46e5 !important;
  border-color: rgba(99,102,241,.25) !important;
}
html[data-theme="light"] .sidebar-action-btn {
  background: rgba(15,23,42,.04) !important;
  border-color: rgba(15,23,42,.08) !important;
  color: #475569 !important;
}
html[data-theme="light"] .sidebar-action-btn:hover {
  background: rgba(15,23,42,.08) !important;
  color: #0f172a !important;
}
html[data-theme="light"] .user-info-name { color: #0f172a !important; }
html[data-theme="light"] .user-info-meta { color: #64748b !important; }

/* ── Topbar mobile ── */
html[data-theme="light"] .topbar-mobile {
  background: rgba(255,255,255,.95) !important;
  border-bottom-color: rgba(15,23,42,.08) !important;
}
html[data-theme="light"] .topbar-mobile .text-white,
html[data-theme="light"] .topbar-mobile span { color: #0f172a !important; }
html[data-theme="light"] .hamburger-btn {
  background: rgba(15,23,42,.05) !important;
  border-color: rgba(15,23,42,.08) !important;
  color: #475569 !important;
}

/* ── Buttons ── */
html[data-theme="light"] .btn-ghost,
html[data-theme="light"] .btn-secondary {
  background: rgba(15,23,42,.04) !important;
  border-color: rgba(15,23,42,.1) !important;
  color: #475569 !important;
}
html[data-theme="light"] .btn-ghost:hover,
html[data-theme="light"] .btn-secondary:hover {
  background: rgba(15,23,42,.08) !important;
  color: #0f172a !important;
}

/* ── Inputs ── */
html[data-theme="light"] .inp,
html[data-theme="light"] .field,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] textarea,
html[data-theme="light"] select {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.12) !important;
  color: #0f172a !important;
}
html[data-theme="light"] .inp:focus,
html[data-theme="light"] .field:focus,
html[data-theme="light"] input:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] select:focus {
  border-color: rgba(99,102,241,.5) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1) !important;
}
html[data-theme="light"] .inp::placeholder,
html[data-theme="light"] .field::placeholder,
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #94a3b8 !important;
}

/* ── Tables — content borders MUST be visible ── */
html[data-theme="light"] table { background: #ffffff !important; }
html[data-theme="light"] table td,
html[data-theme="light"] table th {
  border-color: rgba(15,23,42,.1) !important;
  color: #0f172a !important;
}

/* ── Text color hierarchy ── */
html[data-theme="light"] .text-white { color: #0f172a !important; }
html[data-theme="light"] .text-slate-300 { color: #334155 !important; }
html[data-theme="light"] .text-slate-400 { color: #475569 !important; }
html[data-theme="light"] .text-slate-500 { color: #64748b !important; }
html[data-theme="light"] .text-slate-600 { color: #94a3b8 !important; }
html[data-theme="light"] .text-slate-700 { color: #cbd5e1 !important; }

/* Inline-styled text colors */
html[data-theme="light"] [style*="color:#f1f5f9"],
html[data-theme="light"] [style*="color: #f1f5f9"],
html[data-theme="light"] [style*="color:#e2e8f0"],
html[data-theme="light"] [style*="color: #e2e8f0"],
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:#ffffff"],
html[data-theme="light"] [style*="color: #ffffff"] {
  color: #0f172a !important;
}
html[data-theme="light"] [style*="color:#94a3b8"],
html[data-theme="light"] [style*="color: #94a3b8"] {
  color: #64748b !important;
}
html[data-theme="light"] [style*="color:#475569"],
html[data-theme="light"] [style*="color: #475569"] {
  color: #64748b !important;
}
html[data-theme="light"] [style*="color:#64748b"],
html[data-theme="light"] [style*="color: #64748b"] {
  color: #94a3b8 !important;
}

/* ── Inline rgba border overrides ── */
html[data-theme="light"] [style*="border: 1px solid rgba(255,255,255,.06)"],
html[data-theme="light"] [style*="border: 1px solid rgba(255,255,255,.07)"],
html[data-theme="light"] [style*="border: 1px solid rgba(255,255,255,.08)"],
html[data-theme="light"] [style*="border: 1px solid rgba(255,255,255,.1)"],
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255,.06)"],
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255,.07)"],
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255,.08)"],
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255,.1)"] {
  border-color: rgba(15,23,42,.1) !important;
}

/* ── Modal overlay ── */
html[data-theme="light"] .modal-overlay {
  background: rgba(15,23,42,.45) !important;
}

/* ── Status / category / generic badges keep their accent colors; light tone tweak ── */
html[data-theme="light"] .badge,
html[data-theme="light"] .status-badge {
  background-clip: padding-box !important;
}
html[data-theme="light"] .status-badge-pending,
html[data-theme="light"] .status-open {
  background: rgba(100,116,139,.1) !important;
  color: #475569 !important;
  border-color: rgba(100,116,139,.25) !important;
}

/* ── Forum-specific ── */
html[data-theme="light"] .vote-btn {
  background: rgba(15,23,42,.04) !important;
  border-color: rgba(15,23,42,.08) !important;
  color: #64748b !important;
}
html[data-theme="light"] .vote-count { color: #0f172a !important; }
html[data-theme="light"] .reply-card.is-admin-reply {
  background: rgba(99,102,241,.05) !important;
}
html[data-theme="light"] .filter-tab { color: #64748b !important; }
html[data-theme="light"] .filter-tab:hover {
  color: #0f172a !important;
  background: rgba(15,23,42,.05) !important;
}
html[data-theme="light"] .cat-card { background: #ffffff !important; }
html[data-theme="light"] .modal-cat-opt {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.1) !important;
}
html[data-theme="light"] .modal-cat-opt:hover {
  background: rgba(15,23,42,.03) !important;
  border-color: rgba(15,23,42,.15) !important;
}
html[data-theme="light"] .modal-cat-title { color: #0f172a !important; }
html[data-theme="light"] .modal-cat-hint { color: #475569 !important; }
html[data-theme="light"] .post-content { color: #334155 !important; }

/* ── Admin sidebar bottom items (the only navigable thing in admin) ── */
html[data-theme="light"] .sidebar-divider { background: rgba(15,23,42,.08) !important; }

/* ── Skeletons — keep subtle but visible on light ── */
html[data-theme="light"] .skeleton {
  background: linear-gradient(90deg,
    rgba(15,23,42,.04) 25%,
    rgba(15,23,42,.08) 50%,
    rgba(15,23,42,.04) 75%) !important;
  background-size: 600px 100% !important;
}

/* ── Notification dropdown ── */
html[data-theme="light"] [style*="background:#16161f"],
html[data-theme="light"] [style*="background: #16161f"] {
  background: #ffffff !important;
  box-shadow: 0 12px 40px rgba(15,23,42,.15) !important;
}

/* ── Sidebar overlay on mobile ── */
html[data-theme="light"] .sidebar-overlay { background: rgba(15,23,42,.45) !important; }

/* ── Topbar token chip (light mode tweak — keep purple accent) ── */
html[data-theme="light"] .topbar-token-chip {
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08)) !important;
  border-color: rgba(99,102,241,.3) !important;
  color: #4f46e5 !important;
}

/* ── Token bar / progress (account.html) ── */
html[data-theme="light"] .token-bar {
  background: rgba(15,23,42,.06) !important;
}

/* ── Contact reasons / cards with rgba(255,255,255,.04-.08) bg ── */
html[data-theme="light"] [style*="background:rgba(255,255,255,.03)"],
html[data-theme="light"] [style*="background: rgba(255,255,255,.03)"],
html[data-theme="light"] [style*="background:rgba(255,255,255,.04)"],
html[data-theme="light"] [style*="background: rgba(255,255,255,.04)"],
html[data-theme="light"] [style*="background:rgba(255,255,255,.05)"],
html[data-theme="light"] [style*="background: rgba(255,255,255,.05)"],
html[data-theme="light"] [style*="background:rgba(255,255,255,.06)"],
html[data-theme="light"] [style*="background: rgba(255,255,255,.06)"] {
  background: rgba(15,23,42,.04) !important;
}

/* ── Scrollbar ── */
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1 !important; }

/* ── Icon / accent contrast (24.09.2026) ─────────────────────────────────────
 * The UI palette was designed on a dark ground: icons and accent text use
 * 300–400-level pastels (peach #f2c186, mint #34d399, sky #60a5fa, pink #f472b6)
 * inside translucent boxes of the same hue. On the light ground they melt into
 * their own background. CSS `stroke`/`color` beat the SVG presentation attribute
 * and (with !important) the inline style, so every icon is remapped to the
 * 700-level shade of the same hue — same identity, readable ink.
 */
html[data-theme="light"] svg[stroke="#f2c186"],
html[data-theme="light"] svg[stroke="#e8a25c"],
html[data-theme="light"] svg[stroke="#fbbf24"],
html[data-theme="light"] svg[stroke="#fcd34d"] { stroke: #9a4b0f !important; }
html[data-theme="light"] svg[stroke="#9d8f79"],
html[data-theme="light"] svg[stroke="#cfc0a8"] { stroke: #5c4a36 !important; }
html[data-theme="light"] svg[stroke="#34d399"],
html[data-theme="light"] svg[stroke="#6ee7b7"],
html[data-theme="light"] svg[stroke="#10b981"] { stroke: #047857 !important; }
html[data-theme="light"] svg[stroke="#60a5fa"],
html[data-theme="light"] svg[stroke="#38bdf8"] { stroke: #1d4ed8 !important; }
html[data-theme="light"] svg[stroke="#f472b6"] { stroke: #be185d !important; }
html[data-theme="light"] svg[stroke="#f87171"],
html[data-theme="light"] svg[stroke="#e8846d"],
html[data-theme="light"] svg[stroke="#d1553f"] { stroke: #b91c1c !important; }

/* inline style="color:#…" — icons drawn with currentColor and accent labels */
html[data-theme="light"] [style*="color:#f2c186"],
html[data-theme="light"] [style*="color: #f2c186"],
html[data-theme="light"] [style*="color:#e8a25c"],
html[data-theme="light"] [style*="color:#fbbf24"],
html[data-theme="light"] [style*="color:#fcd34d"] { color: #9a4b0f !important; }
html[data-theme="light"] [style*="color:#9d8f79"],
html[data-theme="light"] [style*="color:#cfc0a8"] { color: #5c4a36 !important; }
html[data-theme="light"] [style*="color:#f4ead9"] { color: #2b1e10 !important; }
html[data-theme="light"] [style*="color:#34d399"],
html[data-theme="light"] [style*="color:#6ee7b7"] { color: #047857 !important; }
html[data-theme="light"] [style*="color:#38bdf8"] { color: #0369a1 !important; }
html[data-theme="light"] [style*="color:#f87171"],
html[data-theme="light"] [style*="color:#fca5a5"],
html[data-theme="light"] [style*="color:#e8846d"] { color: #b91c1c !important; }

/* Tailwind accent text classes (pastel 200–400 → 700) */
html[data-theme="light"] .text-amber-200,
html[data-theme="light"] .text-amber-300,
html[data-theme="light"] .text-amber-400,
html[data-theme="light"] .text-orange-400 { color: #9a4b0f !important; }
html[data-theme="light"] .text-emerald-300,
html[data-theme="light"] .text-emerald-400 { color: #047857 !important; }
html[data-theme="light"] .text-sky-300,
html[data-theme="light"] .text-sky-400,
html[data-theme="light"] .text-blue-400 { color: #0369a1 !important; }
html[data-theme="light"] .text-violet-300,
html[data-theme="light"] .text-violet-400 { color: #6d28d9 !important; }
html[data-theme="light"] .text-indigo-200,
html[data-theme="light"] .text-indigo-300,
html[data-theme="light"] .text-indigo-400 { color: #4338ca !important; }
html[data-theme="light"] .text-pink-400 { color: #be185d !important; }
html[data-theme="light"] .text-rose-400 { color: #be123c !important; }
html[data-theme="light"] .text-red-300,
html[data-theme="light"] .text-red-400 { color: #b91c1c !important; }
/* slate-600/700 were mapped LIGHTER than 500 above — on white that is the dimmest text on the page */
html[data-theme="light"] .text-slate-600 { color: #64748b !important; }
html[data-theme="light"] .text-slate-700 { color: #64748b !important; }

/* Piemēru bāze chips: peach ink on peach ground → dark amber ink */
html[data-theme="light"] .mat-chip,
html[data-theme="light"] .source-badge-ai,
html[data-theme="light"] .source-badge-pdf,
html[data-theme="light"] .source-badge-manual {
  color: #7c3f0c !important;
  background: rgba(232,162,92,.16) !important;
  border-color: rgba(154,75,15,.35) !important;
}
/* Tailwind colour classes with opacity modifiers (e.g. text-amber-300/70) are not
   matched by the plain class rules above */
html[data-theme="light"] [class*="text-amber-300/"],
html[data-theme="light"] [class*="text-amber-400/"] { color: rgba(154,75,15,.8) !important; }
html[data-theme="light"] [class*="text-emerald-400/"] { color: rgba(4,120,87,.8) !important; }
html[data-theme="light"] [class*="text-indigo-300/"],
html[data-theme="light"] [class*="text-indigo-400/"] { color: rgba(67,56,202,.8) !important; }
/* Forum category cards drive their colours through --accent set inline; an
   !important custom property from the stylesheet beats the inline declaration */
html[data-theme="light"] .home-card[style*="--accent:#f2c186"] { --accent: #9a4b0f !important; }
html[data-theme="light"] .home-card[style*="--accent:#fbbf24"] { --accent: #b45309 !important; }
html[data-theme="light"] .home-card[style*="--accent:#f0876f"],
html[data-theme="light"] .home-card[style*="--accent:#e8846d"] { --accent: #b91c1c !important; }
html[data-theme="light"] .home-card[style*="--accent:#34d399"] { --accent: #047857 !important; }
html[data-theme="light"] .home-card[style*="--accent:#60a5fa"] { --accent: #1d4ed8 !important; }
