/* ── Tokens ── */
:root {
  --navy: #0F172A;
  --navy-light: #1E293B;
  --navy-mid: #334155;
  --slate: #64748B;
  --slate-light: #94A3B8;
  --ice: #F1F5F9;
  --white: #FFFFFF;
  --indigo: #6366F1;
  --indigo-rgb: 99, 102, 241;
  --indigo-light: #818CF8;
  --emerald: #10B981;
  --emerald-dark: #059669;
  --emerald-bg: rgba(16, 185, 129, .08);
  --amber: #F59E0B;
  --red: #EF4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.08);
  --font-heading: 'Fraunces', serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--ice);
  color: var(--navy);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── App Shell ── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 32px;
  min-height: 100dvh;
}

/* ── Step Management ── */
.step { display: none; animation: fadeUp .35s ease both; }
.step.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading Page ── */
.loading-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 16px; color: var(--slate);
}

/* ── Error Page ── */
.error-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; padding: 40px 20px;
}
.error-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(239,68,68,.08); color: var(--red);
  display: grid; place-items: center; margin-bottom: 20px;
}
.error-page h2 { font-family: var(--font-heading); margin-bottom: 8px; }
.error-page p { color: var(--slate); margin-bottom: 24px; }

/* ── Step Header ── */
.step-header { padding: 24px 0 16px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand-icon {
  width: 44px; height: 44px;
  background: var(--indigo);
  border-radius: 12px;
  display: grid; place-items: center;
  color: white;
  flex-shrink: 0;
}
.brand h1 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -.02em;
}
.brand-address {
  font-size: .8rem;
  color: var(--slate);
  margin-top: 2px;
}
.step-subtitle { color: var(--slate); font-size: .95rem; margin-top: 4px; }

h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--indigo);
  font-weight: 500; font-size: .9rem;
  margin-bottom: 12px;
  padding: 4px 0;
  transition: opacity var(--transition);
}
.back-btn:hover { opacity: .7; }

/* ── Calendar ── */
.calendar-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.calendar-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.calendar-nav button {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--navy);
  background: var(--ice);
  transition: background var(--transition);
}
.calendar-nav button:hover { background: #E2E8F0; }
.calendar-nav button:disabled { opacity: .3; pointer-events: none; }
.month-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
  text-transform: capitalize;
}
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: .75rem; font-weight: 500;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Day Cell */
.day-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  gap: 2px;
}
.day-cell:hover:not(.day--disabled):not(.day--empty) {
  background: var(--ice);
  transform: scale(1.05);
}
.day-cell.day--today {
  border-color: var(--indigo);
  background: rgba(var(--indigo-rgb), .06);
}
.day-cell.day--selected {
  background: var(--indigo) !important;
  color: white !important;
  border-color: var(--indigo);
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(var(--indigo-rgb), .35);
}
.day-cell.day--selected .day-discount { color: rgba(255,255,255,.7); }
.day-cell.day--disabled {
  color: var(--slate-light);
  opacity: .35;
  cursor: not-allowed;
  text-decoration: line-through;
}
.day-cell.day--empty { cursor: default; }

.day-discount {
  font-size: .6rem;
  font-weight: 700;
  color: var(--emerald-dark);
  letter-spacing: .02em;
  line-height: 1;
}
.day-cell.day--has-discount {
  background: var(--emerald-bg);
}

/* ── Legend ── */
.legend {
  display: flex; gap: 16px; justify-content: center;
  font-size: .8rem; color: var(--slate);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot--discount { background: var(--emerald); }
.legend-dot--closed { background: var(--slate-light); opacity: .4; }

/* ── Selected Info ── */
.selected-info {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px;
}
.selected-date-chip, .discount-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: .85rem; font-weight: 600;
}
.selected-date-chip {
  background: var(--navy);
  color: var(--white);
}
.discount-chip {
  background: var(--emerald);
  color: var(--white);
}

