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

/* ── Design tokens ─────────────────────────────────── */
:root {
  --red:       #DA291C;
  --red-dark:  #B01F15;
  --red-bg:    #FFF4F3;
  --red-bd:    #FAD0CD;
  --white:     #FFFFFF;
  --g50:       #F8F9FA;
  --g100:      #F1F3F5;
  --g200:      #E9ECEF;
  --g300:      #CED4DA;
  --g500:      #6C757D;
  --g700:      #343A40;
  --g900:      #212529;
  --green:     #085F46;
  --green-bg:  #D3F9D8;
  --err-text:  #7D1212;
  --radius:    14px;
  --shadow:    0 3px 20px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14), 0 3px 12px rgba(0,0,0,0.07);
  --font:      'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Accessibility-first sizing */
  --text-base: 18px;
  --text-sm:   16px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --input-h:   54px;
  --btn-h:     54px;
}

/* ── Base ──────────────────────────────────────────── */
html { font-size: var(--text-base); }

body {
  font-family: var(--font);
  background: var(--g100);
  color: var(--g900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────── */
header {
  background: linear-gradient(130deg, #E8251A 0%, var(--red-dark) 100%);
  box-shadow: 0 2px 16px rgba(176,31,21,0.38);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.cross-wrap {
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 8px;
  flex-shrink: 0;
  line-height: 0;
}

.cross-wrap svg { width: 38px; height: 38px; display: block; }

.org-name {
  font-size: var(--text-lg);
  font-weight: 800;
  color: white;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.org-sub {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

.header-hours {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  white-space: nowrap;
}

/* ── Hero ──────────────────────────────────────────── */
.hero {
  position: relative;
  background: url('A-180A3129.jpg') center 40% / cover no-repeat;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.38);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.5rem;
}

.qr-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255,255,255,0.80);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  transition: all 0.14s;
  flex-shrink: 0;
}

.qr-download:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.50);
  color: white;
}

.qr-download svg {
  width: 26px;
  height: 26px;
}

.book-btn {
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 2px 8px rgba(218,41,28,0.4);
  background: white;
  color: var(--red-dark);
}

.book-btn:hover  {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 4px 12px rgba(218,41,28,0.3);
}

.book-btn:active { transform: translateY(0); }

/* ── Main ──────────────────────────────────────────── */
main { flex: 1; padding: 2rem 0 4rem; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Sections ──────────────────────────────────────── */
.section { margin-bottom: 2.5rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--g900);
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: var(--text-sm);
  color: var(--g500);
  margin-bottom: 1rem;
}

/* ── Primary CTA ───────────────────────────────────── */
.book-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: none;
  border-radius: 16px;
  padding: 0 2.5rem;
  height: 72px;
  font-size: var(--text-xl);
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  letter-spacing: -0.01em;
}

.book-btn-icon {
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1;
  margin-top: -2px;
}

.cta-hint {
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  color: var(--g500);
}

/* ── Week nav ──────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 2px solid var(--g300);
  color: var(--g700);
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--text-lg);
  font-weight: 700;
  transition: all 0.13s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.nav-btn:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.nav-btn-today {
  height: 44px;
  padding: 0 1rem;
  background: var(--white);
  border: 2px solid var(--g300);
  color: var(--g700);
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font);
  transition: all 0.13s;
}

.nav-btn-today:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.week-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--g700);
  white-space: nowrap;
  padding: 0 0.25rem;
}

/* ── Calendar card ─────────────────────────────────── */
.calendar-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-hint {
  margin-top: 0.6rem;
  font-size: var(--text-sm);
  color: var(--g500);
  text-align: center;
}

/* ── Timeline loading/error ────────────────────────── */
.tl-loading, .tl-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: var(--text-base);
  color: var(--g500);
}

.tl-error { color: var(--red); }

/* ── Timeline: day headers ─────────────────────────── */
.tl-head {
  display: flex;
  border-bottom: 2px solid var(--g200);
  background: var(--g50);
}

.tl-corner {
  width: 58px;
  flex-shrink: 0;
  border-right: 1px solid var(--g200);
}

.tl-day-head {
  flex: 1;
  text-align: center;
  padding: 0.8rem 0.25rem;
  border-right: 1px solid var(--g300);
}

.tl-day-head:last-child { border-right: none; }

