/* ========================================================
   THE CART COIN ($CART) - UNIVERSAL DARK & LIGHT THEME SYSTEM
   ======================================================== */

/* Smooth transitions */
body, .glass, header, footer, input, select, textarea, button, details, table, tr, td, article {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ---------------- LIGHT THEME OVERRIDES ---------------- */
html.light-theme {
  color-scheme: light;
}

html.light-theme body {
  background-color: #F8FAFC !important;
  color: #1E293B !important;
}

/* Glassmorphism in Light Mode */
html.light-theme .glass {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06) !important;
}

html.light-theme .glow-gold {
  box-shadow: 0 4px 25px -4px rgba(245, 158, 11, 0.22) !important;
}

/* Header & Footer */
html.light-theme header.glass {
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid #E2E8F0 !important;
}

html.light-theme footer {
  background-color: #F1F5F9 !important;
  border-top: 1px solid #E2E8F0 !important;
}

/* Headings & Text in Light Mode */
html.light-theme .text-white {
  color: #0F172A !important;
}

html.light-theme .text-gray-200,
html.light-theme .text-gray-300 {
  color: #334155 !important;
}

html.light-theme .text-gray-400 {
  color: #475569 !important; /* Enhanced contrast for labels and captions */
}

html.light-theme .text-gray-500 {
  color: #64748B !important;
}

html.light-theme .text-amber-300 {
  color: #B45309 !important;
}

html.light-theme .text-amber-400,
html.light-theme .text-amber-400\/80,
html.light-theme .text-amber-400\/90 {
  color: #D97706 !important;
}

html.light-theme .text-emerald-400,
html.light-theme .text-emerald-300,
html.light-theme .text-emerald-200\/80 {
  color: #059669 !important; /* Crisp, high-contrast forest emerald */
}

html.light-theme .text-purple-400,
html.light-theme .text-purple-300 {
  color: #7E22CE !important; /* Deep, readable purple */
}

html.light-theme .text-rose-400,
html.light-theme .text-rose-300 {
  color: #BE123C !important; /* Deep, readable ruby red */
}

html.light-theme .text-blue-400,
html.light-theme .text-blue-300 {
  color: #1D4ED8 !important; /* Deep royal blue */
}

html.light-theme .text-indigo-400,
html.light-theme .text-indigo-300 {
  color: #4338CA !important;
}

