/* Dark-mode fixes for the daisyUI theme "brand" (DocuSeal-Docker patch set).
   Only loaded when BRAND_THEME=brand. The theme colours themselves come from
   tailwind.config.js and can be overridden in /brand/brand.css; the extra colours
   used here are CSS variables with defaults below, also overridable there.
   Keep every selector on ONE line: a line break between :not() parts is a
   descendant combinator. PDF pages and the signature canvas stay white on purpose. */

:root {
  --brand-input: #23244A;
  --brand-placeholder: #8486A8;
  --brand-muted: #B9BAD3;
  --brand-muted-2: #9596B8;
  --brand-on-paper: #2B2F36;
}

/* PDF pages = paper: light palette inside (field values, labels, menus on the page) */
page-container, [style*="container-type: size"] {
  color-scheme: light;
  --b1: 240 20% 97%; --b2: 240 18% 92%; --b3: 240 15% 87%; --bc: 238 20% 17%;
  --n: 238 35% 17%; --nf: 238 35% 12%; --nc: 0 0% 100%;
  --p: 240 18% 90%; --pf: 240 18% 83%; --pc: 238 20% 17%;
  --s: 238 30% 78%; --sf: 238 30% 70%; --sc: 238 35% 17%;
  --a: 359 77% 46%; --af: 359 78% 37%; --ac: 0 0% 100%;
  color: hsl(var(--bc));
}

/* Fest verdrahtete helle Formularelemente -> dunkle Inputs */
.base-input, .base-select, .base-textarea, .autocomplete, .white-button, .base-checkbox, .base-radio {
  background-color: var(--brand-input) !important;
  color: hsl(var(--bc)) !important;
}
.base-input::placeholder, .base-textarea::placeholder { color: var(--brand-placeholder); }
.autocomplete .group { background-color: hsl(var(--b3)) !important; }

/* bg-white ausserhalb der Seiten -> dunkel. Weiss bleiben: Canvas, Bilder, Unterschriftsflaechen,
   QR-Box, Schwaerzungs-Rechtecke, dynamische Abschnitte, .brand-paper (Unterschrift-Vorschau) */
.bg-white:not(canvas):not(img):not(.draw-canvas):not(.brand-paper):not(:has(> canvas)):not([style*="left:"]):not(.select-none.mb-4):not(.absolute.m-0\.5):not(page-container *):not([style*="container-type: size"] *) {
  background-color: hsl(var(--b2)) !important;
}
.btn-outline.bg-white:not(page-container *):hover { background-color: hsl(var(--bc)) !important; }

/* Helle Grau-Flaechen, Rahmen */
.bg-gray-50, .bg-gray-100, .bg-neutral-100 { background-color: hsl(var(--b2)) !important; }
.bg-gray-200, .bg-neutral-200 { background-color: hsl(var(--b3)) !important; }
.hover\:bg-neutral-100:hover, .hover\:bg-neutral-200:hover, .hover\:bg-white:hover { background-color: hsl(var(--b3)) !important; }
.border-gray-300, .border-neutral-200, .border-neutral-300, .border-neutral-400, .border-gray-400 { border-color: hsl(var(--b3)) !important; }

/* Dunkle Grau-Texte lesbar machen */
.text-gray-900, .text-gray-700 { color: hsl(var(--bc)) !important; }
.text-gray-600 { color: var(--brand-muted) !important; }
.text-gray-500, .text-neutral-500, .md\:text-neutral-500 { color: var(--brand-muted-2) !important; }
.text-neutral-700:not(page-container *) { color: var(--brand-muted-2) !important; }

/* Pastell-Hinweisflaechen/Chips -> transparente Toenung */
:is(.bg-yellow-100,.bg-yellow-200,.bg-amber-100):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(234 179 8 / .18) !important; }
:is(.bg-red-50,.bg-red-100,.bg-red-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(239 68 68 / .18) !important; }
:is(.bg-blue-50,.bg-sky-100,.bg-sky-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(14 165 233 / .18) !important; }
:is(.bg-lime-50,.bg-lime-100,.bg-lime-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(132 204 22 / .18) !important; }
:is(.bg-emerald-100,.bg-emerald-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(16 185 129 / .18) !important; }
:is(.bg-cyan-100,.bg-cyan-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(6 182 212 / .18) !important; }
:is(.bg-indigo-100,.bg-indigo-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(99 102 241 / .22) !important; }
:is(.bg-purple-100,.bg-purple-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(147 51 234 / .22) !important; }
:is(.bg-pink-100,.bg-pink-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(236 72 153 / .2) !important; }
:is(.bg-orange-100,.bg-orange-200):not(page-container *):not([style*="container-type: size"] *) { background-color: rgb(249 115 22 / .2) !important; }
.border-yellow-200:not(page-container *) { border-color: rgb(234 179 8 / .4) !important; }
.border-red-100:not(page-container *) { border-color: rgb(239 68 68 / .4) !important; }

/* Ghost-Buttons und Dropdown-Menues in der Palette statt Grau/unsichtbar */
.btn-ghost:not(page-container *):hover { background-color: hsl(var(--b3)); }
.dropdown-content.menu:not(page-container *):not([style*="container-type: size"] *) { background-color: hsl(var(--b2)); border: 1px solid hsl(var(--b3)); }

/* Signier-Formular: aktueller Schritt sichtbar, "Loeschen" auf der weissen Unterschriftsflaeche dunkel */
.steps-progress-current { background-color: hsl(var(--n)) !important; border-color: hsl(var(--n)) !important; }
.relative.select-none > .absolute.top-0\.5.right-0\.5 .btn-ghost { color: var(--brand-on-paper); }

/* Avatar-Initialen (bg-base-content ist hell) */
label.bg-base-content.text-purple-300 { color: hsl(var(--b2)); }

/* Onboarding-Tour (driver.js) */
.driver-popover { background-color: hsl(var(--b2)) !important; color: hsl(var(--bc)) !important; }
.driver-popover-footer button { background-color: hsl(var(--b3)) !important; color: hsl(var(--bc)) !important; text-shadow: none !important; }
.driver-popover-progress-text, .driver-popover-close-btn { color: var(--brand-muted-2) !important; }
html .driver-popover-arrow-side-left { border-left-color: hsl(var(--b2)); }
html .driver-popover-arrow-side-right { border-right-color: hsl(var(--b2)); }
html .driver-popover-arrow-side-top { border-top-color: hsl(var(--b2)); }
html .driver-popover-arrow-side-bottom { border-bottom-color: hsl(var(--b2)); }

/* Unterschrifts-/Kuerzel-Canvas und PDF-Seiten bleiben bewusst weiss */
