/* ==========================================================================
   Booking-widget — Klip & Krølle
   Bruger de delte CSS-variabler fra css/style.css (--c-primary, --c-accent,
   --c-bg, --c-surface, --c-text, --c-muted). Alle med fallback-defaults.
   ========================================================================== */

:root {
  --bw-primary: var(--c-primary, #b8860b);
  --bw-accent: var(--c-accent, #1f2a44);
  --bw-bg: var(--c-bg, #fbfaf7);
  --bw-surface: var(--c-surface, #ffffff);
  --bw-text: var(--c-text, #1f2a2c);
  --bw-muted: var(--c-muted, #6b6f76);
  --bw-radius: 14px;
  --bw-radius-sm: 8px;
  --bw-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.35);
  --bw-border: color-mix(in srgb, var(--bw-muted) 30%, transparent);
}

/* -------------------------------------------------------------------------
   Overlay + dialog
   ------------------------------------------------------------------------- */

.bw-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 15, 20, 0.55);
  backdrop-filter: blur(3px);
  animation: bw-fade-in 0.18s ease-out;
}

.bw-overlay[hidden] {
  display: none !important;
}

@keyframes bw-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bw-dialog {
  width: 100%;
  max-width: 560px;
  max-height: min(720px, 92vh);
  display: flex;
  flex-direction: column;
  background: var(--bw-surface);
  color: var(--bw-text);
  border-radius: var(--bw-radius);
  box-shadow: var(--bw-shadow);
  overflow: hidden;
  animation: bw-pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: inherit;
}

@keyframes bw-pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .bw-overlay {
    padding: 0;
    align-items: stretch;
  }
  .bw-dialog {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }
}

/* -------------------------------------------------------------------------
   Header + progress
   ------------------------------------------------------------------------- */

.bw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--bw-border);
  flex: 0 0 auto;
}

.bw-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--bw-accent);
}

.bw-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--bw-muted);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.bw-close:hover,
.bw-close:focus-visible {
  background: color-mix(in srgb, var(--bw-primary) 14%, transparent);
  color: var(--bw-primary);
}

.bw-progress {
  display: flex;
  gap: 6px;
  padding: 0 20px 14px;
  flex: 0 0 auto;
}

.bw-progress-step {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--bw-border);
  overflow: hidden;
}

.bw-progress-step::after {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: var(--bw-primary);
  transition: width 0.25s ease;
}

.bw-progress-step.is-done::after,
.bw-progress-step.is-active::after {
  width: 100%;
}

.bw-progress-step.is-active::after {
  width: 55%;
}

.bw-progress-label {
  padding: 0 20px 10px;
  font-size: 0.8rem;
  color: var(--bw-muted);
  flex: 0 0 auto;
}

/* -------------------------------------------------------------------------
   Body
   ------------------------------------------------------------------------- */

.bw-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 20px 20px;
  -webkit-overflow-scrolling: touch;
}

.bw-step {
  animation: bw-slide-in 0.18s ease-out;
}

@keyframes bw-slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.bw-step h3 {
  margin: 4px 0 14px;
  font-size: 1rem;
  color: var(--bw-text);
}

.bw-hint {
  color: var(--bw-muted);
  font-size: 0.88rem;
  margin: -8px 0 14px;
}

/* -------------------------------------------------------------------------
   Footer / navigation
   ------------------------------------------------------------------------- */

.bw-footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--bw-border);
  flex: 0 0 auto;
}

.bw-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--bw-radius-sm);
  padding: 12px 20px;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

.bw-btn:active {
  transform: scale(0.98);
}

.bw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.bw-btn-primary {
  background: var(--bw-primary);
  color: #fff;
}

.bw-btn-primary:hover:not(:disabled),
.bw-btn-primary:focus-visible:not(:disabled) {
  filter: brightness(1.08);
}

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

.bw-btn-secondary:hover:not(:disabled),
.bw-btn-secondary:focus-visible:not(:disabled) {
  border-color: var(--bw-primary);
  color: var(--bw-primary);
}

.bw-btn-spacer {
  flex: 1;
}

/* -------------------------------------------------------------------------
   Trin 1: Ydelser
   ------------------------------------------------------------------------- */

.bw-category {
  margin-bottom: 18px;
}

.bw-category-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bw-muted);
  margin: 0 0 8px;
}

.bw-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bw-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bw-bg);
  border: 1.5px solid var(--bw-border);
  border-radius: var(--bw-radius-sm);
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
  color: var(--bw-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bw-option:hover,
.bw-option:focus-visible {
  border-color: var(--bw-primary);
}

.bw-option.is-selected {
  border-color: var(--bw-primary);
  background: color-mix(in srgb, var(--bw-primary) 10%, var(--bw-bg));
}

.bw-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bw-option-name {
  font-weight: 600;
}

.bw-option-meta {
  font-size: 0.82rem;
  color: var(--bw-muted);
}

.bw-option-price {
  font-weight: 700;
  color: var(--bw-accent);
  white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Trin 2: Medarbejder
   ------------------------------------------------------------------------- */

.bw-staff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bw-staff-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bw-bg);
  border: 1.5px solid var(--bw-border);
  border-radius: var(--bw-radius-sm);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  color: var(--bw-text);
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bw-staff-option:hover,
.bw-staff-option:focus-visible {
  border-color: var(--bw-primary);
}

.bw-staff-option.is-selected {
  border-color: var(--bw-primary);
  background: color-mix(in srgb, var(--bw-primary) 10%, var(--bw-bg));
}

.bw-staff-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bw-primary), var(--bw-accent));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.bw-staff-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.bw-staff-name {
  font-weight: 600;
}

