/**
 * Dark mode global — remapeia superfícies claras do app quando html.dark está ativo.
 * Áreas de preview (cartaz/canvas) usam .keep-light para não alterarem a arte.
 */

html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #0b1220 !important;
  color: #e5e7eb !important;
}

/* ---------- Superfícies ---------- */
html.dark .bg-white:not(:where(.keep-light, .keep-light *)),
html.dark .bg-background:not(:where(.keep-light, .keep-light *)) {
  background-color: #1e293b !important;
}

html.dark .bg-gray-50:not(:where(.keep-light, .keep-light *)),
html.dark .bg-gray-100:not(:where(.keep-light, .keep-light *)) {
  background-color: #0f172a !important;
}

html.dark .bg-gray-200:not(:where(.keep-light, .keep-light *)) {
  background-color: #334155 !important;
}

html.dark .bg-slate-50:not(:where(.keep-light, .keep-light *)),
html.dark .bg-slate-100:not(:where(.keep-light, .keep-light *)) {
  background-color: #0f172a !important;
}

/* ---------- Texto ---------- */
html.dark .text-gray-900:not(:where(.keep-light, .keep-light *)),
html.dark .text-gray-800:not(:where(.keep-light, .keep-light *)),
html.dark .text-slate-900:not(:where(.keep-light, .keep-light *)),
html.dark .text-slate-800:not(:where(.keep-light, .keep-light *)) {
  color: #f8fafc !important;
}

html.dark .text-gray-700:not(:where(.keep-light, .keep-light *)),
html.dark .text-slate-700:not(:where(.keep-light, .keep-light *)) {
  color: #e2e8f0 !important;
}

html.dark .text-gray-600:not(:where(.keep-light, .keep-light *)),
html.dark .text-slate-600:not(:where(.keep-light, .keep-light *)) {
  color: #cbd5e1 !important;
}

html.dark .text-gray-500:not(:where(.keep-light, .keep-light *)),
html.dark .text-slate-500:not(:where(.keep-light, .keep-light *)) {
  color: #94a3b8 !important;
}

html.dark .text-muted-foreground:not(:where(.keep-light, .keep-light *)) {
  color: #94a3b8 !important;
}

/* ---------- Bordas ---------- */
html.dark .border-gray-100:not(:where(.keep-light, .keep-light *)),
html.dark .border-gray-200:not(:where(.keep-light, .keep-light *)),
html.dark .border-gray-300:not(:where(.keep-light, .keep-light *)),
html.dark .border-slate-200:not(:where(.keep-light, .keep-light *)),
html.dark .border-slate-300:not(:where(.keep-light, .keep-light *)) {
  border-color: #334155 !important;
}

html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: #334155 !important;
}

/* ---------- Inputs / formulários ---------- */
html.dark input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(:where(.keep-light, .keep-light *)),
html.dark textarea:not(:where(.keep-light, .keep-light *)),
html.dark select:not(:where(.keep-light, .keep-light *)) {
  background-color: #0f172a !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

html.dark input:disabled,
html.dark textarea:disabled,
html.dark select:disabled {
  background-color: #1e293b !important;
  color: #64748b !important;
}

/* ---------- Hovers claros ---------- */
html.dark .hover\:bg-gray-50:hover:not(:where(.keep-light, .keep-light *)),
html.dark .hover\:bg-white:hover:not(:where(.keep-light, .keep-light *)) {
  background-color: #334155 !important;
}

html.dark .hover\:bg-gray-100:hover:not(:where(.keep-light, .keep-light *)) {
  background-color: #334155 !important;
}

html.dark .hover\:bg-gray-200:hover:not(:where(.keep-light, .keep-light *)) {
  background-color: #475569 !important;
}

html.dark .hover\:text-gray-800:hover:not(:where(.keep-light, .keep-light *)),
html.dark .hover\:text-gray-900:hover:not(:where(.keep-light, .keep-light *)) {
  color: #f8fafc !important;
}

/* ---------- Cards / superfícies suaves ---------- */
html.dark .bg-indigo-50:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(67, 56, 202, 0.25) !important;
}

html.dark .bg-indigo-100:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(67, 56, 202, 0.35) !important;
}

html.dark .text-indigo-700:not(:where(.keep-light, .keep-light *)),
html.dark .text-indigo-800:not(:where(.keep-light, .keep-light *)) {
  color: #a5b4fc !important;
}

html.dark .hover\:bg-indigo-200:hover:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(99, 102, 241, 0.45) !important;
}

html.dark .bg-green-50:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(22, 163, 74, 0.15) !important;
}

html.dark .bg-red-50:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(220, 38, 38, 0.15) !important;
}

html.dark .bg-yellow-50:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(202, 138, 4, 0.15) !important;
}

html.dark .bg-blue-50:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(37, 99, 235, 0.15) !important;
}

/* ---------- Sombras / rings ---------- */
html.dark .shadow-md:not(:where(.keep-light, .keep-light *)),
html.dark .shadow-lg:not(:where(.keep-light, .keep-light *)),
html.dark .shadow-sm:not(:where(.keep-light, .keep-light *)),
html.dark .shadow:not(:where(.keep-light, .keep-light *)) {
  --tw-shadow-color: rgb(0 0 0 / 0.45);
}

html.dark .ring-offset-background {
  --tw-ring-offset-color: #0f172a;
}

/* ---------- Dialog / overlay já escuro ok; conteúdo usa bg-background ---------- */
html.dark [role="dialog"]:not(:where(.keep-light, .keep-light *)) {
  border-color: #334155 !important;
}

/* ---------- Scrollbar (WebKit) ---------- */
html.dark ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
html.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 999px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

html.dark .bg-yellow-100:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(202, 138, 4, 0.2) !important;
}

html.dark .text-yellow-800:not(:where(.keep-light, .keep-light *)) {
  color: #fde68a !important;
}

html.dark .border-yellow-400:not(:where(.keep-light, .keep-light *)) {
  border-color: rgba(250, 204, 21, 0.45) !important;
}

/* Avisos âmbar (ajuste por formato, produtos em destaque) */
html.dark .bg-amber-50:not(:where(.keep-light, .keep-light *)),
html.dark .bg-amber-50\/60:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(217, 119, 6, 0.16) !important;
}

html.dark .bg-amber-100:not(:where(.keep-light, .keep-light *)) {
  background-color: rgba(217, 119, 6, 0.3) !important;
}

html.dark .text-amber-700:not(:where(.keep-light, .keep-light *)),
html.dark .text-amber-800:not(:where(.keep-light, .keep-light *)),
html.dark .text-amber-900:not(:where(.keep-light, .keep-light *)),
html.dark .hover\:text-amber-900:hover:not(:where(.keep-light, .keep-light *)) {
  color: #fcd34d !important;
}

html.dark .border-amber-200:not(:where(.keep-light, .keep-light *)),
html.dark .border-amber-300:not(:where(.keep-light, .keep-light *)) {
  border-color: rgba(245, 158, 11, 0.45) !important;
}

/* Preview de cartaz/arte e thumbs de produto: fundo branco real no dark mode */
html.dark .keep-light {
  color-scheme: light;
}

html.dark .product-image-thumb {
  background-color: #ffffff !important;
}
