﻿/* Base page setup */
body {
    background: #F5F7FA; /* on-brand neutral */
    -webkit-tap-highlight-color: transparent;
}


/* Wrapper and card layout */
.checkin-wrapper {
    min-height: 100vh; /* fallback for iOS < 15.4 */
    min-height: 100dvh; /* safe on mobile address bars */
    display: grid;
    place-items: center;
    padding: 24px;
}

.checkin-card {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Branding */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    text-align: center;
}

    .brand img,
    .brand-logo {
        height: 36px;
        width: auto;
    }

/* Dual-logo layout: SafetyPermit left + tenant logo right (PRD 0028) */
.brand .logo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.brand .logo-container .sp-logo {
    height: 30px;
    width: auto;
}

.brand .logo-container .tenant-logo {
    height: 50px;
    max-width: 160px;
    object-fit: contain;
}

    .brand .brand-text {
        font-weight: 700;
        letter-spacing: .2px;
    }

.brand-greeting {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
}

.brand-notme {
    color: #0A4D82;
    text-decoration: none;
    font-weight: 500;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin-left: 4px;
}

    .brand-notme:hover {
        color: #F16523;
        text-decoration: underline;
    }

/* Titles & subtitles */
.page-title {
    margin: 4px 0 2px 0;
    font-weight: 700;
    font-size: 2.3rem;
}

.page-sub {
    color: #6c757d;
    margin-bottom: 16px;
}

/* Buttons */
.btn-block {
    width: 100%;
    padding-block: 14px; /* bigger tap targets */
    font-weight: 700;
    border-radius: 10px;
}

.btn-primary {
    background-color: #F16523;
    border-color: #F16523;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: #d9561e;
        border-color: #cf501c;
    }


.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

/* Info badge */
.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f5;
    color: #212529;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: .95rem;
    margin: 6px 0;
}

    .info-pill strong {
        font-weight: 800;
        letter-spacing: .3px;
    }

/* Permit context header (compact hierarchical) */
.permit-context {
    margin: 0 0 18px 0;
    padding: 10px 14px;
    border-left: 4px solid #F16523;
    background: #fdf8f5;
    border-radius: 0 6px 6px 0;
}

.permit-context__company {
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.3;
}

.permit-context__details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    margin-top: 2px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}

.permit-context__details > span {
    white-space: nowrap;
}

.permit-context__sep {
    margin: 0 6px;
    color: #adb5bd;
    font-weight: 400;
}

/* Field grid */
.field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 576px) {
    .field-grid--2 {
        grid-template-columns: 1fr 1fr;
    }
}

/* Field styling */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .field label {
        font-weight: 600;
    }

.nudge-top {
    margin-top: 6px;
}

/* Choice list for select page */
.choice-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: border-color 0.15s ease;
}

    .radio-row:hover {
        border-color: #0A4D82; /* Safety Blue */
    }


    .radio-row input[type="radio"] {
        transform: scale(1.2);
    }

.other-wrap {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

/* Validation / error text */
.text-danger {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 4px;
    transition: opacity .15s ease;
}

/* Per-question validation error highlight */
.field.has-validation-error {
    border-left: 3px solid #dc3545;
    padding-left: 12px;
    background: #fff5f5;
    border-radius: 4px;
    padding: 10px 10px 10px 12px;
}

/* Yes/No chips */
.yn-group {
    display: flex;
    gap: 14px;
    margin-top: 6px;
}

.yn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

/* Area checked time inputs row */
.time-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* AM / separator / PM */
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.time-sep {
    opacity: .7;
}

/* Small hint text */
.hint {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 6px;
}

/* small vertical stack utility used near the modal trigger */
.stack {
    display: grid;
}

    .stack.sm-gap {
        gap: 8px;
    }

/* acknowledgement badge */
.ack-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFF3EB; /* soft orange background */
    color: #9A3A06; /* dark orange text */
    border: 1px solid #FFD1B0; /* light orange border */
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.9rem;
    font-weight: 600;
}


/* optional: make modal body comfy to read */
.modal-body p {
    margin-bottom: 0.85rem;
}

/* Terms and conditions box */
.terms-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

    .terms-box-content {
        font-size: 14px;
        line-height: 1.6;
    }

    .terms-box-content p {
        margin-bottom: 0.75rem;
    }

    .terms-box-content p:last-child {
        margin-bottom: 0;
    }

    .terms-box-content h1, .terms-box-content h2, .terms-box-content h3 {
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }

    .terms-box-content h1 { font-size: 1.5rem; }
    .terms-box-content h2 { font-size: 1.25rem; }
    .terms-box-content h3 { font-size: 1.1rem; }

    .terms-box-content ul, .terms-box-content ol {
        margin-bottom: 0.75rem;
        padding-left: 1.5rem;
    }

    .terms-box-content li {
        margin-bottom: 0.25rem;
    }

    .terms-box-content a {
        color: #0d6efd;
        text-decoration: underline;
    }

/* Terms checkbox container */
.terms-checkbox-container {
    margin-top: 20px;
    padding-left: 0;
}

    .terms-checkbox-label {
        display: flex;
        align-items: flex-start;
        cursor: pointer;
    }

    .terms-checkbox-input {
        margin-top: 4px;
        width: 20px;
        height: 20px;
        cursor: pointer;
    }

    .terms-checkbox-text {
        margin-left: 12px;
    }

    .terms-validation-error {
        display: block;
        margin-top: 8px;
    }

