/*
 * Dark Mode
 * ---------------------------------------------------------------
 * Aktiv, wenn <html data-theme="dark"> gesetzt ist (Umschalter im Header,
 * Auswahl wird im Browser gemerkt; Standard im Dashboard einstellbar).
 *
 * Prinzip: Die Farbvariablen des Themes werden getauscht (hell <-> dunkel).
 * Bereiche, die schon im hellen Design dunkel sind (Footer, Projekte …),
 * bekommen die Originalwerte zurück und bleiben so, wie sie gestaltet sind.
 * Feste Farbwerte aus dem Theme werden darunter gezielt überschrieben.
 */

html[data-theme="dark"] {
  color-scheme: dark;
  --dm-bg: #0f0f11;
  --dm-surface: #17171a;
  --dm-surface-2: #1f1f23;
  --dm-text: #ececec;
  --dm-muted: #a1a1aa;
  --dm-border: rgba(255, 255, 255, 0.1);

  --tp-common-white: #0f0f11;
  --tp-common-white-2: #17171a;
  --tp-common-black: #f1f1f1;
  --tp-common-black-1: #e8e8e8;
  --tp-common-black-2: #f1f1f1;
  --tp-common-black-3: #ffffff;
  --tp-common-black-4: #b7c4c2;
  --tp-common-black-5: #ededed;
  --tp-common-black-6: #c9c9c9;
  --tp-common-sugar: #17171a;
  --tp-grey-1: #a8a8a8;
  --tp-grey-3: #17171a;
  --tp-grey-5: #1c1c20;
  --tp-grey-7: #b3b3b3;
  --tp-grey-8: #ededed;
  --tp-theme-primary: #ededed;
  --tp-theme-secondary: #ededed;
  --tp-border-1: rgba(255, 255, 255, 0.1);
}

/* Bereiche, die schon dunkel gestaltet sind: Originalfarben behalten */
html[data-theme="dark"] :is(
  .tp-hero-area,
  .des-portfolio-item,
  .tp-pd-3-navigation-thumb-wrap,
  .tp-header-pb-helpline-icon,
  .tp-header-pb-logobg,
  .tp-footer-area,
  .tp-bg-common-black,
  .tp-bg-common-black-5,
  .dark-section,
  .tp-case-results,
  .tp-lightbox
) {
  --tp-common-white: #fff;
  --tp-common-white-2: #f0f0f0;
  --tp-common-black: #030303;
  --tp-common-black-1: #10302a;
  --tp-common-black-2: #0d0d0d;
  --tp-common-black-3: #000;
  --tp-common-black-4: #405955;
  --tp-common-black-5: #111112;
  --tp-common-black-6: #333333;
  --tp-grey-1: #525252;
  --tp-grey-3: #f8f8f8;
  --tp-grey-5: #f3f1f2;
  --tp-grey-7: #5c5c5c;
  --tp-grey-8: #101010;
  --tp-theme-primary: #171717;
  --tp-theme-secondary: #171717;
  --tp-border-1: #eee;
}
/* … aber vom fast gleich dunklen Seitenhintergrund leicht abheben */
html[data-theme="dark"] :is(.tp-bg-common-black-5, .tp-case-results) {
  background-color: #151518 !important;
}

/* ---------- Grundflächen ---------- */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: var(--dm-bg);
  color: var(--dm-text);
}
html[data-theme="dark"] ::selection {
  background: #ededed;
  color: #111;
}

