@import url('/lib/matrix-ui.css');

body[data-theme="sakura-pink"] {
  --tenant-accent: #e95f96;
  --accent: var(--tenant-accent);
  --accent-soft: rgba(233, 95, 150, 0.1);
}

body[data-theme="fresh-mint"],
body[data-theme="peach"],
body[data-theme="skyline"],
body[data-theme="violet"] {
  --tenant-accent: #1fc79f;
  --accent: var(--tenant-accent);
  --accent-soft: rgba(31, 199, 159, 0.1);
}

:root {
  --accent-strong: var(--mx-price);
}

body {
  margin: 0;
  background: var(--mx-bg);
  color: var(--mx-text);
  min-height: 100vh;
}

body.has-customer-tabbar {
  padding-bottom: calc(var(--mx-tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
}

.book-shell {
  margin: 0 auto;
  padding: var(--reits-space-3) var(--reits-space-page-x) var(--reits-space-6);
}

@media (min-width: 768px) {
  body.has-customer-tabbar {
    padding-bottom: 24px;
  }

  .book-shell {
    padding: var(--reits-space-6) var(--reits-space-6) var(--reits-space-10);
  }

  .book-header {
    padding: var(--reits-space-2) 0 var(--reits-space-5);
  }

  .book-main {
    display: grid;
    gap: var(--reits-space-4);
  }

  .book-panel {
    padding: var(--reits-space-6);
  }

  .service-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--reits-space-3);
  }

  #stepSchedule {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    gap: var(--reits-space-4) 28px;
    align-items: start;
  }

  #stepSchedule > h2,
  #stepSchedule > .book-hint {
    grid-column: 1 / -1;
  }

  #stepSchedule .schedule-toolbar,
  #stepSchedule .weekday-row,
  #stepSchedule .date-grid {
    grid-column: 1;
  }

  #stepSchedule .schedule-toolbar {
    margin-bottom: 0;
  }

  #stepSchedule .date-grid {
    margin-bottom: 0;
  }

  #stepSchedule .slot-section:not(.is-hidden) {
    grid-column: 2;
    grid-row: 3 / span 6;
    position: sticky;
    top: 72px;
    align-self: start;
    padding: var(--reits-space-card) var(--reits-space-5);
    background: var(--mx-bg);
    border-radius: var(--mx-radius-lg);
    border: 0.5px solid var(--mx-border);
  }

  #stepSchedule .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.mx-has-page-context .book-header {
    display: none;
  }
}

@media (min-width: 1024px) {
  .service-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.book-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--reits-space-3);
  margin-bottom: 20px;
}

.book-brand {
  display: flex;
  gap: var(--reits-space-3);
  align-items: center;
}

.book-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  color: var(--mx-price);
}

.book-logo svg {
  width: 28px;
  height: 28px;
}

.book-logo.has-image {
  font-size: 0;
}

.book-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
}

.book-header h1 {
  margin: var(--reits-space-1) 0 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.book-tagline {
  margin: var(--reits-space-1) 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.book-staff-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  padding: var(--reits-space-2) var(--reits-space-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.book-staff-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.book-steps {
  display: flex;
  gap: var(--reits-space-2);
  margin-bottom: 16px;
}

.book-progress {
  margin-bottom: 10px;
}

.book-progress-track {
  display: block;
  height: 3px;
  border-radius: var(--mx-radius-pill);
  background: var(--mx-border);
  overflow: hidden;
}

.book-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mx-brand);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.book-step {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: var(--reits-space-3) var(--reits-space-2);
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.book-step.is-done {
  border-color: var(--mx-brand-soft);
  background: var(--mx-brand-soft);
  color: var(--mx-text-2);
}

.book-step.is-active {
  background: var(--mx-brand);
  color: var(--mx-brand-ink);
  border-color: var(--mx-brand);
  font-weight: 600;
}

.book-step.is-done:not(:disabled) {
  cursor: pointer;
}

.book-step.is-done:not(:disabled):hover {
  border-color: var(--mx-brand);
}

.book-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.book-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--reits-space-5);
  box-shadow: var(--shadow);
}

.book-panel.is-hidden {
  display: none;
}

.book-panel h2 {
  margin: 0 0 var(--reits-space-2);
  font-size: 1.1rem;
}

.book-hint {
  margin: 0 0 var(--reits-space-4);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: var(--reits-space-3);
}

.service-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--reits-space-3);
  padding: var(--reits-space-list-row) var(--reits-space-page-x);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  text-align: left;
  background: #fff;
  width: 100%;
  font: inherit;
  color: inherit;
}

.service-card:hover {
  border-color: var(--mx-brand);
}

.service-card.is-selected {
  border-color: var(--mx-brand);
  background: var(--mx-brand-soft);
  box-shadow: inset 0 0 0 1px var(--mx-brand);
}

.service-card:active {
  transform: scale(0.99);
}

.service-card strong {
  display: block;
  font-size: 0.95rem;
}

.service-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: var(--reits-space-1);
}

.service-price {
  font-weight: 700;
  color: var(--mx-price);
  white-space: nowrap;
  font-size: 1rem;
}

.schedule-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--reits-space-3);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--reits-space-2);
  margin-bottom: 16px;
}

.date-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.date-cell.is-muted {
  color: transparent;
  pointer-events: none;
}

.date-cell.is-disabled {
  color: #ccc;
  cursor: not-allowed;
}

.date-cell.is-available {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.date-cell.is-selected {
  background: var(--mx-brand);
  color: var(--mx-brand-ink);
  font-weight: 700;
}

.slot-btn {
  padding: var(--reits-space-3) var(--reits-space-2);
  min-height: 44px;
  border: 0.5px solid var(--mx-border);
  border-radius: var(--mx-radius-md);
  background: var(--mx-surface);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}

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

.slot-btn:hover,
.slot-btn.is-selected {
  border-color: var(--mx-brand);
  background: var(--mx-brand-soft);
  color: var(--mx-brand-ink);
  font-weight: 600;
}

.slot-section h3 {
  margin: 0 0 var(--reits-space-3);
  font-size: 0.95rem;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--reits-space-2);
}

.booking-summary {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: var(--reits-space-list-row) var(--reits-space-page-x);
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.booking-form label {
  display: block;
  margin-bottom: var(--reits-space-3);
}

.intake-fields {
  margin-bottom: 8px;
}

.intake-images input[type="file"] {
  display: block;
  margin-top: 6px;
  font-size: 0.88rem;
}

.intake-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--reits-space-2);
  margin-top: var(--reits-space-2);
}

.intake-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.booking-form .primary-btn,
.book-shell .primary-btn {
  width: 100%;
  margin-top: var(--reits-space-2);
}

.book-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  background: #1a1a1a;
  color: #fff;
  padding: var(--reits-space-3) var(--reits-space-5);
  border-radius: 999px;
  font-size: 0.88rem;
  transition: transform 0.25s;
  z-index: 100;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 640px) {
  .book-shell {
    padding-top: var(--reits-space-8);
  }
}