/* Alert boxes */
.alert-no-terms {
    margin: 20px 0;
}

    .alert-no-terms p {
        margin: 0;
    }

    .alert-no-terms p:last-child {
        margin: 8px 0 0 0;
        font-size: 14px;
    }

/* Button containers */
.button-container {
    margin-top: 24px;
}

.button-secondary-spacing {
    margin-top: 12px;
}

/* SelectPermit other row */
.other-radio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: border-color 0.15s ease;
}

.other-label {
    margin: 0;
}

.validation-error-block {
    display: block;
    margin-top: 8px;
}

.submit-button-container {
    margin-top: 18px;
}

/* Selection list (check-in index page) */
.selection-list {
    display: grid;
    gap: 10px;
}

.selection-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #e2e6ea;
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.selection-row--clickable {
    cursor: pointer;
}

    .selection-row--clickable:hover,
    .selection-row--clickable:focus {
        border-color: #F16523;
        background: #FFF8F5;
        text-decoration: none;
        color: inherit;
    }

    .selection-row--clickable:active {
        background: #FFF0EA;
    }

.selection-label {
    flex: 0 0 110px;
    color: #6c757d;
    font-weight: 500;
    font-size: 0.9rem;
}

.selection-value {
    flex: 1;
    font-size: 0.95rem;
}

.selection-arrow {
    flex: 0 0 auto;
    font-size: 1.3rem;
    color: #adb5bd;
    margin-left: 8px;
    transition: color 0.15s ease;
}

.selection-row--clickable:hover .selection-arrow {
    color: #F16523;
}

/* --------------------------------------------------------- */
/* Compact question cards                                    */
/* --------------------------------------------------------- */
.question-block {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.question-block.has-error {
    border-color: #dc3545;
}

.question-block__text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.4;
    margin: 0 0 12px 0;
}

.question-block__help {
    font-size: 0.85rem;
    color: #6c757d;
    margin: -4px 0 12px 0;
}

.section-heading {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* --------------------------------------------------------- */
/* Due-diligence / prework styled choice buttons             */
/* --------------------------------------------------------- */
.due-diligence-btn {
    border: 2px solid #dee2e6;
    background: #fff;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 16px;
    min-height: 44px;
    border-radius: 8px;
}

.due-diligence-btn:hover {
    border-color: #0d6efd;
}

.due-diligence-btn.selected-yes {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.due-diligence-btn.selected-no {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.due-diligence-btn.selected-option {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.due-diligence-btn.selected-invalidating {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* Two options: side-by-side on all screen sizes */
.yn-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Three+ options: two-column grid */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Multi-option: stack full width */
.choice-stack {
    display: grid;
    gap: 8px;
}

/* --------------------------------------------------------- */
/* iOS FIXES                                                 */
/* --------------------------------------------------------- */

/* Prevent iOS autofill yellow background */
.checkin-wrapper input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
}

/* Radio and checkbox touch targets for iOS */
.checkin-wrapper input[type="radio"],
.checkin-wrapper input[type="checkbox"] {
    min-width: 24px;
    min-height: 24px;
}

.checkin-wrapper .form-check {
    min-height: 44px;
    display: flex;
    align-items: center;
}

.checkin-wrapper .form-check-label {
    padding-left: 0.25rem;
}

/* --------------------------------------------------------- */
/* 📱 MOBILE OPTIMIZATION: flatten card & reclaim space      */
/* --------------------------------------------------------- */

@media (max-width: 575.98px) {
    .checkin-wrapper {
        padding: 8px;
    }

    .checkin-card {
        max-width: none;
        width: 100%;
        padding: 10px;
        border-radius: 0;
        box-shadow: none;
        background: transparent; /* let page bg show through */
    }

    /* iOS touch target compliance (44px minimum) */
    .checkin-wrapper .form-control,
    .checkin-wrapper .form-select {
        min-height: 44px;
    }

    .brand {
        margin-bottom: 4px;
        gap: 4px;
    }

        .brand img,
        .brand-logo {
            height: 30px;
        }

        .brand .logo-container .sp-logo {
            height: 24px;
        }

        .brand .logo-container .tenant-logo {
            height: 40px;
            max-width: 120px;
        }

    .page-title {
        font-size: 1.6rem;
        margin: 2px 0 8px 0;
    }

    .page-sub {
        margin-bottom: 14px;
    }

    .field-grid {
        gap: 10px;
    }

    .field {
        gap: 4px;
    }

    .btn-block {
        padding-block: 14px; /* still big for “builder fingers” */
    }

    .info-pill {
        padding: 6px 10px;
        font-size: .9rem;
    }

    .radio-row {
        padding: 10px;
    }

    .question-block {
        padding: 14px;
        margin-bottom: 10px;
    }

    .permit-context {
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .permit-context__company {
        font-size: 1rem;
    }

    .permit-context__details {
        font-size: 0.9rem;
    }
}

/* --------------------------------------------------------- */
/* 🖥️ Desktop/tablet: restore card look                      */
/* --------------------------------------------------------- */
@media (min-width: 576px) {
    .checkin-card {
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 8px 30px rgba(0,0,0,.06);
        padding: 28px;
        max-width: 580px;
    }
}
