/* CH Event Manager – Frontend Styles
   Formular, Grid, Preisbox und Button sind über CSS-Variablen und Klassen vorbereitet. */

:root {
  --chem-primary: #1f2937;
  --chem-primary-hover: #111827;
  --chem-text: #1f2937;
  --chem-muted: #6b7280;
  --chem-bg: #ffffff;
  --chem-surface: #f9fafb;
  --chem-border: #d1d5db;
  --chem-border-soft: #e5e7eb;
  --chem-success-bg: #e7f7ec;
  --chem-success-border: #bfe7ca;
  --chem-error-bg: #fdecec;
  --chem-error-border: #f3b3b3;
  --chem-radius: 8px;
  --chem-radius-large: 12px;
  --chem-gap: 16px;
  --chem-section-padding-y: 32px;
  --chem-input-padding-y: 12px;
  --chem-input-padding-x: 14px;
  --chem-button-padding-y: 18px;
  --chem-button-padding-x: 20px;
  --chem-font-size-button: 18px;
}


/* Divi 5 / Theme-Builder-Kompatibilität
 * - Alle Regeln sind über das chem-Präfix gekapselt.
 * - Das Formular nutzt die komplette Breite seines Divi-Moduls/Containers.
 * - Der Buchungsanker berücksichtigt Sticky Header beim Scrollen. */
#Buchungsform,
.chem-booking-form {
  scroll-margin-top: 120px;
}

.et-db #et-boc .et-l .chem-booking-form,
.et-db #et-boc .et-l .chem-event-dates,
.et_pb_module .chem-booking-form,
.et_pb_module .chem-event-dates {
  width: 100%;
  max-width: none;
}

.et-db #et-boc .et-l .chem-booking-form *,
.et_pb_module .chem-booking-form * {
  box-sizing: border-box;
}

.et-db #et-boc .et-l .chem-booking-form button.chem-submit-button,
.et_pb_module .chem-booking-form button.chem-submit-button {
  width: 100%;
  line-height: 1.25;
}

/*
 * Layout-Grundlagen
 * Das Formular nutzt die volle Breite des umgebenden WordPress-Content-Bereichs.
 * Statt einer Box-Umrandung werden nur eine obere und eine untere Linie gesetzt.
 */

.chem-booking-form,
.chem-form {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 2rem 0;
  padding: var(--chem-section-padding-y) 0;
  border-top: 1px solid var(--chem-border-soft);
  border-right: 0;
  border-bottom: 1px solid var(--chem-border-soft);
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: var(--chem-text);
}

.chem-booking-form h3 {
  margin-top: 0;
}

.chem-booking-form label,
.chem-field {
  display: block;
  margin: 0 0 18px;
  font-weight: 600;
}

.chem-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--chem-text);
}

.chem-booking-form input,
.chem-booking-form select,
.chem-booking-form textarea,
.chem-input,
.chem-select,
.chem-textarea {
  box-sizing: border-box;
  width: 100%;
  margin-top: 6px;
  padding: var(--chem-input-padding-y) var(--chem-input-padding-x);
  border: 1px solid var(--chem-border);
  border-radius: var(--chem-radius);
  background: #fff;
  color: var(--chem-text);
  font: inherit;
}

.chem-booking-form select:disabled,
.chem-booking-form input:disabled,
.chem-booking-form textarea:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* 12-Spalten-Raster */
.chem-form-grid,
.chem-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--chem-gap);
  row-gap: 0;
  align-items: start;
}

.chem-col-12 { grid-column: span 12; }
.chem-col-11 { grid-column: span 11; }
.chem-col-10 { grid-column: span 10; }
.chem-col-9 { grid-column: span 9; }
.chem-col-8 { grid-column: span 8; }
.chem-col-7 { grid-column: span 7; }
.chem-col-6 { grid-column: span 6; }
.chem-col-5 { grid-column: span 5; }
.chem-col-4 { grid-column: span 4; }
.chem-col-3 { grid-column: span 3; }
.chem-col-2 { grid-column: span 2; }
.chem-col-1 { grid-column: span 1; }

/* Feld-spezifische Standardbreiten */
.chem-field-full,
.chem-field-company,
.chem-field-discount { grid-column: span 12; }

.chem-field-half,
.chem-field-first-name,
.chem-field-last-name,
.chem-field-email,
.chem-field-phone { grid-column: span 6; }

.chem-field-street,
.chem-field-street-name { grid-column: span 5; }
.chem-field-zip { grid-column: span 2; }
.chem-field-city { grid-column: span 5; }

/* Rückwärtskompatibel für ältere Templates */
.chem-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--chem-gap);
}

.chem-checkbox {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 400;
}

.chem-checkbox input {
  width: auto;
  margin-top: .25em;
  margin-right: 0;
}

/* Preisbox */
.chem-price-box {
  margin: 24px 0;
  padding: 24px;
  border: 0;
  border-radius: var(--chem-radius-large);
  background: var(--chem-surface);
}

.chem-price-box h4 {
  margin: 0 0 10px;
}

.chem-price-rows {}

.chem-price-row,
.chem-price-total {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0;
}

.chem-price-row strong,
.chem-price-total strong {
  white-space: nowrap;
}

.chem-price-total {
  margin-top: 8px;
  border-top: 1px solid var(--chem-border-soft);
  font-size: 1.1em;
}

.chem-price-muted,
.chem-price-note {
  color: var(--chem-muted);
}

.chem-price-note {
  margin: 8px 0 0;
  font-size: .9em;
}

