/* appointment.css - booking page and My Appointments (loaded after public.css, uses its variables) */


/* 1. Page area and heading */

/* booking page background: sky blue fading into the page grey */
.appointment-page {
    padding: 2rem 16px 3.5rem;
    background: linear-gradient(to bottom, #DCE6F2 0, var(--page-bg) 340px);
}

.booking-header {
    max-width: var(--max-width);
    margin: 0 auto 1.75rem;
    text-align: center;
}

.booking-header h1 {
    margin-bottom: 0.25rem;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
}

/* subtitle */
.booking-header p {
    margin: 0;
    color: var(--text-soft);
}

/* toggled by appointment.js */
.hidden {
    display: none !important;
}


/* 2. Step indicator */

/* numbered steps joined by a line */
.booking-steps {
    position: relative;
    display: flex;
    justify-content: space-between;
    max-width: 760px;
    margin: 0 auto 2rem;
    padding: 0;
}

/* connecting line */
.booking-steps::before {
    content: "";
    position: absolute;
    top: 18px; /* centre of the circles */
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border);
}

.step {
    position: relative; /* above the line */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
}

/* step circle (not reached yet) */
.step span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 2px solid #C9D2DD;
    border-radius: 50%;
    background: var(--white);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-soft);
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

/* step labels hidden on phones */
.step p {
    display: none;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-soft);
}

/* current step */
.step.active span {
    border-color: var(--navy);
    background: var(--navy);
    color: var(--white);
}
.step.active p {
    color: var(--navy);
    font-weight: 600;
}

/* show step labels from 640px */
@media (min-width: 640px) {
    .step p {
        display: block;
    }
}


/* 3. Layout */