html.light-theme .text-gradient {
  background: linear-gradient(135deg, #B45309 0%, #D97706 50%, #EA580C 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* Backgrounds & Cards - Universal Light Mode Support */
html.light-theme .bg-gray-950,
html.light-theme .bg-gray-950\/90,
html.light-theme .bg-gray-950\/80,
html.light-theme .bg-gray-950\/70,
html.light-theme .bg-gray-950\/60,
html.light-theme .bg-gray-950\/50,
html.light-theme .bg-gray-900,
html.light-theme .bg-gray-900\/95,
html.light-theme .bg-gray-900\/90,
html.light-theme .bg-gray-900\/85,
html.light-theme .bg-gray-900\/80,
html.light-theme .bg-gray-900\/70,
html.light-theme .bg-gray-900\/60,
html.light-theme .bg-gray-900\/50,
html.light-theme .bg-gray-900\/40 {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
}

/* Specific section backgrounds */
html.light-theme section.bg-gray-950\/60 {
  background-color: #F8FAFC !important;
  border-color: #E2E8F0 !important;
}

/* Metric / Stat cards inside admin and app */
html.light-theme #adminSection-users .bg-gray-900\/60,
html.light-theme .grid .bg-gray-900\/60 {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}

html.light-theme .bg-gray-800,
html.light-theme .bg-gray-800\/80,
html.light-theme .bg-gray-800\/60,
html.light-theme .bg-gray-800\/50 {
  background-color: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #0F172A !important;
}

html.light-theme .bg-emerald-950,
html.light-theme .bg-emerald-950\/80,
html.light-theme .bg-emerald-950\/70,
html.light-theme .bg-emerald-950\/60 {
  background-color: #ECFDF5 !important;
  border-color: #6EE7B7 !important;
  color: #065F46 !important;
}

html.light-theme .bg-blue-950,
html.light-theme .bg-blue-950\/80,
html.light-theme .bg-blue-950\/70,
html.light-theme .bg-blue-950\/60 {
  background-color: #EFF6FF !important;
  border-color: #93C5FD !important;
  color: #1E40AF !important;
}

html.light-theme .bg-amber-400\/10,
html.light-theme .bg-amber-400\/20 {
  background-color: rgba(251, 191, 36, 0.18) !important;
}

html.light-theme .border-gray-950,
html.light-theme .border-gray-900,
html.light-theme .border-gray-800,
html.light-theme .border-gray-800\/80,
html.light-theme .border-gray-800\/60,
html.light-theme .border-gray-800\/50,
html.light-theme .border-gray-700,
html.light-theme .border-gray-700\/60 {
  border-color: #E2E8F0 !important;
}

/* Form Inputs, Selects, and Textareas */
html.light-theme input,
html.light-theme select,
html.light-theme textarea {
  background-color: #FFFFFF !important;
  color: #0F172A !important;
  border: 1px solid #CBD5E1 !important;
}

html.light-theme input:focus,
html.light-theme select:focus,
html.light-theme textarea:focus {
  border-color: #D97706 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2) !important;
  outline: none !important;
}

html.light-theme input::placeholder,
html.light-theme textarea::placeholder {
  color: #94A3B8 !important;
}

html.light-theme select option {
  background-color: #FFFFFF !important;
  color: #0F172A !important;
}

select option {
  background-color: #0F172A;
  color: #F8FAFC;
}

html.light-theme input[type="range"] {
  background-color: #E2E8F0 !important;
}

html.light-theme #grocerySlider {
  accent-color: #D97706 !important;
}

/* Modals & Deal Result Banners */
html.light-theme #uploadModal .glass,
html.light-theme #surveyModal .glass,
html.light-theme #claimModal .glass,
html.light-theme #consoleModal .glass,
html.light-theme #reportDealModal .glass,
html.light-theme #unlockCouponModal .glass,
html.light-theme #postCouponModal .glass {
  background-color: #FFFFFF !important;
  border-color: #CBD5E1 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

html.light-theme .bg-emerald-950\/40 {
  background-color: #ECFDF5 !important;
  border-color: #10B981 !important;
  color: #065F46 !important;
}

html.light-theme .bg-amber-950\/40 {
  background-color: #FFFBEB !important;
  border-color: #F59E0B !important;
  color: #92400E !important;
}

html.light-theme .bg-purple-950\/40 {
  background-color: #FAF5FF !important;
  border-color: #A855F7 !important;
  color: #581C87 !important;
}

html.light-theme .bg-red-950\/40 {
  background-color: #FEF2F2 !important;
  border-color: #EF4444 !important;
  color: #991B1B !important;
}

/* Survey Buttons & Poll Elements */
html.light-theme .survey-opt-btn {
  background-color: #FFFFFF !important;
  border-color: #CBD5E1 !important;
  color: #1E293B !important;
}

html.light-theme .survey-opt-btn:hover {
  border-color: #D97706 !important;
  background-color: #FFFBEB !important;
}

html.light-theme .survey-opt-btn.border-amber-400 {
  background-color: #FEF3C7 !important;
  border-color: #D97706 !important;
  color: #92400E !important;
}

html.light-theme #dailyPollContainer {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
}

html.light-theme #dailyPollOptions button {
  background-color: #F8FAFC !important;
  border-color: #E2E8F0 !important;
  color: #1E293B !important;
}

html.light-theme #dailyPollOptions button:hover {
  background-color: #FEF3C7 !important;
  border-color: #D97706 !important;
  color: #92400E !important;
}

