/* SUNS Brand Styles */
:root {
  --color-bg: #f5f0eb;
  --color-white: #ffffff;
  --color-text: #2c2c2c;
  --color-text-light: #6b6b6b;
  --color-accent: #2c2c2c;
  --color-accent-hover: #444444;
  --color-border: #e0d8cf;
  --color-tag-bg: #f5f0eb;
  --color-tag-text: #2c2c2c;
  --color-error: #c0392b;
  --color-success: #27ae60;
  --font-primary: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background-color: var(--color-bg);
}

body {
  font-family: var(--font-primary);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

/* ── Steps ── */
.step {
  display: none;
}

.step.active {
  display: block;
}

/* ═══════════════════════════════════
   MAP-FIRST VIEW (Step 1)
   ═══════════════════════════════════ */
.map-view {
  position: relative;
  width: 100%;
  height: 720px;
  background: var(--color-bg);
}

#map {
  width: 100%;
  height: 100%;
}

/* Search card overlaid on the map (top-center, always visible) */
.search-card {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  padding: 18px 20px;
  z-index: 1000;
}

.search-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  text-align: center;
}

.search-card[hidden] { display: none; }

.search-pill {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  align-items: center;
  gap: 8px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: inline-flex;
}

.search-pill[hidden] { display: none; }

.search-pill svg {
  color: var(--color-text-light);
  flex: 0 0 auto;
}

.geo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.geo-link:hover {
  background: var(--color-bg);
  border-color: var(--color-text-light);
}

.geo-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.geo-link svg {
  flex: 0 0 auto;
  color: var(--color-text-light);
}

.search-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-field {
  flex: 1;
}

.search-field-small {
  flex: 0 0 70px;
}

.search-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-primary);
  background: var(--color-bg);
}

.search-field input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-white);
}

.search-submit {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.search-submit:hover {
  background: var(--color-accent-hover);
}


/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  font-family: var(--font-primary) !important;
}

.map-popup {
  padding: 16px;
  min-width: 220px;
}

.map-popup h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.map-popup p {
  font-size: 13px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.map-popup .popup-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 11px;
  margin-bottom: 8px;
}

.map-popup .popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.map-popup .popup-actions button,
.map-popup .popup-actions a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-primary);
  cursor: pointer;
  text-decoration: none;
}

/* When no postcode has been entered yet, dim the "Maak afspraak" button
   so users see at a glance that they need to fill the form first.
   The button stays clickable — selectCenter() catches the click and
   focuses the postcode field with an explanatory message. */
body.postcode-required .js-appointment-gate {
  opacity: 0.55;
  cursor: help;
}

/* Custom map marker */
.custom-marker {
  background: var(--color-white);
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.custom-marker-inner {
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border-radius: 50%;
}

.custom-marker.user-marker {
  border-color: #e74c3c;
}

.custom-marker.user-marker .custom-marker-inner {
  background: #e74c3c;
}

/* ═══════════════════
   STEP 3: Appointment
   ═══════════════════ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px;
}

.card {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-group-checkbox {
  margin-top: -4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-primary);
  background: var(--color-white);
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
  width: 100%;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
}

.btn-back {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-primary);
}

.btn-back:hover {
  color: var(--color-text);
}

.error-message {
  display: none;
  color: var(--color-error);
  font-size: 14px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #fdf2f2;
  border-radius: var(--radius);
}

.selected-center {
  background: var(--color-bg);
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-weight: 500;
}

/* Calendly embed */
.calendly-embed {
  /* Container is now a wrapper for either the popup-trigger button (Calendly centers)
     or the .datetime-picker fallback (other centers). No fixed height needed. */
  min-height: 0;
  border: none;
  background: transparent;
}

/* Calendly popup-trigger: replaces the inline calendar with a single CTA button */
.calendly-popup-trigger {
  text-align: center;
  padding: 24px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.calendly-popup-trigger button {
  width: 100%;
  max-width: 320px;
}

.calendly-hint {
  font-size: 13px;
  color: var(--color-text-light);
  margin: 12px 0 0;
}

/* Confirmation banner shown after Calendly fires event_scheduled */
.calendly-booked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px;
  background: #e7f4ea;
  color: #1d6b3a;
  border: 1px solid #b8dec4;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.calendly-booked svg {
  flex: 0 0 auto;
}

.datetime-picker input[type="date"],
.datetime-picker input[type="time"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-primary);
  background: var(--color-white);
  color: var(--color-text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.datetime-picker input[type="date"]:focus,
.datetime-picker input[type="time"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

.datetime-picker input[type="date"]::-webkit-calendar-picker-indicator,
.datetime-picker input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

.datetime-picker select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-primary);
  background: var(--color-white);
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236b6b6b' stroke-width='2'><path d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.datetime-picker select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.datetime-picker select:disabled {
  background-color: var(--color-bg);
  color: var(--color-text-light);
  cursor: not-allowed;
}

.datetime-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--color-text-light);
}

.calendly-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--color-text-light);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.calendly-placeholder svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

.optional {
  color: var(--color-text-light);
  font-weight: 400;
}

/* ═══════════════════
   STEP 4: Confirmation
   ═══════════════════ */
.confirmation {
  text-align: center;
  padding: 40px 20px;
}

.confirmation-icon {
  width: 64px;
  height: 64px;
  background: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.confirmation-icon svg {
  width: 32px;
  height: 32px;
  stroke: white;
}

.confirmation h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.confirmation p {
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.confirmation-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  align-items: stretch;
}

.confirmation-actions .btn {
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

/* ═══════════════════
   Responsive
   ═══════════════════ */
@media (max-width: 900px) {
  .map-view { height: 680px; }

  .search-card {
    margin: 16px auto;
    padding: 16px 18px;
  }

  .search-card h2 {
    font-size: 14px;
    margin-bottom: 12px;
  }

  /* Move zoom controls to bottom-left on mobile — search-card overlay blocks them at top-left. */
  .leaflet-top.leaflet-left {
    top: auto;
    bottom: 20px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 24px 16px;
  }

  .card {
    padding: 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .search-card {
    top: 12px;
    padding: 14px 16px;
  }

  .search-pill {
    top: 12px;
    padding: 9px 14px;
    font-size: 13px;
  }
}