/* Button */
.chem-submit-button,
.chem-booking-form button[type="submit"],
.chem-btn,
.chem-btn-primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: var(--chem-button-padding-y) var(--chem-button-padding-x);
  border: 0;
  border-radius: var(--chem-radius);
  background: var(--chem-primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: var(--chem-font-size-button);
  font-weight: 700;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
}


.chem-submit-button:hover,
.chem-booking-form button[type="submit"]:hover,
.chem-btn-primary:hover {
  background: var(--chem-primary-hover);
}

.chem-submit-label {}

/* Systemmeldungen */
.chem-message {
  max-width: 860px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--chem-radius);
}

.chem-success {
  background: var(--chem-success-bg);
  border: 1px solid var(--chem-success-border);
}

.chem-error {
  background: var(--chem-error-bg);
  border: 1px solid var(--chem-error-border);
}

/* Komponenten-Vorbereitung */
.chem-form-section {
  width: 100%;
  margin: 0 0 24px;
}

.chem-form-divider {
  width: 100%;
  height: 1px;
  margin: 24px 0;
  background: var(--chem-border-soft);
}

.chem-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .9em;
  font-weight: 600;
}

.chem-status-available {
  background: var(--chem-success-bg);
  color: var(--chem-text);
}

.chem-status-soldout {
  background: var(--chem-error-bg);
  color: var(--chem-text);
}

.chem-price-negative {
  color: var(--chem-muted);
}

.chem-price-highlight {
  font-weight: 700;
}

@media (max-width: 700px) {
  .chem-form-grid,
  .chem-grid-12,
  .chem-grid {
    grid-template-columns: 1fr;
  }

  .chem-col-12,
  .chem-col-11,
  .chem-col-10,
  .chem-col-9,
  .chem-col-8,
  .chem-col-7,
  .chem-col-6,
  .chem-col-5,
  .chem-col-4,
  .chem-col-3,
  .chem-col-2,
  .chem-col-1,
  .chem-field-full,
  .chem-field-company,
  .chem-field-discount,
  .chem-field-half,
  .chem-field-first-name,
  .chem-field-last-name,
  .chem-field-email,
  .chem-field-phone,
  .chem-field-street,
  .chem-field-street-name,
  .chem-field-zip,
  .chem-field-city {
    grid-column: 1 / -1;
  }

  .chem-price-row,
  .chem-price-total {
    display: block;
  }

  .chem-price-row strong,
  .chem-price-total strong {
    display: block;
    margin-top: 2px;
  }
}


/* Terminliste Shortcode: [ch_event_dates] */
.chem-event-dates {
  width: 100%;
  margin: 2rem 0;
  color: var(--chem-text);
}

.chem-event-dates-title {
  margin: 0 0 14px;
}

.chem-event-dates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--chem-border-soft);
  border-bottom: 1px solid var(--chem-border-soft);
}

.chem-event-date-item {
  display: block;
  padding: 16px 0;
  border-bottom: 1px solid var(--chem-border-soft);
}

.chem-event-date-content {
  width: 100%;
}

.chem-event-date-line-primary {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.chem-event-date-line-title,
.chem-event-date-line-location {
  margin-top: 6px;
}

.chem-event-date-item:last-child {
  border-bottom: 0;
}

.chem-event-date-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
}

.chem-event-date-date {
  font-weight: 700;
}


.chem-event-date-title {
  color: var(--chem-text);
}

.chem-event-date-location {
  color: var(--chem-muted);
}

.chem-event-date-availability {
  flex: 0 0 auto;
  text-align: right;
}

.chem-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .9em;
  font-weight: 700;
  white-space: nowrap;
}

.chem-status-available {
  background: var(--chem-success-bg);
  border: 1px solid var(--chem-success-border);
}

.chem-status-soldout {
  background: var(--chem-surface);
  border: 1px solid var(--chem-border-soft);
  color: var(--chem-muted);
}

.chem-event-dates-empty {
  padding: 16px 0;
  border-top: 1px solid var(--chem-border-soft);
  border-bottom: 1px solid var(--chem-border-soft);
  color: var(--chem-muted);
}

@media (max-width: 700px) {
  .chem-event-date-line-primary {
    display: block;
  }

  .chem-event-date-availability {
    display: block;
    margin-top: 8px;
    text-align: left;
  }
}

/* Terminliste: Buchungslink und Statusvarianten */
.chem-available {}

.chem-book-link {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chem-book-link:hover {
  text-decoration-thickness: 2px;
}

.chem-soldout {
  font-weight: 700;
}


/* Optionale Leistungen / Upsell-Komponente */
.chem-section {
  box-sizing: border-box;
  width: 100%;
  margin: 8px 0 22px;
}

.chem-section-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 800;
}

.chem-optional-services {
  padding: 20px 0 4px;
  border-top: 1px solid var(--chem-border-soft);
}

.chem-practice-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.chem-practice-option input[type="checkbox"] {
  width: auto;
  margin-top: 4px;
  flex: 0 0 auto;
}

.chem-upsell-box {
  box-sizing: border-box;
  width: 100%;
  margin: 10px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--chem-border-soft);
  border-radius: var(--chem-radius-large);
  background: var(--chem-surface);
}

.chem-info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chem-info-item {
  position: relative;
  margin: 0 0 8px;
  padding-left: 24px;
  color: var(--chem-text);
}

.chem-info-item:last-child {
  margin-bottom: 0;
}

.chem-info-item::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
}

.chem-price-highlight {
  font-weight: 800;
}

.chem-note {
  color: var(--chem-muted);
  font-size: .95em;
}


.chem-form-section-heading {
    margin-top: 1.25rem;
    margin-bottom: -0.25rem;
}

.chem-form-section-heading .chem-section-title {
    margin: 0;
}
