/*
 * Prism Health appointment booking — theme layer on top of Bootstrap 5.3.
 * Bootstrap is loaded first; everything here is an intentional override.
 */

:root {
    --prism-navy: #002855;
    --prism-navy-light: #0d3b6e;
    --prism-navy-lighter: #1a4c85;
    --prism-blue: #2a7de1;
    --prism-blue-dark: #1a6bcf;
    --prism-text: #f0f0f0;
    --prism-muted: #6c757d;
}

/* --- Layout ------------------------------------------------------------- */

body {
    background-color: var(--prism-navy);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

h1, h2, h3, h4 {
    font-weight: 700;
}

fieldset {
    border: 0;
    min-width: 0; /* Lets flex/grid children shrink inside a fieldset. */
}

#logo {
    max-height: 60px;
    width: auto;
}

.footer-logo {
    max-height: 50px;
}

/* Phone only — centre and shrink the logo. */
@media (max-width: 600px) {
    .logo-wrapper {
        width: 100%;
        text-align: center;
    }

    .logo-wrapper #logo {
        width: 50%;
        max-height: none;
        padding-bottom: 1rem;
    }
}

footer {
    background-color: var(--prism-navy);
}

/* --- Loading overlay ---------------------------------------------------- */

#loadingOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    z-index: 9999;
}

#loadingOverlay #loadingMessage {
    color: #000;
}

/* --- Status banner ------------------------------------------------------ */

#appAlert {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* --- Forms -------------------------------------------------------------- */

.form-label,
.form-check-label,
.accordion-body p,
.accordion-body li {
    color: var(--prism-text);
}

.form-control,
.form-select {
    background-color: #fff;
    color: #212529;
    border: 1px solid #ced4da;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    color: #212529;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control::placeholder {
    color: var(--prism-muted);
    opacity: 1;
}

.consent-fineprint {
    font-size: 0.7rem;
    color: #adb5bd;
}

.service-picker {
    background-color: var(--prism-navy-light);
}

.service-picker h5,
.service-picker .form-check-label {
    color: #fff;
}

/* --- Signature ---------------------------------------------------------- */

.signature-canvas {
    width: 100%;
    max-width: 600px;
    height: 180px;
    background-color: #fff;
    border-radius: 0.25rem;
    /* Stops the browser scrolling the page while drawing on a touch screen. */
    touch-action: none;
}

.typed-signature {
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    border: none;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
}

/* Compact typed-name fallback inside an additional signature block. */
.typed-signature-sm {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    max-width: 18rem;
}

.additional-signature {
    background-color: var(--prism-navy-light);
    border-color: var(--prism-blue) !important;
}

.nav-tabs .nav-link {
    color: var(--prism-text);
}

.nav-tabs .nav-link.active {
    background-color: var(--prism-navy-light);
    border-color: var(--prism-blue) var(--prism-blue) transparent;
    color: #fff;
}

/* --- Accordions --------------------------------------------------------- */

.accordion-button {
    background-color: var(--prism-navy-light);
    color: #fff;
}

.accordion-button:not(.collapsed) {
    background-color: var(--prism-navy-lighter);
    color: #fff;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.accordion-body {
    background-color: var(--prism-navy);
    color: var(--prism-text);
    /* The privacy notice is long; keep it scrollable rather than pushing the
       submit button several screens down. */
    max-height: 60vh;
    overflow-y: auto;
}

/* --- Buttons ------------------------------------------------------------ */

.btn-primary {
    background-color: var(--prism-blue);
    border-color: var(--prism-blue);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--prism-blue-dark);
    border-color: var(--prism-blue-dark);
}

.btn-outline-secondary {
    color: #fff;
    border-color: #fff;
}

.btn-outline-secondary:hover {
    background-color: #fff;
    color: var(--prism-navy);
}

/* --- Appointment slots -------------------------------------------------- */

#slotsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.slot-item {
    border: 1px solid var(--prism-blue);
    background-color: transparent;
    color: var(--prism-text);
    padding: 10px;
    text-align: center;
    border-radius: 20px;
    transition: background-color 0.2s, opacity 0.2s;
}

.slot-open {
    cursor: pointer;
}

.slot-open:hover,
.slot-open:focus-visible {
    background-color: var(--prism-blue);
    color: #fff;
}

.slot-selecting {
    opacity: 0.6;
    cursor: progress;
}

.slot-taken,
.slot-item:disabled {
    border-color: var(--prism-muted);
    color: var(--prism-muted);
    background-color: #343a40;
    cursor: not-allowed;
}

#timer {
    font-variant-numeric: tabular-nums;
}

#timer.timer-warning {
    color: #ffc107;
}

/* --- Event cards -------------------------------------------------------- */

.event-card-link {
    text-decoration: none;
}

.event-card {
    background-color: var(--prism-navy-light);
    border: 1px solid var(--prism-blue);
    height: 100%;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.event-card-link:hover .event-card {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(42, 125, 225, 0.4);
}

.event-card-past {
    background-color: #343a40;
    border-color: var(--prism-muted);
    color: var(--prism-muted);
}

/* --- Confirmation ------------------------------------------------------- */

#confQrCode {
    max-width: 220px;
    height: auto;
}

/* --- Motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .event-card,
    .slot-item {
        transition: none;
    }

    .event-card-link:hover .event-card {
        transform: none;
    }
}
