/* ═══════════════════════════════════════════════════════
   REPLAI Booking — Public SPA Styles v1.0
═══════════════════════════════════════════════════════ */

:root {
  --bg-top:       #1775ed;
  --bg-bottom:    #0f62d4;
  --card:         #ffffff;
  --card-bg:      #f8fafc;
  --text:         #1d2939;
  --muted:        #667085;
  --primary:      #1775ed;
  --primary-dark: #0d5fcb;
  --primary-light:#e8f0fe;
  --line:         #e4e7ec;
  --ok:           #17b26a;
  --danger:       #d92d20;
  --warn:         #f79009;
  --radius:       12px;
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #4ea0ff 0%, #1f78ea 36%, #0f62d4 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── TOPBAR ────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 1rem .75rem;
  background: transparent;
}

.topbar-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.topbar-logo {
  height: 28px;
  width: auto;
}

.back-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(255,255,255,0.3); }
.back-btn.hidden { visibility: hidden; }

/* ── MAIN ──────────────────────────────────────────── */
.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ── VIEWS ─────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* Loading */
.view-loading { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.spinner-wrap { display: flex; align-items: center; justify-content: center; }
.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 3px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CARD ───────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem;
  margin-bottom: 1rem;
}

.card-center {
  text-align: center;
  padding: 2rem 1.5rem;
}

/* ── WORKSPACE HOME ────────────────────────────────── */
.workspace-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
  color: #fff;
}
.ws-logo {
  height: 64px;
  width: auto;
  border-radius: 12px;
  margin-bottom: .75rem;
  background: rgba(255,255,255,0.15);
  padding: .5rem;
}
.ws-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  color: #fff;
}

.pages-list { display: flex; flex-direction: column; gap: .75rem; }

.page-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, transform .1s;
  text-decoration: none;
  color: var(--text);
}
.page-card:hover { border-color: var(--primary); transform: translateY(-1px); }

.page-card-icon {
  width: 2.75rem; height: 2.75rem;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.page-card-body { flex: 1; min-width: 0; }
.page-card-name { font-weight: 600; margin: 0 0 .2rem; }
.page-card-meta { font-size: .82rem; color: var(--muted); margin: 0; }
.page-card-arrow { color: var(--muted); }

/* ── PAGE HEADER ───────────────────────────────────── */
.page-header { margin-bottom: 1rem; }
.page-title { font-size: 1.2rem; font-weight: 700; margin: 0 0 .3rem; }
.page-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 500;
  padding: .2rem .6rem;
  border-radius: 100px;
  background: var(--primary-light);
  color: var(--primary);
}

/* ── STEP SECTIONS ─────────────────────────────────── */
.step-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.step-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── MEMBERS GRID ──────────────────────────────────── */
.members-grid { display: flex; flex-wrap: wrap; gap: .75rem; }
.member-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem .5rem .5rem;
  border-radius: 100px;
  border: 2px solid var(--line);
  cursor: pointer;
  background: var(--card-bg);
  transition: border-color .15s;
  font-size: .875rem;
  font-weight: 500;
}
.member-chip:hover { border-color: var(--primary); }
.member-chip.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.member-chip img {
  width: 1.75rem; height: 1.75rem; border-radius: 50%; object-fit: cover;
}
.member-chip-avatar {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}

/* ── CALENDAR ──────────────────────────────────────── */
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.cal-month-label { font-weight: 600; font-size: .95rem; }
.cal-nav-btn {
  background: none; border: none;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text);
  transition: background .15s;
}
.cal-nav-btn:hover { background: var(--line); }
.cal-nav-btn:disabled { opacity: .3; pointer-events: none; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-header {
  text-align: center; font-size: .7rem; font-weight: 600;
  color: var(--muted); padding: .25rem 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: .82rem;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
}
.cal-day.empty { pointer-events: none; }
.cal-day.unavailable { color: var(--line); pointer-events: none; }
.cal-day.past { color: var(--line); pointer-events: none; }
.cal-day.available { font-weight: 600; color: var(--primary); }
.cal-day.available:hover { background: var(--primary-light); }
.cal-day.selected {
  background: var(--primary); color: #fff; font-weight: 700;
}
.cal-day.today::after {
  content: '';
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}

/* ── SLOTS ─────────────────────────────────────────── */
.selected-date-label {
  font-weight: 600; color: var(--text); margin: -.5rem 0 .75rem;
}
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: .85rem; margin-left: auto;
}
.link-btn:hover { color: var(--danger); }

.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
@media (max-width: 360px) {
  .slots-grid { grid-template-columns: repeat(2, 1fr); }
}

.slot-btn {
  padding: .55rem .5rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  font-weight: 600; font-size: .85rem;
  cursor: pointer;
  text-align: center;
  transition: border-color .12s, background .12s, color .12s;
  color: var(--text);
}
.slot-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.slot-btn.selected { border-color: var(--primary); background: var(--primary); color: #fff; }

/* ── BOOKING FORM ──────────────────────────────────── */
.booking-summary {
  background: var(--primary-light);
  border-radius: 8px;
  padding: .85rem 1rem;
  font-size: .875rem;
}
.booking-summary-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; color: var(--primary); }
.booking-summary-row:last-child { margin-bottom: 0; }
.booking-summary-row i { width: 1rem; text-align: center; }

.field { display: flex; flex-direction: column; }
.field-label { font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.field-input {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s;
  outline: none;
  resize: vertical;
}
.field-input:focus { border-color: var(--primary); }
.field-input.error { border-color: var(--danger); }
.text-muted-label { font-weight: 400; color: var(--muted); }

.form-error {
  background: #fef3f2; border: 1px solid #fecdca;
  color: var(--danger); border-radius: 8px;
  padding: .65rem .85rem; font-size: .85rem;
}

/* ── BUTTONS ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-weight: 600; font-size: .9rem;
  padding: .7rem 1.25rem;
  border-radius: 8px;
  border: none; cursor: pointer;
  transition: opacity .15s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }

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

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--text); }

.btn-danger-outline { border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: #fef3f2; }

.btn-block { width: 100%; }

.btn-spinner {
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.my-3 { margin-top: .75rem; margin-bottom: .75rem; }
.me-1 { margin-right: .25rem; }
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.small { font-size: .85rem; }

/* ── CONFIRMATION ──────────────────────────────────── */
.confirm-icon {
  font-size: 3.5rem;
  color: var(--ok);
  margin-bottom: .75rem;
}
.confirm-details {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 1rem;
  text-align: left;
  font-size: .875rem;
  width: 100%;
}
.confirm-detail-row {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--line);
}
.confirm-detail-row:last-child { border-bottom: none; }
.confirm-detail-row i { color: var(--primary); margin-top: .1rem; width: 1rem; text-align: center; }
.confirm-detail-label { font-size: .78rem; color: var(--muted); display: block; }
.confirm-detail-value { font-weight: 600; }

/* ── BOOKING TOKEN STATUS ──────────────────────────── */
.status-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 600;
  padding: .2rem .7rem;
  border-radius: 100px;
}
.status-confirmed  { background: #ecfdf3; color: #067647; }
.status-pending    { background: #fefce8; color: #854d0e; }
.status-cancelled  { background: #fef2f2; color: #991b1b; }
.status-completed  { background: #eff6ff; color: #1e40af; }
.status-rescheduled{ background: #f0fdf4; color: #166534; }
.status-no_show    { background: #f9fafb; color: #374151; }

hr { border: none; border-top: 1px solid var(--line); }
h2 { margin: 0 0 .5rem; font-size: 1.3rem; }
h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .5rem; line-height: 1.5; }