/* phones: steps above the summary */
.booking-layout {
    display: grid;
    gap: 1.25rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* current step card */
.booking-content {
    padding: 1.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* step heading */
.booking-content h2 {
    margin-bottom: 0.25rem;
    font-size: 1.375rem;
}

/* step description */
.section-description {
    margin-bottom: 1.5rem;
    color: var(--text-soft);
}

/* desktop: steps left, 320px summary right */
@media (min-width: 960px) {
    .booking-layout {
        grid-template-columns: 1fr 320px;
        align-items: start;
        gap: 1.5rem;
    }

    .booking-content {
        padding: 2.25rem 2.5rem;
    }
}


/* 4. Service cards */

/* 1 per row on phones, 2 from 640px */
.service-grid {
    display: grid;
    gap: 0.875rem;
}

@media (min-width: 640px) {
    .service-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* service card button */
.service-card {
    display: block;
    width: 100%;
    padding: 1.125rem 1.25rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.service-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: var(--navy);
}

.service-card p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
}

/* hover */
.service-card:hover {
    border-color: var(--sky);
    box-shadow: var(--shadow);
}

/* selected service */
.service-card.selected {
    border-color: var(--navy);
    background: var(--sky-light);
    box-shadow: 0 0 0 3px rgba(79, 163, 224, 0.2);
}
.service-card.selected h3 {
    color: var(--navy-dark);
}


/* 5. Date picker */

/* max 360px wide */
.date-picker-container {
    max-width: 360px;
}

.date-picker-container label {
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.date-picker-container input {
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.date-picker-container input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(79, 163, 224, 0.25);
}


/* 6. Time slots */

/* 3 per row on phones, 5 from 640px */
.time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}

@media (min-width: 640px) {
    .time-slots {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* slot button (created by appointment.js) */
.time-slot {
    min-height: 44px;
    padding: 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

/* hover */
.time-slot:hover {
    border-color: var(--sky);
    background: var(--sky-light);
}

/* selected slot */
.time-slot.selected {
    border-color: var(--navy);
    background: var(--navy);
    color: var(--white);
}

/* time with a small status label underneath */
.time-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}
.slot-note {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* booked or passed: striped, crossed out, not clickable */
.time-slot.unavailable,
.time-slot:disabled {
    border-color: #DCE0E6;
    border-style: dashed;
    background: repeating-linear-gradient(135deg, #F1F3F6 0 6px, #E6E9EE 6px 12px);
    color: #9AA3AE;
    cursor: not-allowed;
}
.time-slot.unavailable .slot-time,
.time-slot:disabled .slot-time {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}
.time-slot.unavailable:hover,
.time-slot:disabled:hover {
    border-color: #DCE0E6;
    background: repeating-linear-gradient(135deg, #F1F3F6 0 6px, #E6E9EE 6px 12px);
}

/* legend above the slots */
.slot-key {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
    color: var(--text-soft);
}
.slot-key li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.slot-key-box {
    width: 18px;
    height: 14px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--white);
}
.slot-key-box.is-selected {
    border-color: var(--navy);
    background: var(--navy);
}
.slot-key-box.is-booked {
    border-style: dashed;
    background: repeating-linear-gradient(135deg, #F1F3F6 0 3px, #E6E9EE 3px 6px);
}


/* 7. Patient details and confirmation */

/* patient details box */
.patient-details-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

/* label left, value right */
.patient-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.patient-detail-row:last-child {
    border-bottom: 0;
}

.patient-detail-row span {
    color: var(--text-soft);
    font-size: 0.9375rem;
}

.patient-detail-row strong {
    font-weight: 600;
    color: var(--navy);
    text-align: right;
}

.profile-note {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-soft);
}

/* missing profile error */
.patient-profile-error {
    padding: 0.875rem 1rem;
    border: 1px solid #FECDCA;
    border-radius: 8px;
    background: #FEF3F2;
    color: var(--error);
}
.patient-profile-error p {
    margin: 0;
}

/* confirmation card */
.confirmation-card {
    text-align: center;
}

/* tick icon */
.confirmation-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-text);
    font-size: 2rem;
    font-weight: 700;
}

/* reference number box */
.confirmation-reference {
    display: inline-flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-bottom: 1.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 10px;
    background: var(--sky-light);
}
.confirmation-reference span {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}
.confirmation-reference strong {
    font-family: var(--font-heading);
    font-size: 1.375rem;
    letter-spacing: 0.04em;
    color: var(--navy);
}

.confirmation-details {
    max-width: 440px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: left;
    overflow: hidden;
}

.confirmation-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.confirmation-row:last-child {
    border-bottom: 0;
}
.confirmation-row span {
    color: var(--text-soft);
}
.confirmation-row strong {
    color: var(--navy);
    text-align: right;
}

.confirmation-note {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    color: var(--text-soft);
}

.confirmation-card .booking-actions {
    justify-content: center;
}


/* 8. Buttons and messages */

/* step buttons, Continue on the right */
.booking-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

/* Back left, Continue right */
.date-actions {
    justify-content: space-between;
}

/* primary button */
.continue-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 1.75rem;
    border: 0;
    border-radius: 8px;
    background: var(--navy);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.continue-button:hover:not(:disabled) {
    background: var(--navy-dark);
}

/* disabled until a choice is made */
.continue-button:disabled {
    background: #A9B6C4;
    cursor: not-allowed;
}

/* outline button */
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    border: 1.5px solid var(--navy);
    border-radius: 8px;
    background: var(--white);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: background-color 0.2s;
}
.back-button:hover {
    background: var(--sky-light);
}

/* error message, hidden when empty */
.booking-error {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    color: var(--error);
}
.booking-error:empty {
    display: none;
}


/* 9. Booking summary */

.booking-summary {
    padding: 1.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* sticky summary on desktop */
@media (min-width: 960px) {
    .booking-summary {
        position: sticky;
        top: calc(var(--header-height) + 1.5rem); /* below the sticky header */
    }
}

.booking-summary h2 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

/* label left, value right */
.summary-row,
.doctor-summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}
.summary-row span,
.doctor-summary span {
    color: var(--text-soft);
}
.summary-row strong,
.doctor-summary strong {
    color: var(--navy);
    text-align: right;
}

/* doctor row */
.doctor-summary {
    border-bottom: 0;
}
.doctor-summary strong {
    color: var(--teal-text);
}


/* 10. My Appointments */

/* max 820px wide */
.my-appointments-container {
    display: grid;
    gap: 1rem;
    max-width: 820px;
    margin: 0 auto;
}

/* appointment card */
.appointment-list-card {
    padding: 1.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.appointment-list-card h2 {
    margin-bottom: 0.25rem;
    font-size: 1.25rem;
}
.appointment-list-card > p {
    margin: 0;
    color: var(--text-soft);
}

/* service left, status right */
.appointment-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.appointment-list-header h2 {
    margin-bottom: 0.125rem;
    font-size: 1.125rem;
}

.appointment-reference {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-soft);
}
.appointment-reference strong {
    color: var(--navy);
    letter-spacing: 0.03em;
}

/* status label */
.appointment-status {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem;
    border-left: 3px solid var(--teal);
    border-radius: 3px;
    background: var(--teal-light);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--teal-text);
}

/* stacked on phones, 3 columns from 640px */
.appointment-list-details {
    display: grid;
    gap: 0.75rem;
    padding-top: 1rem;
}

@media (min-width: 640px) {
    .appointment-list-details {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* label above value */
.appointment-detail {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.appointment-detail span {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-soft);
}
.appointment-detail strong {
    font-weight: 600;
    color: var(--navy);
}

.appointment-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* cancel button (red outline) */
.cancel-appointment-button {
    min-height: 42px;
    padding: 0.5rem 1.25rem;
    border: 1.5px solid var(--error);
    border-radius: 8px;
    background: var(--white);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--error);
    cursor: pointer;
    transition: background-color 0.2s;
}
.cancel-appointment-button:hover:not(:disabled) {
    background: #FEF3F2;
}
.cancel-appointment-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.cancelled-message {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-soft);
}

.my-appointments-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}


/* Booking page (appointment.php) */

.bk-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 16px 4rem;
}
.bk-heading {
    margin-bottom: 1.5rem;
}
.bk-heading h1 {
    margin-bottom: 0.25rem;
}
.bk-heading p {
    margin: 0;
    color: var(--text-soft);
}

