/* ==========================================================
   UCTH appointment section
   Everything is scoped under .apt-section so it cannot clash
   with Tailwind / Bootstrap / home.css.
   ========================================================== */

.apt-section {
    --apt-blue: #2CAEED;
    --apt-blue-deep: #0d6fa8;
    --apt-navy: #0a3552;
    --apt-ink: #1b2a3a;
    --apt-label: #33475b;
    --apt-muted: #6b7f92;
    --apt-line: #d9e4ee;
    --apt-field: #f6fafd;
    --apt-danger: #d64545;

    position: relative;
    padding: 56px 16px 64px;
    background: linear-gradient(180deg, #ffffff 0%, #eef7fc 100%);
    overflow: hidden;
    box-sizing: border-box;
}
.apt-section *,
.apt-section *::before,
.apt-section *::after { box-sizing: border-box; }

.apt-shell {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

/* ---------- form card ---------- */
.apt-card {
    background: #fff;
    border: 1px solid var(--apt-line);
    border-radius: 20px;
    padding: 36px 36px 32px;
    box-shadow: 0 18px 50px rgba(10, 53, 82, 0.10);
    scroll-margin-top: 100px; /* keeps the card clear of the fixed navbar on #appointment jumps */
}

.apt-head {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 28px;
}
.apt-head-icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--apt-blue), var(--apt-blue-deep));
}
.apt-head-icon svg { width: 26px; height: 26px; }
.apt-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.6vw, 1.8rem);
    line-height: 1.2;
    font-weight: 700;
    color: var(--apt-navy);
}
.apt-sub {
    margin: 4px 0 0;
    font-size: 0.95rem;
    color: var(--apt-muted);
}

/* ---------- groups ---------- */
.apt-group { margin: 0 0 26px; padding: 0; border: 0; min-width: 0; }
.apt-group-title {
    display: block;
    width: 100%;
    margin: 0 0 14px;
    padding: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--apt-navy);
    border-bottom: 2px solid #e6f3fb;
}
.apt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}
.apt-span-2 { grid-column: 1 / -1; }

/* ---------- fields ---------- */
.apt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.apt-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--apt-label);
}
.apt-req { color: var(--apt-danger); margin-left: 2px; }

.apt-control { position: relative; }
.apt-ico {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: #93a7b9;
    pointer-events: none;
    transition: color 0.2s ease;
}
.apt-control:focus-within .apt-ico { color: var(--apt-blue); }
.apt-control--area .apt-ico { top: 16px; transform: none; }

.apt-input,
.apt-select,
.apt-textarea {
    width: 100%;
    margin: 0;
    padding: 0 14px 0 44px !important;
    height: 48px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--apt-ink);
    background-color: var(--apt-field);
    border: 1.5px solid var(--apt-line);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.apt-input::placeholder,
.apt-textarea::placeholder { color: #9aacbc; }

.apt-input:hover,
.apt-select:hover,
.apt-textarea:hover { border-color: #b9cddd; }

.apt-input:focus,
.apt-select:focus,
.apt-textarea:focus {
    background-color: #fff;
    border-color: var(--apt-blue);
    box-shadow: 0 0 0 4px rgba(44, 174, 237, 0.18);
}
/* only flag a field once the person has typed something invalid */
.apt-input:not(:placeholder-shown):invalid {
    border-color: var(--apt-danger);
    box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.12);
}

.apt-textarea {
    height: auto;
    min-height: 140px;
    padding: 14px 14px 14px 44px;
    line-height: 1.5;
    resize: vertical;
}
.apt-hint { font-size: 0.8rem; color: var(--apt-muted); margin: 0; }

/* ---------- gender pills ---------- */
.apt-seg { margin: 0; padding: 0; border: 0; min-width: 0; }
.apt-seg-row { display: flex; gap: 10px; }
.apt-pill { position: relative; flex: 1; cursor: pointer; }
.apt-pill input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}
.apt-pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    border: 1.5px solid var(--apt-line);
    border-radius: 12px;
    background: var(--apt-field);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--apt-label);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.apt-pill:hover span { border-color: #b9cddd; }
.apt-pill input:checked + span {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--apt-blue), var(--apt-blue-deep));
}
.apt-pill input:active + span { transform: scale(0.97); }
.apt-pill input:focus-visible + span { box-shadow: 0 0 0 4px rgba(44, 174, 237, 0.3); }