/* ---------- Header, Menü, Seitenmenü, Suche ---------- */
html[data-theme="dark"] .header-sticky,
html[data-theme="dark"] .sticky-white-bg.header-sticky {
  background: rgba(15, 15, 17, 0.85) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .dropdown-white-bg nav ul li .tp-submenu {
  background: rgba(23, 23, 26, 0.96);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .dropdown-white-bg nav ul li .tp-submenu li a {
  color: var(--dm-muted);
}
html[data-theme="dark"] .dropdown-white-bg nav ul li .tp-submenu li:hover > a {
  background-color: var(--dm-surface-2);
  color: var(--dm-text);
}
html[data-theme="dark"] .tp-offcanvas {
  background-color: var(--dm-surface);
}
html[data-theme="dark"] :is(.tp-offcanvas-content p, .tp-offcanvas-contact ul li a, .tp-error-content p) {
  color: var(--dm-muted);
}
html[data-theme="dark"] .tp-offcanvas-contact ul li a::after {
  background-color: var(--dm-text);
}
html[data-theme="dark"] .tp-offcanvas-social ul li a {
  border-color: var(--dm-border);
}
/* Dunkles Logo im Seitenmenü auf dunklem Grund: aufhellen
   (das Header-Logo ist schon hell und sitzt auf der schwarzen Logo-Fläche) */
html[data-theme="dark"] .tp-offcanvas-logo img {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------- Kundenlogos: dunkle Logos aufhellen, Farbton bleibt ---------- */
html[data-theme="dark"] .tp-brand-item img {
  filter: invert(1) hue-rotate(180deg);
  opacity: 0.9;
}

/* ---------- Große Überschriften, die sich beim Scrollen füllen ---------- */
html[data-theme="dark"] :is(.tp_text_invert.invert-black, .tp_text_invert.invert-black-2, .tp_text_invert.invert-black-3,
  .tp_text_invert.invert-black-5, .tp_text_invert.invert-black-6) > div {
  background-image: linear-gradient(to right, #ececec 50%, #3a3a3e 50%);
}

/* ---------- Weiße Deko-Formen (im Hellen unsichtbar): dezent halten ---------- */
html[data-theme="dark"] :is(.tp-service-details-icon img, .tp-service-hero-shape-2 svg) {
  opacity: 0.25;
}

/* ---------- Feste dunkle Rahmen des Themes ---------- */
html[data-theme="dark"] :is(.tp-btn-vp-group .tp-btn-circle, .tp-breadcrumb-wrap, .tp-section-pp-white-subtitle, .tp-blog-meta,
  .tp-blog-vp-cetagory a, .tp-service-vp-btn, .tp-service-vp-item, .tp-portfolio-inner-tab-wrap nav .nav-tabs .nav-link,
  .tp-faq-wrap .accordion-item, .tp-package-price, .tp-options-header, .tp-option-select, .tp-options-discount,
  .tp-options-summary, .tp-form-container, .tp-form-group textarea, .tp-checkbox-custom, .tp-form-summary-total) {
  border-color: var(--dm-border);
}
html[data-theme="dark"] .header-search-btn {
  border-color: rgba(255, 255, 255, 0.2);
}
html[data-theme="dark"] .search-suggest {
  background: var(--dm-surface-2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .search-suggest a {
  color: var(--dm-text);
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* ---------- Feste Theme-Farben, die sonst dunkel auf dunkel stehen ---------- */
html[data-theme="dark"] :is(.tp-service-vp-para, .tp-service-details-content-2 ul li p) {
  color: var(--dm-muted);
}
html[data-theme="dark"] .tp-text-slider-item .icons svg path {
  fill: var(--dm-text);
}

/* Kontaktseite: runde Symbole für E-Mail/Telefon (weißes Icon) */
html[data-theme="dark"] .tp-contact-icon {
  background: var(--dm-surface-2);
  border: 1px solid var(--dm-border);
}
html[data-theme="dark"] .tp-contact-icon svg path {
  fill: var(--dm-text);
}

/* FAQ (Bootstrap-Akkordeon) */
html[data-theme="dark"] .accordion {
  --bs-accordion-bg: transparent;
  --bs-accordion-color: var(--dm-text);
  --bs-accordion-btn-bg: var(--dm-surface);
  --bs-accordion-btn-color: var(--dm-text);
  --bs-accordion-active-bg: var(--dm-surface);
  --bs-accordion-active-color: var(--dm-text);
  --bs-accordion-border-color: var(--dm-border);
}

/* ---------- Formulare ---------- */
/* Auswahlfelder des Themes (nice-select) */
html[data-theme="dark"] .nice-select {
  color: var(--dm-text);
}
html[data-theme="dark"] .nice-select .list {
  background: var(--dm-surface-2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .nice-select .option {
  color: var(--dm-muted);
}
html[data-theme="dark"] .nice-select .option:hover,
html[data-theme="dark"] .nice-select .option.focus,
html[data-theme="dark"] .nice-select .option.selected.focus {
  background: #2a2a2f;
  color: var(--dm-text);
}
html[data-theme="dark"] :is(input, textarea, select):not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background-color: var(--dm-surface);
  color: var(--dm-text);
  border-color: var(--dm-border);
}
html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #77777f;
}

/* ---------- Eigene Bausteine ---------- */
html[data-theme="dark"] .tp-availability {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}
html[data-theme="dark"] a.tp-availability:hover {
  background: #2a2a2f;
  color: #fff;
}
html[data-theme="dark"] .tp-availability-hero {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.25);
}
html[data-theme="dark"] .tp-live-clock:not(.tp-live-clock-dark) {
  --clock-text: var(--dm-text);
  --clock-muted: var(--dm-muted);
}
html[data-theme="dark"] .tp-case-step {
  border-top-color: var(--dm-border);
}
html[data-theme="dark"] .tp-case-step-text {
  color: var(--dm-muted);
}
html[data-theme="dark"] .tp-zoom-gallery-item,
html[data-theme="dark"] .tp-compare {
  background: var(--dm-surface);
}

/* ---------- Preis-Assistent (preise.php) ---------- */
html[data-theme="dark"] .tp-pricing-step-section {
  background: var(--dm-bg);
}
html[data-theme="dark"] :is(.tp-package-card, .tp-option-card, .tp-options-discount, .tp-options-summary, .tp-form-container, .tp-success-modal) {
  background: var(--dm-surface);
  border-color: var(--dm-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .tp-package-card.tp-package-featured {
  background: linear-gradient(145deg, #1b1c17 0%, #20240f 100%);
  border-color: #c4ee18;
}
html[data-theme="dark"] .tp-package-card.tp-package-selected {
  border-color: #c4ee18;
}
html[data-theme="dark"] :is(.tp-form-summary-card, .tp-option-select, .tp-form-group textarea, .tp-form-group input) {
  background: var(--dm-surface-2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}
/* Überschriften und Werte (im Hellen #111112) */
html[data-theme="dark"] :is(.tp-pricing-step-title, .tp-package-name, .tp-package-amount, .tp-package-select,
  .tp-options-header-left h3, .tp-option-info label, .tp-summary-item .tp-summary-value, .tp-form-header h3,
  .tp-form-summary-card h4, .tp-form-summary-card .tp-form-value, .tp-form-guarantee strong, .tp-form-back-btn:hover,
  .tp-success-modal h3) {
  color: var(--dm-text);
}
/* Fließtext und Beschriftungen (im Hellen grau) */
html[data-theme="dark"] :is(.tp-pricing-step-desc, .tp-step-item .tp-step-label, .tp-step-item .tp-step-number, .tp-package-subtitle,
  .tp-package-period, .tp-package-features li, .tp-options-header-left p, .tp-options-count, .tp-option-desc,
  .tp-discount-header, .tp-summary-item .tp-summary-label, .tp-form-header p, .tp-form-group label, .tp-checkbox-wrap,
  .tp-form-summary-card .tp-form-label, .tp-form-guarantee p, .tp-form-back-btn, .tp-success-modal p) {
  color: var(--dm-muted);
}
/* Dunkelgrüne Akzente (#10302a) werden zum hellen Limettengrün */
html[data-theme="dark"] :is(.tp-pricing-step-badge, .tp-pricing-step-title em, .tp-pricing-step-title .highlight-number,
  .tp-step-item.active .tp-step-label, .tp-step-item.done .tp-step-label, .tp-package-icon, .tp-package-currency,
  .tp-package-features li .fa-check, .tp-selected-package-badge, .tp-option-icon, .tp-option-price,
  .tp-summary-item.total .tp-summary-value, .tp-checkbox-label a, .tp-form-summary-card .tp-form-total,
  .tp-success-icon, .tp-success-modal .tp-success-package, .tp-success-modal .tp-success-price) {
  color: #d4f27a;
}
html[data-theme="dark"] :is(.tp-step-item .tp-step-number, .tp-discount-bar) {
  background: var(--dm-surface-2);
}
html[data-theme="dark"] .tp-step-item .tp-step-line,
html[data-theme="dark"] .tp-toggle-slider {
  background: #34343a;
}
html[data-theme="dark"] :is(.tp-step-item.active, .tp-step-item.done) .tp-step-number {
  background: #c4ee18;
  color: #10302a;
}
html[data-theme="dark"] .tp-package-select.tp-package-select-primary {
  color: #10302a;
}
html[data-theme="dark"] .tp-package-select:hover {
  background: var(--dm-text);
  border-color: var(--dm-text);
  color: #111;
}
/* Buttons, die im Hellen dunkelgrün sind: hell machen */
html[data-theme="dark"] :is(.tp-package-select-primary:hover, .tp-options-next:hover, .tp-form-submit, .tp-success-btn) {
  background: #c4ee18;
  border-color: #c4ee18;
  color: #10302a;
}
html[data-theme="dark"] :is(.tp-form-submit, .tp-success-btn):hover {
  background: #d8ff3a;
}
html[data-theme="dark"] .tp-package-features li .fa-times {
  color: #55555c;
}

/* ---------- Terminbuchung (termin.php) ---------- */
html[data-theme="dark"] .booking-facts li {
  border-top-color: var(--dm-border);
}
html[data-theme="dark"] :is(.booking-day, .booking-time) {
  border-color: #2e2e33;
  color: var(--dm-text);
}
html[data-theme="dark"] :is(.booking-day, .booking-time):hover {
  border-color: #c4ee18;
}
html[data-theme="dark"] .booking-time:hover {
  color: #10180f;
}
html[data-theme="dark"] .booking-day.active {
  background: #c4ee18;
  border-color: #c4ee18;
  color: #10180f;
}
html[data-theme="dark"] .booking-day.active .n {
  background: #10180f;
  color: #c4ee18;
}
html[data-theme="dark"] .booking-day.is-today .wd {
  color: #c4ee18;
}
html[data-theme="dark"] .booking-day.is-today.active .wd {
  color: #10180f;
}
html[data-theme="dark"] .booking-day .n,
html[data-theme="dark"] .booking-selected {
  background: rgba(180, 231, 23, 0.14);
  color: #d4f27a;
}
html[data-theme="dark"] .booking-selected a {
  color: #d4f27a;
}
html[data-theme="dark"] .booking-day.is-disabled {
  background: transparent;
  border-color: #26262b;
  color: #5a5a62;
}
html[data-theme="dark"] .booking-day.is-disabled .n {
  background: #1f1f23;
  color: #6b6b73;
}
html[data-theme="dark"] .booking-field label {
  color: var(--dm-text);
}
html[data-theme="dark"] .booking-form .booking-control :is(input, select, textarea) {
  background: var(--dm-surface-2);
  border-color: #2e2e33;
  color: var(--dm-text);
}
html[data-theme="dark"] .booking-form .booking-control :is(input, select, textarea):focus {
  background: var(--dm-surface-2);
  border-color: #c4ee18;
}
html[data-theme="dark"] .booking-select::after {
  border-color: var(--dm-muted);
}
html[data-theme="dark"] :is(.booking-consent, .booking-link, .booking-sub) {
  color: var(--dm-muted);
}
html[data-theme="dark"] .booking-check-box {
  background: transparent;
  border-color: #4a4a52;
}
html[data-theme="dark"] :is(.booking-consent-text a, .booking-when) {
  color: #d4f27a;
}
/* Haupt-Button ist im Hellen schwarz: im Dunklen limettengrün */
html[data-theme="dark"] .booking-btn:not(.booking-btn-danger) {
  background: #c4ee18;
  color: #10180f;
}
html[data-theme="dark"] .booking-step span {
  background: #c4ee18;
  color: #10180f;
}

/* ---------- Zusatzseiten (Angebot, Termin, Shop, Kundenbereich, Suche) ---------- */
html[data-theme="dark"] :is(.quote-area, .portal-area, .search-area) {
  background: var(--dm-bg);
}
html[data-theme="dark"] :is(.quote-card, .portal-card, .portal-login-card, .portal-project-card, .booking-card, .search-page-form,
  .search-empty, .search-result a, .search-filter button, .search-suggest-all, .portfolio-cta-tile, .shop-order-box) {
  background: var(--dm-surface);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  border-color: var(--dm-border);
}
/* Dunkler Text (#121212) dieser Seiten */
html[data-theme="dark"] :is(.portfolio-cta-tile, .portfolio-cta-tile:hover, .portal-file, .portal-files li > a:first-child,
  .portal-project-card, .portal-project-card:hover, .search-filter button, .search-page-form input, .search-suggest a:hover,
  .search-suggest a.is-active) {
  color: var(--dm-text);
}
/* Grauer Text */
html[data-theme="dark"] :is(.quote-muted, .quote-tax, .quote-consent, .portal-muted, .portal-hint, .portal-item-meta, .portal-steps,
  .portal-empty, .portal-badge, .search-hint, .search-meta, .search-filter button span, .search-suggest .k, .search-suggest-empty,
  .portfolio-cta-text) {
  color: var(--dm-muted);
}
/* Dunkelgrüne Links und Akzente (#10302a, #2f4300, #5d8a19) → helles Limettengrün */
html[data-theme="dark"] :is(.booking-hint, .booking-hint a, .portfolio-cta-link, .search-suggest-all, .portal-alert-success, .portal-attach,
  .portal-badge-ok, .portal-btn-outline, .portal-contact a, .portal-dl, .portal-file:hover, .portal-item-status, .portal-link-btn,
  .portal-percent, .portal-steps li.is-current, .portal-steps li.is-done, .quote-btn-outline, .quote-consent a, .quote-discount,
  .quote-link, .search-head h1 em, .search-quicklinks a) {
  color: #d4f27a;
}
html[data-theme="dark"] .search-result a,
html[data-theme="dark"] .search-result a:hover {
  color: var(--dm-text);
}
html[data-theme="dark"] .search-result p {
  color: var(--dm-muted);
}
html[data-theme="dark"] .search-result mark {
  background: rgba(196, 238, 24, 0.25);
  color: #f1ffc4;
}
html[data-theme="dark"] .booking-hint,
html[data-theme="dark"] .portal-alert-success {
  background: rgba(180, 231, 23, 0.1);
  border-color: rgba(180, 231, 23, 0.25);
}
html[data-theme="dark"] :is(.portal-alert-error, .quote-alert, .quote-expired) {
  color: #ff8a80;
}
html[data-theme="dark"] .portal-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}
html[data-theme="dark"] :is(.quote-check-box, .portal-decide textarea, .portal-compose textarea, .quote-accept textarea) {
  background: var(--dm-surface-2);
  border-color: #2e2e33;
}
html[data-theme="dark"] :is(.quote-eyebrow, .portal-eyebrow, .search-eyebrow, .booking-eyebrow) {
  background: rgba(180, 231, 23, 0.14);
  color: #d4f27a;
}

/* ---------- Umschalter im Header ---------- */
.tp-theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(17, 17, 17, 0.15);
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.tp-theme-toggle:hover {
  background: rgba(17, 17, 17, 0.06);
}
.tp-theme-toggle svg {
  position: absolute;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}
.tp-theme-toggle .is-sun {
  transform: translateY(30px) rotate(-90deg);
  opacity: 0;
}
html[data-theme="dark"] .tp-theme-toggle {
  border-color: rgba(255, 255, 255, 0.2);
}
html[data-theme="dark"] .tp-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .tp-theme-toggle .is-moon {
  transform: translateY(-30px) rotate(90deg);
  opacity: 0;
}
html[data-theme="dark"] .tp-theme-toggle .is-sun {
  transform: none;
  opacity: 1;
}
/* Weicher Übergang nur im Moment des Umschaltens (Klasse setzt main.js kurz) */
html.tp-theme-switching,
html.tp-theme-switching *,
html.tp-theme-switching *::before,
html.tp-theme-switching *::after {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease !important;
}
