/* ============================================================================
   ABINI – Planity-Buchungsmodul: Layout der Termin-Seite + Farb-Overrides
   Nur auf termin.html eingebunden (nach css/ci.css).
   Das Widget ersetzt <div id="planity-booking"> durch <div id="planity">,
   deshalb haengt alles am stabilen Wrapper .booking-widget__frame.
   Planity-Klassen koennen sich bei Widget-Updates aendern -> !important noetig,
   Stand 2026-09-09 aus dem gerenderten DOM ermittelt.
   ============================================================================ */

/* --- 1. Seitenlayout --------------------------------------------------- */
.booking-widget {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}
.booking-widget__frame {
  position: relative;
  min-height: 420px;
  background: var(--white);
  border: 1px solid var(--gray-lighter);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}
.booking-widget__frame.is-loaded { min-height: 600px; }
.booking-widget__note {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--gray);
}
.booking-widget__note a { text-decoration: underline; text-underline-offset: 2px; }

/* Ladeindikator waehrend die Planity-Scripte geholt werden */
.booking-widget__frame.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid var(--gray-lighter);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: abini-spin 0.8s linear infinite;
}
@keyframes abini-spin { to { transform: rotate(360deg); } }

/* --- 2. Einwilligungs-Schranke ---------------------------------------- */
.booking-consent {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) 1rem;
}
.booking-consent[hidden],
.booking-error[hidden] { display: none !important; }
.booking-consent__icon {
  color: var(--red);
  width: 68px; height: 68px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--gray-lighter);
  margin-bottom: 1.25rem;
}
.booking-consent__title { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 0.4em; }
.booking-consent__text { font-size: 0.95rem; color: var(--gray-dark); margin-bottom: 1.5rem; }
.booking-consent__text a { text-decoration: underline; text-underline-offset: 2px; }
.booking-consent__btn { min-width: 240px; }
.booking-consent__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.booking-consent__hint { font-size: 0.78rem; color: var(--gray); margin: 1.25rem 0 0; }

/* Fehlerfall */
.booking-error {
  max-width: 560px;
  margin: 2rem auto;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--red);
  background: var(--cream);
  font-size: 0.9rem;
}
.booking-error p { margin: 0; }
.booking-error a { text-decoration: underline; text-underline-offset: 2px; }

/* --- 3. Danke-Box nach Rueckleitung ----------------------------------- */
.booking-thanks {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin: 0 0 1.5rem;
  padding: 1.4rem 1.6rem;
  background: var(--white);
  border: 1px solid var(--gold-light);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.18);
}
.booking-thanks[hidden] { display: none; }
.booking-thanks__icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
}
.booking-thanks__title { font-size: clamp(1.4rem, 2.2vw, 1.8rem); margin-bottom: 0.2em; }
.booking-thanks__text { margin: 0; font-size: 0.95rem; }

@media (max-width: 480px) {
  .booking-widget { padding: 0 12px; }
  .booking-widget__frame { padding: 8px; border-radius: 8px; }
  .booking-thanks { flex-direction: column; gap: 0.75rem; padding: 1.2rem; }
}

/* --- 4. Planity-Widget: Farb-Overrides (Abini-Rot statt Planity-Lila/Schwarz) --- */
/* Hintergrund: passend zur Seite (weiss im Rahmen) statt Planitys #F6F7F8 */
#planitywl,
#planity { background-color: var(--white) !important; }

/* Ueberschriften in Abini-Schwarz */
#planity h1, #planity h2, #planity h3, #planity h4,
#planitywl h1, #planitywl h2, #planitywl h3, #planitywl h4 { color: var(--black) !important; }

/* Primaere Buttons: "Auswaehlen" (button-module_primary-*), "Weitere Dienstleistung
   hinzufuegen" (planity_ui_button_root), Gutschein-Kauf, Submit-Buttons.
   Die CSS-Module-Klassen tragen Hashes (z. B. button-module_primary-Careb) ->
   Praefix-Matching per [class*=...], damit ein Hash-Wechsel nicht alles bricht. */
#planity button[class*="button-module_primary"],
#planity .planity_ui_button_root,
#planity .planity_bookappointment-button-choose,
#planity .planity-gift-voucher-button-choose,
#planity button[class*="button-choose"],
#planity button[type="submit"] {
  background-color: var(--red) !important;
  border-color: var(--red) !important;
  color: var(--white) !important;
}
#planity button[class*="button-module_primary"]:hover,
#planity .planity_ui_button_root:hover,
#planity .planity_bookappointment-button-choose:hover,
#planity .planity-gift-voucher-button-choose:hover,
#planity button[class*="button-choose"]:hover,
#planity button[type="submit"]:hover {
  background-color: var(--red-dark) !important;
  border-color: var(--red-dark) !important;
}

/* Planity-Lila (rgb(98,93,245)) -> Abini-Rot:
   unterstrichene Text-Buttons ("N weitere Dienstleistungen anzeigen", "Loeschen",
   "Fotos vergroessern"), Schrittnummern "1." "2.", Vor/Zurueck-Pfeile, Links */
#planity a,
#planity [class*="button-module_underlined"],
#planity [class*="button-module_underlined"] *,
#planity [class*="title-module_index"],
#planity [class*="step-module_next"],
#planity [class*="step-module_previous"],
#planity [class*="step-module_next"] *,
#planity [class*="step-module_previous"] * {
  color: var(--red) !important;
  text-decoration-color: var(--red) !important;
  border-color: var(--red) !important;
}
#planity a:hover,
#planity [class*="button-module_underlined"]:hover,
#planity [class*="button-module_underlined"]:hover * { color: var(--red-dark) !important; }
#planity [style*="rgb(98, 93, 245)"],
#planity [style*="#625DF5"],
#planity [style*="#625df5"] { color: var(--red) !important; }

/* Textabstand innerhalb des Widgets (Vorlage aus dem Planity-Portal) */
.planity_ui_appointment_background > div:nth-child(2) { padding: 10px; }