/* ---------- submit ---------- */
.apt-actions { margin-top: 8px; }
.apt-submit {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--apt-blue), var(--apt-blue-deep));
    box-shadow: 0 10px 24px rgba(13, 111, 168, 0.30);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.apt-submit svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
}
.apt-submit::after {          /* light sweep on hover */
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
}
.apt-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(13, 111, 168, 0.38); }
.apt-submit:hover svg { transform: translateX(4px); }
.apt-submit:hover::after { left: 130%; transition: left 0.7s ease; }
.apt-submit:active { transform: translateY(0) scale(0.99); }
.apt-submit:focus-visible { outline: 3px solid rgba(44, 174, 237, 0.5); outline-offset: 3px; }
.apt-submit:disabled { filter: grayscale(0.4); opacity: 0.7; cursor: not-allowed; transform: none; }
.apt-note { margin: 12px 0 0; text-align: center; font-size: 0.82rem; color: var(--apt-muted); }

/* ---------- contact panel ---------- */
.apt-call {
    position: relative;
    overflow: hidden;
    color: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    background: linear-gradient(160deg, var(--apt-navy) 0%, #0f5f92 100%);
    box-shadow: 0 18px 50px rgba(10, 53, 82, 0.22);
}
.apt-call::before {
    content: "";
    position: absolute;
    right: -70px;
    top: -70px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(44, 174, 237, 0.35), transparent 70%);
}
.apt-call-title { position: relative; margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; color: #fff; }
.apt-call-sub { position: relative; margin: 0 0 20px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.75); }
.apt-call-list { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.apt-call-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.apt-call-link:hover { background: rgba(255, 255, 255, 0.16); transform: translateX(4px); color: #fff; }
.apt-call-link:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
.apt-call-ico {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
}
.apt-call-ico svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.apt-call-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.apt-call-text small { font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); }
.apt-call-text strong { font-size: 1rem; font-weight: 700; letter-spacing: 0.01em; }

/* the one persistent bit of motion: a live pulse on the emergency line */
.apt-call-link--emergency { background: rgba(214, 69, 69, 0.28); border-color: rgba(255, 140, 140, 0.45); }
.apt-call-link--emergency .apt-call-ico { background: #d64545; position: relative; }
.apt-call-link--emergency .apt-call-ico::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 2px solid #ff8f8f;
    animation: aptPulse 1.8s ease-out infinite;
}
@keyframes aptPulse {
    0%   { transform: scale(1);   opacity: 0.9; }
    100% { transform: scale(1.6); opacity: 0; }
}

.apt-social { position: relative; display: flex; gap: 10px; margin-top: 22px; }
.apt-social a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--apt-navy);
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.apt-social a:hover { transform: translateY(-3px); background: #e6f5fd; }
.apt-social a:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; }

/* ---------- page-load reveal (one sequence, runs once) ---------- */
.apt-section.apt-js .apt-card,
.apt-section.apt-js .apt-call,
.apt-section.apt-js .apt-group {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.apt-section.apt-js.apt-in .apt-card,
.apt-section.apt-js.apt-in .apt-call { opacity: 1; transform: none; }
.apt-section.apt-js.apt-in .apt-call { transition-delay: 0.25s; }
.apt-section.apt-js.apt-in .apt-group {
    opacity: 1;
    transform: none;
    transition-delay: calc(0.15s + var(--i, 0) * 0.09s);
}

/* ---------- responsive ---------- */
@media (max-width: 991px) {
    .apt-shell { grid-template-columns: 1fr; }
    .apt-call-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .apt-section { padding: 36px 12px 44px; }
    .apt-card { padding: 24px 18px 22px; border-radius: 16px; }
    .apt-call { padding: 26px 18px; border-radius: 16px; }
    .apt-grid { grid-template-columns: 1fr; }
    .apt-head { align-items: flex-start; }
    .apt-call-list { grid-template-columns: 1fr; }
    /* 16px stops iOS Safari zooming the page when a field is focused */
    .apt-input, .apt-select, .apt-textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .apt-section *,
    .apt-section *::before,
    .apt-section *::after {
        animation: none !important;
        transition: none !important;
    }
    .apt-section.apt-js .apt-card,
    .apt-section.apt-js .apt-call,
    .apt-section.apt-js .apt-group { opacity: 1; transform: none; }
}