/* step card */
.bk-card {
    margin-bottom: 1.25rem;
    padding: 1.5rem 1.25rem;
    border-radius: 12px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.bk-card[hidden] {
    display: none;
}
.bk-card h2 {
    margin-bottom: 0.5rem;
    font-size: 1.375rem;
}
.bk-help {
    margin: 0 0 1rem;
    font-size: 0.9375rem;
    color: var(--text-soft);
}

/* details form fields */
.bk-fields {
    display: grid;
    gap: 0.875rem;
}
.bk-field {
    display: grid;
    gap: 0.35rem;
}
.bk-field[hidden] {
    display: none;
}
.bk-field span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--heading);
}
.bk-field input,
.bk-field select {
    min-height: 52px;
    padding: 0 1rem;
    border: 1.5px solid transparent;
    border-radius: 6px;
    background: #ECEDF3;
    font-size: 1rem;
}
.bk-field input:focus,
.bk-field select:focus {
    border-color: var(--navy);
    background: var(--white);
    outline: none;
}
@media (min-width: 640px) {
    .bk-fields {
        grid-template-columns: 1fr 1fr;
    }
    #id-fields,
    .bk-fields .bk-check,
    .bk-fields .bk-help {
        grid-column: 1 / -1;
    }
}
#id-fields {
    display: grid;
    gap: 0.875rem;
}
#id-fields[hidden],
.bk-help[hidden] {
    display: none;
}

/* text-style button */
.bk-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 700;
    color: var(--navy);
    text-decoration: underline;
    cursor: pointer;
}

/* checkbox with label */
.bk-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.5rem 0;
    font-size: 0.9375rem;
    color: var(--text);
}
.bk-check input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    min-height: 0;
    margin-top: 0.1rem;
}

/* honeypot field, hidden from people */
.bk-trap {
    position: absolute;
    left: -9999px;
}