.tl-day-head.is-today { background: linear-gradient(160deg, var(--red-bg), #fff8f7); }

.dh-name {
  display: block;
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--g900);
}

.tl-day-head.is-today .dh-name { color: var(--red); }

.dh-date {
  display: block;
  font-size: var(--text-sm);
  color: var(--g500);
  margin-top: 3px;
}

/* ── Timeline: scroll wrapper (header + body scroll together on mobile) ── */
.tl-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tl-head,
.tl-body {
  min-width: 500px;
}

/* ── Timeline: body ────────────────────────────────── */
.tl-body {
  display: flex;
  height: 576px; /* 8 h × 72 px */
}

.tl-axis {
  width: 58px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--g200);
  background: var(--g50);
}

.tl-hour-lbl {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--g500);
  transform: translateY(-50%);
  pointer-events: none;
}

.tl-lanes {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.tl-lane {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--g300);
  cursor: default;
  background: repeating-linear-gradient(
    to bottom, transparent 35px, var(--g100) 35px, var(--g100) 36px
  );
}

.tl-lane:last-child { border-right: none; }

/* Past hatching */
.past-cover {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(0,0,0,0.04) 0, rgba(0,0,0,0.04) 3px,
    transparent 3px, transparent 8px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── Hour grid lines ───────────────────────────────── */
.tl-hour-line {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: var(--g300);
  pointer-events: none;
  z-index: 1;
}

/* ── Booking blocks ────────────────────────────────── */
.booking-block {
  position: absolute;
  background: linear-gradient(150deg, var(--red) 0%, #C01810 100%);
  border-radius: 8px;
  padding: 6px 8px;
  overflow: hidden;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(218,41,28,0.25);
  cursor: pointer;
  transition: opacity 0.13s;
}

.booking-block:hover { opacity: 0.85; }

.booking-block--mine {
  box-shadow: 0 2px 8px rgba(218,41,28,0.35), inset 0 0 0 2px rgba(255,255,255,0.40);
}

/* Multi-person block */
.booking-block--multi {
  background: linear-gradient(150deg, #C8200F 0%, #9E1810 100%);
}

.bb-avatars {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.bb-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E") center/16px no-repeat;
  border: 1.5px solid rgba(255,255,255,0.50);
  flex-shrink: 0;
  margin-left: -6px;
}

.bb-avatar:first-child { margin-left: 0; }

.bb-avatar-more {
  background-image: none;
  background-color: rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.bb-vol-count {
  font-size: 18px;
  font-weight: 900;
  color: white;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.bb-vol-label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
}

.bb-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bb-time {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.82);
  margin-top: 2px;
}

.bb-cancel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── My bookings ───────────────────────────────────── */
.my-bookings-section .calendar-card {
  padding: 1.5rem;
}

.booking-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border: 2px solid var(--g200);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  background: var(--g50);
  gap: 1rem;
  transition: border-color 0.13s;
}

.booking-card:hover { border-color: var(--g300); }
.booking-card:last-child { margin-bottom: 0; }

.bc-date {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--g900);
}

.bc-time {
  font-size: var(--text-base);
  color: var(--g500);
  margin-top: 4px;
}

.cancel-btn {
  min-height: var(--btn-h);
  padding: 0 1.25rem;
  background: none;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font);
  transition: all 0.13s;
  white-space: nowrap;
  flex-shrink: 0;
}

.cancel-btn:hover { background: var(--red); color: white; }

/* ── Modal overlay ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 95dvh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  background: var(--g100);
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--g500);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.13s;
  z-index: 1;
}

.modal-close:hover { background: var(--g200); color: var(--g900); }

#modal-content { padding: 2rem; }

/* ── Month calendar picker ─────────────────────────── */
.cal-picker {
  border: 2px solid var(--g200);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--g300);
  border-radius: 8px;
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  color: var(--g700);
  line-height: 1;
}

.cal-nav-btn:hover:not(:disabled) { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.cal-nav-btn:disabled { opacity: 0.3; cursor: default; }

.cal-month-label {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--g900);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 0.5rem;
}

.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--g500);
  padding: 0.25rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 8px;
  font-size: var(--text-base);
  font-weight: 600;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  color: var(--g900);
  transition: all 0.12s;
}

.cal-day:hover:not(.cal-day--disabled):not(.cal-day--other) {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-bd);
}

.cal-day--selected {
  background: var(--red) !important;
  color: white !important;
  border-color: var(--red-dark) !important;
  font-weight: 800;
}