/* ── Time Grid ── */
.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  min-height: 120px;
}
.time-slot {
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
  border: 2px solid transparent;
}
.time-slot:hover:not(.time-slot--full) {
  border-color: var(--indigo);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.time-slot:active:not(.time-slot--full) { transform: scale(.97); }
.time-slot--full {
  opacity: .35;
  cursor: not-allowed;
  text-decoration: line-through;
}
.time-slot .remaining {
  display: block;
  font-size: .7rem;
  font-weight: 400;
  color: var(--slate);
  margin-top: 2px;
}
.time-slot--low .remaining { color: var(--amber); }
.time-slot--full .remaining { color: var(--red); }

/* ── Booking Summary Card ── */
.booking-summary-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex; flex-wrap: wrap; gap: 12px;
}
.summary-item {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem;
}
.summary-item svg { color: var(--indigo); flex-shrink: 0; }
.summary-item strong { font-weight: 600; }
.summary-discount {
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 700;
}

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy);
}
.form-group .optional { font-weight: 400; color: var(--slate); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--navy);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--slate-light); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(var(--indigo-rgb), .15);
}
.form-group input.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.form-group textarea { resize: vertical; min-height: 60px; }

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--indigo);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: all var(--transition);
  margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  background: var(--ice);
  color: var(--navy);
  font-size: .95rem;
  font-weight: 600;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-secondary:hover { background: #E2E8F0; }

.btn-text { display: inline; }
.btn-loading { display: inline-flex; align-items: center; gap: 6px; }

/* ── Confirmation ── */
.confirm-content {
  text-align: center;
  padding-top: 60px;
}
.confirm-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald);
  display: grid; place-items: center;
  margin: 0 auto 20px;
  animation: popIn .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confirm-content h2 { margin-bottom: 6px; }
.confirm-sub { color: var(--slate); margin-bottom: 24px; font-size: .95rem; }
.confirm-details {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
}
.confirm-details .detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ice);
  font-size: .9rem;
}
.confirm-details .detail-row:last-child { border-bottom: none; }
.confirm-details .detail-label { color: var(--slate); }
.confirm-details .detail-value { font-weight: 600; }
.confirm-details .detail-discount {
  color: var(--emerald-dark);
  font-weight: 700;
}

/* ── Loading ── */
.loading-spinner {
  grid-column: 1 / -1;
  display: flex; justify-content: center; padding: 40px 0;
}
.loading-spinner::after {
  content: '';
  width: 28px; height: 28px;
  border: 3px solid var(--ice);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner-sm { display: inline-block; width: 16px; height: 16px; }
.spinner-sm::after {
  content: '';
  display: block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Toast Notification ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 1000;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.toast.toast--error { background: var(--red); }
.toast.toast--visible { transform: translateX(-50%) translateY(0); }

/* ── Manage Booking ── */
.manage-current-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}
.manage-current-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.manage-current-card .detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ice);
  font-size: .9rem;
}
.manage-current-card .detail-row:last-child { border-bottom: none; }
.manage-current-card .detail-label { color: var(--slate); }
.manage-current-card .detail-value { font-weight: 600; text-align: right; }
.manage-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 700;
}
.manage-status-badge.status-pending { background: #FEF3C7; color: #92400E; }
.manage-status-badge.status-confirmed { background: #D1FAE5; color: #065F46; }
.manage-status-badge.status-cancelled { background: #FEE2E2; color: #991B1B; }
.manage-status-badge.status-no_show { background: #E5E7EB; color: #374151; }

.manage-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.manage-section-danger {
  color: var(--red);
}
.manage-info-box {
  background: #DBEAFE;
  border: 1px solid #93C5FD;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: .85rem;
  color: #1E40AF;
  line-height: 1.5;
}
.manage-cancel-text {
  color: var(--slate);
  font-size: .9rem;
  margin-bottom: 16px;
}
.manage-divider {
  height: 1px;
  background: var(--ice);
  margin: 32px 0;
}
.btn-danger {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  transition: all var(--transition);
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-danger:active { transform: scale(.98); }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Responsive ── */
@media (max-width: 380px) {
  .calendar-grid { gap: 4px; }
  .day-cell { font-size: .85rem; }
  .time-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 481px) {
  #app { padding-top: 16px; }
}
