/* =========================================================
   BOOK APPOINTMENT PAGE (appointment.html)
   Shared tokens and header/footer live in theme.css.
   Classes used by appointment.js: .success-box, .ai-note,
   .ai-summary; ids: #appointmentMessage, #selectedReports.
========================================================= */

body {
  margin: 0;
  background: var(--bg);
}

/* ================= BANNER ================= */

.appt-hero {
  position: relative;
  overflow: hidden;
  background: var(--grad-hero);
  padding: 56px 6% 120px;
  text-align: center;
}

.appt-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(14, 116, 144, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
  pointer-events: none;
}

.appt-hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.appt-hero h1 {
  font-size: clamp(30px, 5.4vw, 48px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}

.appt-hero p {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 26px;
}

.appt-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.appt-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px 7px 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.appt-steps li span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================= LAYOUT ================= */

.appt-main {
  padding: 0 6% 80px;
}

.appt-layout {
  max-width: 1180px;
  margin: -84px auto 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.appointment-card {
  background: #ffffff;
  padding: 36px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.appt-emergency {
  margin-bottom: 28px;
}

/* ================= FORM BLOCKS ================= */

.form-block {
  border: none;
  margin: 0 0 8px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--border);
}

.form-block + .form-block {
  padding-top: 22px;
}

.form-block-last {
  border-bottom: none;
  padding-bottom: 8px;
}

.form-block legend {
  float: none;
  width: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 16px;
  padding: 0;
}

.block-num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.appointment-card label {
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.label-hint {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.form-control,
.form-select {
  border-radius: 14px;
  padding: 13px 15px;
  border: 1.5px solid var(--border);
  background-color: #fbfdfe;
  font-size: 16px; /* 16px stops iOS from zooming into the field */
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-control::placeholder {
  color: var(--muted-soft);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.14);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* ================= UPLOAD ================= */

.upload-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 2px dashed rgba(14, 116, 144, 0.3);
  background: var(--brand-soft);
  border-radius: var(--radius-md);
  padding: 18px;
}

.upload-icon {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}

.upload-body {
  flex: 1;
  min-width: 0;
}

.appointment-card .upload-title {
  display: block;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 2px;
}

.upload-hint {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#report {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 100%;
  font-size: 14px;
  color: var(--ink-soft);
}

#report::file-selector-button {
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  margin-right: 10px;
  font-weight: 600;
  cursor: pointer;
}

.add-report-btn {
  border: none;
  border-radius: 999px;
  background: var(--success);
  color: #ffffff;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.add-report-btn:hover {
  transform: translateY(-1px);
}

.selected-reports {
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}

.selected-reports > div {
  border-radius: 12px !important;
  padding: 12px 14px !important;
}

/* ================= SUBMIT ================= */

#submitBtn {
  margin-top: 16px;
  padding: 17px 24px;
  font-size: 17px;
}

#submitBtn:disabled {
  opacity: 0.7;
  transform: none;
  cursor: wait;
}

.submit-note {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin: 12px 0 0;
}

#appointmentMessage {
  margin-top: 20px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--danger);
}

#appointmentMessage:empty {
  display: none;
}

.ai-summary {
  max-width: 350px;
  max-height: 100px;
  overflow-y: auto;
  white-space: normal;
  line-height: 1.4;
}

.success-box {
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-left: 6px solid var(--success);
  padding: 24px;
  margin-top: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  color: var(--ink);
  font-weight: 400;
}

.success-box h2 {
  color: var(--success);
  margin-bottom: 15px;
  font-size: 22px;
}

.success-box p {
  font-size: 15.5px;
  margin: 10px 0;
  line-height: 1.6;
}

.success-box strong {
  color: var(--ink);
}

.success-box .ai-note {
  font-size: 13px;
  color: var(--muted);
  background: #f1f5f9;
  border-left: 3px solid #94a3b8;
  border-radius: 8px;
  padding: 10px 12px;
}

/* ================= CONSENT TICK-BOXES (all required) ================= */

.consent-heading {
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  font-size: 14px;
}

.consent-req {
  color: var(--danger);
  font-weight: 700;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.consent-item:hover {
  border-color: var(--brand);
}

.consent-emergency {
  background: #fff7ed;
  border-color: #fdba74;
}

.consent-ai {
  background: #f5f3ff;
  border-color: #c4b5fd;
}

.consent-item:has(.consent-check:checked) {
  border-color: #16a34a;
  background: #f0fdf4;
}

/* the tick-box itself: big, dark border, impossible to miss */
.consent-check {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  cursor: pointer;
  accent-color: var(--brand);
  appearance: auto;
  -webkit-appearance: checkbox;
  outline: 1.5px solid var(--brand);
  outline-offset: 1px;
  border-radius: 4px;
}

.consent-check:focus-visible {
  outline: 3px solid var(--accent);
}

.appointment-card .consent-text {
  flex: 1;
  cursor: pointer;
  line-height: 1.5;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
}

.consent-text small {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: #475569;
}

/* ================= SIDE ================= */

.appt-side {
  display: grid;
  gap: 18px;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.side-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.side-card h3 {
  font-size: 17px;
  margin: 0 0 14px;
}

.side-card p {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 14px;
}

.side-doctor {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--grad-brand);
  border: none;
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}

.side-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 19px;
  flex-shrink: 0;
}

.side-doctor strong {
  display: block;
  font-family: var(--font-head);
  font-size: 16.5px;
}

.side-doctor .side-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 2px;
}

.side-doctor span {
  font-size: 13px;
  opacity: 0.92;
}

.next-list {
  list-style: none;
  counter-reset: next;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.next-list li {
  counter-increment: next;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.next-list li::before {
  content: counter(next);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.next-list b {
  color: var(--ink);
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1000px) {
  .appt-layout {
    grid-template-columns: 1fr;
  }

  .appt-side {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 600px) {
  .appt-hero {
    padding: 32px 5% 96px;
  }

  .appt-hero p {
    font-size: 16px;
  }

  .appt-steps li {
    font-size: 13px;
    padding-right: 12px;
  }

  .appt-main {
    padding: 0 3.5% 56px;
  }

  .appt-layout {
    margin-top: -70px;
  }

  .appointment-card {
    padding: 22px 16px;
    border-radius: var(--radius-lg);
  }

  .appt-emergency {
    padding: 14px;
  }

  .appt-emergency .nx-emergency-icon {
    flex-basis: 34px;
    height: 34px;
    font-size: 17px;
  }

  .form-block legend {
    font-size: 17px;
  }

  .upload-box {
    padding: 14px;
  }

  .upload-icon {
    display: none;
  }

  .add-report-btn {
    width: 100%;
  }

  .appt-side {
    grid-template-columns: 1fr;
  }
}