.cal-day--today:not(.cal-day--selected) {
  border-color: var(--red);
  color: var(--red);
  font-weight: 800;
}

.cal-day--disabled {
  color: var(--g300);
  cursor: default;
  font-weight: 400;
}

.cal-day--other { visibility: hidden; }

.cal-selected-label {
  margin-top: 0.6rem;
  font-size: var(--text-sm);
  color: var(--g500);
  text-align: center;
  min-height: 1.4em;
}

.cal-selected-label strong {
  color: var(--g900);
  font-weight: 700;
}

/* ── Modal form elements ───────────────────────────── */
.modal-eyebrow {
  display: inline-block;
  background: var(--red-bg);
  color: var(--red);
  font-size: var(--text-sm);
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  margin-bottom: 0.6rem;
  border: 1px solid var(--red-bd);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-title {
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--g900);
  letter-spacing: -0.03em;
  margin-bottom: 1.75rem;
  line-height: 1.1;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--g700);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select {
  width: 100%;
  height: var(--input-h);
  padding: 0 1rem;
  border: 2px solid var(--g300);
  border-radius: 10px;
  font-size: var(--text-lg);
  font-family: var(--font);
  color: var(--g900);
  background: white;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  appearance: auto;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(218,41,28,0.12);
}

/* Side-by-side time fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

.form-row .form-group { margin-bottom: 0; }

.submit-btn {
  width: 100%;
  height: 64px;
  background: linear-gradient(130deg, var(--red) 0%, var(--red-dark) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: var(--text-xl);
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.13s, transform 0.1s;
  box-shadow: 0 4px 16px rgba(218,41,28,0.32);
  letter-spacing: -0.01em;
}

.submit-btn:hover  { opacity: 0.92; }
.submit-btn:active { transform: scale(0.99); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Error message */
.error-msg {
  display: none;
  background: var(--red-bg);
  border: 1.5px solid var(--red-bd);
  border-left: 4px solid var(--red);
  color: var(--err-text);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  margin-top: 0.875rem;
  line-height: 1.4;
}

/* ── Success screen ────────────────────────────────── */
.success-box { text-align: center; padding: 0.5rem 0 0.25rem; }

.success-icon {
  width: 76px;
  height: 76px;
  background: linear-gradient(135deg, #2DC76D, #087F5B);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: white;
  margin: 0 auto 1.25rem;
  box-shadow: 0 4px 20px rgba(8,127,91,0.28);
}

.success-box h3 {
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--g900);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.success-day {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--g700);
  margin-bottom: 0.3rem;
}

.success-time {
  display: inline-block;
  background: var(--red-bg);
  border: 1.5px solid var(--red-bd);
  color: var(--red-dark);
  font-size: var(--text-lg);
  font-weight: 800;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.1rem;
}

.success-name {
  font-size: var(--text-base);
  color: var(--g500);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

/* ── Slot detail list ──────────────────────────────── */
.slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.slot-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--g200);
  border-radius: 10px;
  background: var(--g50);
}

.slot-person--mine {
  border-color: var(--red-bd);
  background: var(--red-bg);
}

.sp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sp-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--g900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-time {
  font-size: var(--text-sm);
  color: var(--g500);
}

.sp-edit-btn {
  font-size: var(--text-sm) !important;
  min-height: 44px !important;
  padding: 0 1rem !important;
  flex-shrink: 0;
}

/* ── Footer ────────────────────────────────────────── */
footer {
  background: var(--white);
  border-top: 1px solid var(--g200);
  text-align: center;
  padding: 1.25rem;
  font-size: var(--text-base);
  color: var(--g500);
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 800px) {
  .calendar-card { border-radius: 0; margin: 0 -1.5rem; }
  .header-hours { display: none; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 700px) {
  .booking-card { flex-direction: column; align-items: flex-start; }
  .cancel-btn { width: 100%; }
}

@media (max-width: 520px) {
  .book-btn { font-size: var(--text-lg); height: 64px; padding: 0 1.75rem; }
  .modal-title { font-size: var(--text-xl); }
  .form-row { grid-template-columns: 1fr; }
  .submit-btn { height: 58px; font-size: var(--text-lg); }
  #modal-content { padding: 1.5rem; }
  .dh-name { font-size: var(--text-sm); }
  .dh-date { font-size: 13px; }
  .tl-corner, .tl-axis { width: 46px; }
}
