/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Outfit — same self-hosted font the studio site uses (palavara-v3/src/styles/index.css). */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Studio palette (palavara-v3/src/styles/global.module.scss). */
  --color-bg:          #ffffff;
  --color-surface:     #ffffff;
  --color-blue:        #0054CF;
  --color-paypal:      #003087;
  --color-success:     #1a7f4b;
  --color-warning:     #b45309;
  --color-error:       #b91c1c;
  --color-text:        #000000;
  --color-grey:        #F5F5F5;
  --color-muted:       #aaaaaa;   /* studio "dark grey" */
  --color-border:      #aaaaaa;
  --color-border-soft: #ececec;
  --color-slot-hover:  #F5F5F5;
  --color-slot-sel:    #0054CF;
  --radius:            8px;
  --font:              'Outfit', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-weight: 300;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* dvh respects the iOS Safari URL-bar shrink; falls back to vh elsewhere. */
  height: 100dvh;
  overflow: hidden;          /* outer page never scrolls; .step-body does. */
}

.site-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
}
.site-header .logo-link { display: inline-flex; line-height: 0; flex-shrink: 0; }
/* Same logo sizing as the studio site — 124 px desktop, 60 px mobile. */
.site-header .logo {
  width: 124px;
  height: 124px;
}
@media (max-width: 500px) {
  .site-header .logo { width: 60px; height: 60px; }
  .site-header { padding: 16px; }
}
/* Title next to the logo on mobile (date · slot once user has chosen).
   Hidden on desktop — desktop shows the title in the form body. */
.header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title:empty { display: none; }
@media (min-width: 601px) {
  .header-title { display: none; }
}

/* Cycle-mode progress: sits LEFT of the logo (flex source order), styled
   like the header title — same font/color, just text, no panel. One line
   per session: "Session N/4: <date>" if picked, "Session N/4: must …" for
   the next-to-pick session, "Session N/4:" for not-yet-pickable rows.
   Hidden on single-session bookings; populated by renderCycleProgress. */
.cycle-progress-header {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-blue);
  line-height: 1.4;
}
.cycle-progress-header.hidden { display: none; }
.cycle-progress-header .cycle-session-label {
  font-weight: 700;
  /* Tiny right-edge align gap so labels stay flush even when values vary. */
  margin-right: 0.25rem;
}
/* Constraint hint reads in the body color (black), so it contrasts with the
   blue session labels and doesn't look like another picked-date line. */
.cycle-progress-header .cycle-session-hint {
  color: var(--color-text);
  font-weight: 300;
}

/* Legal footer (Impressum / AGB / Datenschutz) — points at studio.palavara.com.
   Mirrors the studio-site SiteFooter styling. § 5 TMG: legal links must be
   reachable from every page that collects PII or triggers payment. */
.site-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 1px 16px;
  font-size: 7px;
  flex-shrink: 0;
}
.site-footer a {
  color: rgba(0, 0, 0, 0.5);
  text-decoration: none;
}
.site-footer a:hover { color: rgba(0, 0, 0, 0.8); }
@media (max-width: 600px) {
  .site-footer {
    justify-content: space-between;
    gap: 0;
    font-size: 8px;
  }
}

.booking-container {
  flex: 1;
  min-height: 0;             /* allow flex child to shrink below content size */
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */
.step {
  position: relative;
  flex: 1;
  min-height: 0;             /* let .step-body's overflow-y engage instead of pushing the step taller */
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.step.hidden { display: none; }
.step.active { display: flex; }

/* Scrollable middle area inside each step. Anything over the available
   height scrolls inside this div so .step-actions stays pinned. */
.step-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Prominent centered title above the form (lesson · date · time slot).
   Hidden on mobile — mobile shows the title in the page header. */
.step-context {
  font-size: 1.4rem;
  font-weight: 500;
  text-align: center;
  color: var(--color-blue);
  margin-bottom: 1.5rem;
}
.step-context .summary-lesson {
  font-size: 1rem;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.55);
}
@media (max-width: 600px) {
  .step-context { display: none; }
}

/* Lesson-type picker (step 1) — vertical list of cards. Each card spans
   the row, click anywhere selects. Same styling on mobile (just narrower). */
.lesson-type-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lesson-type-loading {
  text-align: center;
  color: rgba(0, 0, 0, 0.5);
  padding: 24px;
}
.lesson-type-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lesson-type-card:hover,
.lesson-type-card:focus-visible {
  border-color: var(--color-blue);
  background: color-mix(in srgb, var(--color-blue) 4%, white);
  outline: none;
}
.lesson-type-card-label {
  flex: 1;
  font-size: 1.05rem;
}
.lesson-type-card-price {
  font-weight: 500;
  color: var(--color-blue);
  white-space: nowrap;
}

.step-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step-close:hover { background: var(--color-slot-hover); }

@media (max-width: 600px) {
  .step-close { display: none; }
}

/* Inline consent line above the PayPal button — § 305 BGB requires the
   customer have a chance to take note of the AGB before contract conclusion. */
.consent-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1.5;
}
.consent-note a {
  color: inherit;
  text-decoration: underline;
}
.consent-note a:hover { color: rgba(0, 0, 0, 0.85); }

