/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:        #006BFF;
  --brand-dark:   #0050cc;
  --brand-light:  #e8f0fe;
  --success:      #1a7f4b;
  --success-bg:   #d1fae5;
  --danger:       #c0392b;
  --danger-bg:    #fde8e8;
  --text:         #1a1a2e;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --bg:           #f8fafc;
  --card:         #ffffff;
  --radius:       12px;
  --shadow:       0 4px 24px rgba(0,0,0,.08);
  --transition:   0.18s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem 1rem;
  line-height: 1.6;
}

/* ===== Layout ===== */
.container {
  max-width: 560px;
  margin: 0 auto;
}

/* ===== Header ===== */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.avatar svg { width: 32px; height: 32px; }

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

/* ===== Step card ===== */
.step {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.step-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Calendar ===== */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.month-label {
  font-weight: 600;
  font-size: 1rem;
}

.nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover { background: var(--brand-light); }
.nav-btn:disabled { opacity: .35; cursor: not-allowed; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-name {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cal-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.cal-day:not(:disabled):hover { background: var(--brand-light); color: var(--brand); }
.cal-day.today { font-weight: 700; color: var(--brand); }
.cal-day.selected { background: var(--brand) !important; color: #fff !important; }
.cal-day:disabled { color: var(--border); cursor: not-allowed; }
.cal-day.empty { pointer-events: none; }

/* ===== Slots ===== */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
}

.slot-btn {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  text-align: center;
}

.slot-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

.slot-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.slot-btn:disabled {
  color: var(--text-muted);
  background: var(--bg);
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: .6;
}

.slots-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.slots-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.no-slots {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Booking summary chip ===== */
.booking-summary {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.required { color: var(--danger); }
.optional { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,107,255,.12);
}

input.invalid, textarea.invalid {
  border-color: var(--danger);
}

.field-error {
  display: block;
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 0.25rem;
  min-height: 1em;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.4rem;
  gap: 1rem;
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-top: 0.9rem;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
}

.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.btn-secondary:hover { background: var(--brand-light); }

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover { color: var(--brand-dark); }

/* Submit spinner inline */
.submit-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ===== Confirmation ===== */
.confirmation {
  text-align: center;
  padding: 1rem 0;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
}

.confirmation h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.confirm-details {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  white-space: pre-line;
}

.confirmation .btn-primary,
.confirmation .btn-secondary {
  margin: 0.35rem 0.25rem;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body { padding: 1rem 0.5rem; }
  .step { padding: 1.25rem; }
  .slots-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn-primary { width: 100%; justify-content: center; }
}