/* list of problems at the top of the details step */
.bk-alert {
    margin: 0 0 1rem;
    padding: 0.875rem 1.25rem;
    border: 1px solid #F5C2C7;
    border-radius: 6px;
    background: #F8D7DA;
    font-size: 0.9375rem;
    color: #842029;
}
.bk-alert[hidden] {
    display: none;
}
.bk-alert p {
    margin: 0;
}

/* message under a field */
.bk-field-error {
    font-size: 0.8125rem;
    color: var(--error);
}
.bk-field-error:empty {
    display: none;
}
.bk-fields > .bk-field-error {
    grid-column: 1 / -1;
    margin-top: -0.5rem;
}

.bk-error {
    min-height: 1.25rem;
    margin: 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--error);
}
.bk-next {
    min-width: 140px;
}

/* date with prev/next arrows */
.bk-date-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.bk-date-text {
    position: relative;
    display: grid;
}
.bk-label {
    font-size: 0.875rem;
    color: var(--text-soft);
}
.bk-date-text strong {
    font-size: 1.125rem;
    color: var(--navy);
}
/* transparent date input over the label so a tap opens the calendar */
.bk-date-picker {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    opacity: 0;
    cursor: pointer;
}
.bk-arrows {
    display: flex;
    gap: 0.5rem;
}
.bk-arrow {
    display: grid;
    place-items: center;
    width: 46px;
    height: 40px;
    border: 1.5px solid var(--navy);
    border-radius: 6px;
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
}
.bk-arrow:disabled {
    border-color: var(--border);
    color: var(--border);
    cursor: not-allowed;
}
.bk-arrow .icon {
    width: 20px;
    height: 20px;
}

/* doctor row */
.bk-doctor {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}
.bk-doctor strong {
    display: block;
    font-size: 1.125rem;
    color: var(--navy);
}
.bk-doctor span {
    font-size: 0.9375rem;
    color: var(--text-soft);
}

.bk-subheading {
    margin: 1.25rem 0 0.75rem;
    font-size: 1.0625rem !important;
}

/* consultation type options */
.bk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.bk-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 1.1rem;
    border: 1.5px solid var(--navy);
    border-radius: 6px;
    background: var(--white);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
}
.bk-chip .icon {
    width: 20px;
    height: 20px;
}
.bk-chip.is-selected {
    background: var(--navy);
    color: var(--white);
}

/* terms box */
.bk-terms {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: var(--sky-light);
}
.bk-terms h3 {
    margin-bottom: 0.4rem;
    font-size: 1rem;
    color: var(--navy);
}
.bk-terms p {
    margin: 0 0 0.4rem;
    font-size: 0.9375rem;
}

.bk-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.bk-actions .btn {
    width: auto;
    min-width: 140px;
}

/* confirmation card */
.bk-done {
    text-align: center;
}
.bk-done-icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 0.5rem;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-text);
}
.bk-summary {
    margin: 1rem 0;
    text-align: left;
}
.bk-summary div {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.bk-summary dt {
    color: var(--text-soft);
}
.bk-summary dd {
    margin: 0;
    font-weight: 700;
    color: var(--navy);
}
.bk-done .bk-actions {
    justify-content: center;
}

/* disabled until a time is picked and the box is ticked */
.bk-actions .btn:disabled {
    border-color: #B8C2CC;
    background: #B8C2CC;
    cursor: not-allowed;
}

/* review popup */
.bk-review h2 {
    margin-bottom: 0.25rem;
}
.bk-review .bk-summary {
    margin: 0.75rem 0 1rem;
}
.bk-review-back {
    margin-top: 0.625rem;
}

/* hold to confirm: the fill grows while the button is held */
.bk-hold {
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.bk-hold-fill {
    position: absolute;
    inset: 0;
    width: 0;
    background: var(--teal);
    transition: width 0.2s ease-out;
}
.bk-hold.is-holding .bk-hold-fill {
    width: 100%;
    transition: width 1.5s linear;
}
.bk-hold-text {
    position: relative;
}