/* Mobile Bottom Navigation */
html.light-theme nav.md\:hidden {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-top-color: #E2E8F0 !important;
}

html.light-theme nav.md\:hidden a {
  color: #64748B !important;
}

html.light-theme nav.md\:hidden a.text-amber-400 {
  color: #D97706 !important;
}

/* Tables & Lists */
html.light-theme thead,
html.light-theme thead th {
  background-color: #F8FAFC !important;
  color: #475569 !important;
  border-bottom: 2px solid #E2E8F0 !important;
}

html.light-theme tbody tr {
  border-color: #E2E8F0 !important;
}

html.light-theme tr:hover,
html.light-theme tbody tr:hover,
html.light-theme tr.hover\:bg-gray-900\/50:hover {
  background-color: #F1F5F9 !important;
}

html.light-theme .divide-gray-800 > * {
  border-color: #E2E8F0 !important;
}

/* Bulletproof targeted overrides for highlighted components */
html.light-theme section.border-y.border-gray-800 {
  background-color: #F8FAFC !important;
  border-color: #E2E8F0 !important;
}

html.light-theme #adminSection-users .grid > div {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}

/* Accordions */
html.light-theme details {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
}

html.light-theme details summary {
  color: #0F172A !important;
}

html.light-theme details p {
  color: #475569 !important;
}

/* Callout & Prose in Whitepaper */
html.light-theme .callout {
  background: rgba(251, 191, 36, 0.12) !important;
  border-left-color: #D97706 !important;
  color: #1E293B !important;
}

html.light-theme .prose-section h2 {
  color: #0F172A !important;
  border-bottom-color: #E2E8F0 !important;
}

html.light-theme .prose-section h3 {
  color: #B45309 !important;
}

html.light-theme .prose-section p,
html.light-theme .prose-section ul {
  color: #334155 !important;
}

/* Console terminal in Admin stays tech-dark */
html.light-theme #consoleOutput {
  background-color: #0B0F19 !important;
  color: #34D399 !important;
  border-color: #1F2937 !important;
}

/* Code & pre tags */
html.light-theme code {
  background-color: #F1F5F9 !important;
  color: #B45309 !important;
  border: 1px solid #E2E8F0 !important;
}

/* Print Optimization */
@media print {
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
  }
  header, footer, .theme-toggle-btn, button, nav {
    display: none !important;
  }
}

/* Utility: hide scrollbars while allowing smooth scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ================= Topic Grid Cards & Active States ================= */
.topic-tile {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.topic-tile:hover {
  transform: translateY(-2px);
}
.topic-tile:active {
  transform: translateY(0);
}

.topic-tile.active-topic {
  border-color: #F59E0B !important;
  background: rgba(245, 158, 11, 0.12) !important;
  box-shadow: 0 10px 25px -4px rgba(245, 158, 11, 0.25) !important;
  ring: 2px solid rgba(245, 158, 11, 0.3);
}

html.light-theme .topic-tile {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05) !important;
}

html.light-theme .topic-tile:hover {
  border-color: #CBD5E1 !important;
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.08) !important;
}

html.light-theme .topic-tile.active-topic {
  background: #FFFBEB !important;
  border-color: #F59E0B !important;
  box-shadow: 0 10px 25px -4px rgba(245, 158, 11, 0.22) !important;
}

html.light-theme .topic-tile.active-topic .font-display {
  color: #B45309 !important;
}

html.light-theme .topic-tile:not(.active-topic) .font-display {
  color: #1E293B !important;
}

/* ================= Mobile Viewport & Global Anti-Overflow Rules ================= */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Prevent images, media, canvas, or svgs from exceeding screen width */
img, svg, video, canvas {
  max-width: 100%;
}

/* Ensure code blocks and pre wrap or stay within bounds */
pre, code {
  max-width: 100%;
  word-break: break-word;
}