.step-actions {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
}
/* The primary action (Continue / Pay with PayPal) takes the remaining
   width next to the short Back button. min-width:0 lets it shrink past
   its intrinsic content size on narrow phones so the row never overflows. */
.step-actions .btn-paypal { flex: 1; min-width: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Date picker: calendar (desktop) + list (mobile) ─────────────────────── */
.calendar-view { display: flex; flex-direction: column; flex: 1; }
.date-list { display: none; }

@media (max-width: 600px) {
  .calendar-view { display: none; }
  .date-list { display: block; }
}

/* Calendar (desktop) */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.cal-month-label {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-blue);
}
.cal-nav {
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-nav:hover { background: var(--color-slot-hover); }
.cal-nav:disabled { opacity: 0.35; cursor: not-allowed; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(80px, 1fr);
  gap: 4px;
  flex: 1;
}
.cal-day {
  display: flex;
  flex-direction: column;
  padding: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-muted);
  min-height: 0;
  overflow: hidden;
}
.cal-day-number {
  align-self: flex-end;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--color-blue);
}
.cal-day.outside { opacity: 0.35; }
.cal-day.outside .cal-day-number { color: var(--color-muted); }
.cal-day.today {
  border-color: var(--color-text);
  border-width: 2px;
  /* The 2 px border eats 1 px on each side; trim padding so the cell stays
     aligned with its neighbours. */
  padding: 3px;
}

