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

:root {
  --bg: #f9f9f8;
  --surface: #ffffff;
  --border: #e2e2e0;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

main { width: 100%; max-width: 600px; }

h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.5rem; }

section { margin-bottom: 1.5rem; }

p { color: var(--muted); margin-bottom: 1rem; line-height: 1.5; }

.row { display: flex; gap: 0.5rem; align-items: center; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */

input[type="text"],
input[type="email"],
select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

input:focus,
select:focus { border-color: var(--accent); }

select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.6rem;
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 1rem;
}
label.checkbox input { width: auto; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: default; }

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

.error { color: var(--danger); font-size: 0.9rem; margin-top: 0.5rem; }

/* ── Calendar layout ─────────────────────────────────────────────────────── */

#slot-info {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

#cal-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
}

/* ── Calendar panel ──────────────────────────────────────────────────────── */

#cal-panel { width: 252px; }

#cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

#cal-title { font-weight: 600; font-size: 0.95rem; }

.cal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 1.2rem;
  line-height: 1.5;
  cursor: pointer;
}
.cal-nav-btn:hover { background: var(--border); }
.cal-nav-btn:disabled { opacity: 0.25; cursor: default; background: none; }

#cal-weekdays,
#cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
#cal-weekdays { margin-bottom: 4px; }

.cal-wday {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.2rem 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border-radius: 50%;
  user-select: none;
}

.cal-day.no-slots { color: var(--border); cursor: default; }

.cal-day.has-slots {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.cal-day.has-slots:hover { background: #eff6ff; color: var(--accent); }

.cal-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}

.cal-day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.cal-day.is-selected:hover { background: var(--accent-hover); }

/* ── Time panel ──────────────────────────────────────────────────────────── */

#time-panel { padding-top: 0.1rem; }

#time-panel-date {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 1rem;
}

#confirm-slot-btn { margin-top: 0.5rem; width: 100%; }

/* ── Booking form ────────────────────────────────────────────────────────── */

#form-slot-summary {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: #eff6ff;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
}

/* ── Done ────────────────────────────────────────────────────────────────── */

#step-done { text-align: center; padding-top: 2rem; }

.done-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

#done-summary { margin-top: 0.5rem; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 500px) {
  #cal-layout { grid-template-columns: 1fr; }
  #cal-panel  { width: 100%; }
}