.bw-staff-role {
  font-size: 0.82rem;
  color: var(--bw-muted);
}

/* -------------------------------------------------------------------------
   Trin 3: Dato + tid
   ------------------------------------------------------------------------- */

.bw-calendar {
  margin-bottom: 18px;
}

.bw-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bw-calendar-title {
  font-weight: 700;
  color: var(--bw-accent);
  text-transform: capitalize;
}

.bw-cal-nav {
  appearance: none;
  border: 1px solid var(--bw-border);
  background: var(--bw-bg);
  color: var(--bw-text);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-cal-nav:hover:not(:disabled),
.bw-cal-nav:focus-visible:not(:disabled) {
  border-color: var(--bw-primary);
  color: var(--bw-primary);
}

.bw-cal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.bw-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.bw-cal-dow {
  text-align: center;
  font-size: 0.72rem;
  color: var(--bw-muted);
  padding-bottom: 4px;
  text-transform: uppercase;
}

.bw-cal-day {
  appearance: none;
  border: 1px solid transparent;
  background: var(--bw-bg);
  color: var(--bw-text);
  aspect-ratio: 1;
  min-height: 38px;
  border-radius: var(--bw-radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bw-cal-day:hover:not(:disabled),
.bw-cal-day:focus-visible:not(:disabled) {
  border-color: var(--bw-primary);
}

.bw-cal-day.is-selected {
  background: var(--bw-primary);
  color: #fff;
  font-weight: 700;
}

.bw-cal-day.is-today {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bw-cal-day:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: transparent;
}

.bw-cal-day.bw-cal-empty {
  visibility: hidden;
  pointer-events: none;
}

.bw-slots-section {
  border-top: 1px solid var(--bw-border);
  padding-top: 14px;
}

.bw-slots-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 10px;
}

.bw-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bw-chip {
  appearance: none;
  border: 1.5px solid var(--bw-border);
  background: var(--bw-bg);
  color: var(--bw-text);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 40px;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.bw-chip:hover,
.bw-chip:focus-visible {
  border-color: var(--bw-primary);
}

.bw-chip.is-selected {
  background: var(--bw-primary);
  border-color: var(--bw-primary);
  color: #fff;
  font-weight: 600;
}

.bw-empty-msg,
.bw-loading-msg,
.bw-error-msg {
  color: var(--bw-muted);
  font-size: 0.9rem;
  padding: 14px 0;
  text-align: center;
}

.bw-error-msg {
  color: #b3261e;
}

:root[data-theme="dark"] .bw-error-msg {
  color: #ff8a80;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bw-error-msg {
    color: #ff8a80;
  }
}

.bw-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--bw-border);
  border-top-color: var(--bw-primary);
  border-radius: 50%;
  animation: bw-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes bw-spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------
   Trin 4: Detaljer / form
   ------------------------------------------------------------------------- */

.bw-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bw-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bw-text);
}

.bw-field .bw-optional {
  font-weight: 400;
  color: var(--bw-muted);
}

.bw-field input,
.bw-field textarea {
  width: 100%;
  border: 1.5px solid var(--bw-border);
  border-radius: var(--bw-radius-sm);
  background: var(--bw-bg);
  color: var(--bw-text);
  padding: 11px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  min-height: 44px;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.bw-field textarea {
  min-height: 72px;
  resize: vertical;
}

.bw-field input:focus,
.bw-field textarea:focus {
  outline: none;
  border-color: var(--bw-primary);
}

.bw-field input:invalid.is-touched {
  border-color: #b3261e;
}

.bw-field-error {
  font-size: 0.78rem;
  color: #b3261e;
  min-height: 1em;
}

/* Honeypot: visuelt skjult men til stede for skærmlæsere/botter, ikke display:none */
.bw-hp-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  left: -9999px !important;
}

/* -------------------------------------------------------------------------
   Trin 5: Bekræft / opsummering / kvittering
   ------------------------------------------------------------------------- */

.bw-summary {
  background: var(--bw-bg);
  border: 1px solid var(--bw-border);
  border-radius: var(--bw-radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.bw-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--bw-border);
}

.bw-summary-row:last-child {
  border-bottom: none;
}

.bw-summary-row dt {
  color: var(--bw-muted);
}

.bw-summary-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.bw-confirm-error {
  color: #b3261e;
  font-size: 0.88rem;
  margin-top: 10px;
  min-height: 1em;
}

.bw-success {
  text-align: center;
  padding: 10px 0 4px;
}

.bw-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bw-primary) 16%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-success-icon svg {
  width: 30px;
  height: 30px;
  stroke: var(--bw-primary);
}

.bw-success h3 {
  font-size: 1.15rem;
  margin: 0 0 6px;
}

.bw-success p {
  color: var(--bw-muted);
  margin: 0 0 4px;
}

.bw-success .bw-summary {
  text-align: left;
  margin-top: 16px;
}

.bw-booking-id {
  font-size: 0.78rem;
  color: var(--bw-muted);
  margin-top: 10px;
}

/* -------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .bw-overlay,
  .bw-dialog,
  .bw-step,
  .bw-spinner {
    animation: none !important;
  }
}