.cal-day-slots {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.cal-slot {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 6px;
  border: none;
  border-radius: 4px;
  background: var(--color-grey);
  color: var(--color-text);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background 0.15s ease;
}
/* True tint of the brand blue (#0054CF) so the hover reads as the same hue,
   not a generic light blue. */
.cal-slot:hover  { background: color-mix(in srgb, var(--color-blue) 12%, white); }
.cal-slot:active { background: color-mix(in srgb, var(--color-blue) 22%, white); }
/* Cycle-mode slot decorations. .selected = one of the picked sessions;
   .invalid = greyed out because it would break the spacing rules. */
.cal-slot.selected {
  background: var(--color-blue);
  color: #fff;
}
.cal-slot.selected:hover { background: var(--color-blue); }
.cal-slot.invalid {
  opacity: 0.35;
  cursor: not-allowed;
  background: var(--color-grey);
}
.cal-slot.invalid:hover { background: var(--color-grey); }

/* Mirror on the mobile drawer slot button. */
.slot-btn.selected {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
}
.slot-btn.invalid {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Mobile date list with drawer-style slot reveal */
.date-list { list-style: none; padding: 0; margin: 0; }
.date-list > li { margin-bottom: 0.5rem; }

.date-list-item {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.875rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}
.date-list-item:hover { background: var(--color-slot-hover); }
.date-list-item.expanded {
  background: var(--color-slot-hover);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.date-list-item .weekday { font-weight: 500; color: var(--color-blue); }
.date-list-item .date    { color: var(--color-muted); margin-left: 0.5rem; }
.date-list-item .chevron {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--color-muted);
  transition: transform 0.2s ease;
}
.date-list-item.expanded .chevron { transform: rotate(180deg); }

.date-drawer {
  display: none;
  border: 1px solid var(--color-border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: 0.75rem;
}
.date-drawer.open { display: block; }
.date-drawer .slots-grid { margin-bottom: 0; }

.date-list-empty {
  color: var(--color-muted);
  font-style: italic;
  padding: 0.75rem 0;
}

/* ── Slots grid (mobile step 2) ──────────────────────────────────────────── */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.slot-btn {
  padding: 0.75rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--color-blue);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  text-align: center;
}
.slot-btn:hover  { background: var(--color-slot-hover); }
.slot-btn.selected {
  background: var(--color-slot-sel);
  border-color: var(--color-slot-sel);
  color: #fff;
}

.no-slots-msg {
  color: var(--color-muted);
  font-style: italic;
  padding: 1rem 0;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 1rem;
}
.form-row > .form-group { flex: 1; }
@media (max-width: 600px) {
  .form-row { display: block; }
}

.form-group { margin-bottom: 1.125rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-blue);
  margin-bottom: 0.35rem;
}
.form-group .optional {
  font-weight: 400;
  color: var(--color-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.form-group textarea { resize: vertical; min-height: 4rem; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-blue);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;   /* Firefox sets a default opacity that mutes muted further */
}
.form-group.hidden { display: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--color-surface);
  color: var(--color-text);
}
.btn:hover { background: var(--color-slot-hover); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-block { display: flex; width: 100%; }

.btn-paypal {
  background: var(--color-paypal);
  color: #fff;
  border-color: var(--color-paypal);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  white-space: normal;
  line-height: 1.2;
}
.btn-paypal:hover { background: #004bad; }
.btn-paypal:disabled {
  background: #d1d5db;
  border-color: #d1d5db;
  color: #6b7280;
}
@media (max-width: 600px) {
  .btn-paypal { font-size: 0.85rem; padding: 0.6rem 0.5rem; }
}

.btn-ghost { background: transparent; }

/* ── Error messages ──────────────────────────────────────────────────────── */
.error-msg {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  border-left: 3px solid var(--color-error);
}
.error-msg.hidden { display: none; }

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-radius: var(--radius);
  z-index: 10;
  font-size: 1rem;
  color: var(--color-muted);
}
.loading-overlay.hidden { display: none; }
.loading-overlay.static { position: static; background: none; padding: 3rem 0; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-grey);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Confirmation card (confirm.html / cancel.html) ──────────────────────── */
.confirm-card {
  text-align: center;
  padding: 2rem 1rem;
  max-width: 480px;
  margin: 0 auto;
}
.confirm-card .confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}
.confirm-card h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-blue);
}
.confirm-card p {
  color: var(--color-muted);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}
.confirm-card.warning .confirm-icon,
.confirm-card.warning h2 { color: var(--color-warning); border-color: var(--color-warning); }
.confirm-card.error .confirm-icon,
.confirm-card.error h2 { color: var(--color-error); border-color: var(--color-error); }

.confirm-details {
  margin: 1.5rem auto;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
@media (max-width: 600px) {
  /* Mobile: drop the framed border so the table gets the full width. */
  .confirm-details {
    border: none;
    border-radius: 0;
    padding: 0;
  }
}
.confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  font-size: 0.95rem;
}
.confirm-row + .confirm-row { border-top: 1px solid var(--color-border-soft); }
.confirm-row .label { color: var(--color-muted); }
.confirm-row .value { color: var(--color-text); font-weight: 500; }
.confirm-row code {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-weight: 400;
}

.confirm-cta {
  display: inline-flex;
  margin: 1.5rem auto 0;
}

.booking-id-label { font-size: 0.875rem; color: var(--color-muted); }
.booking-id-label code {
  background: var(--color-slot-hover);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}
.confirm-email-note { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.5rem; }

.refund-notice {
  font-size: 0.95rem;
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  line-height: 1.5;
}
.refund-notice.refund-eligible { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.refund-notice.refund-late     { background: #fff7ed; color: #92400e; border-color: #fed7aa; }

.refund-policy-link {
  font-size: 0.8rem;
  margin: -0.75rem 0 1.25rem;
  text-align: right;
}
.refund-policy-link a { color: var(--color-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .slots-grid { grid-template-columns: repeat(3, 1fr); }
  .booking-container { padding: 0 1rem 1rem; }
}
