/* =========================
   HIDDEN
   ========================= */

[hidden] {
    display: none !important;
}


/* =========================
   FORM PAGE
   ========================= */

.form-page {
    background-color: var(--light-gray);

    padding-top: 28px;
    padding-bottom: 48px;
}

.form-container {
    max-width: 920px;
}


/* =========================
   PAGE HEADING
   ========================= */

.form-page-heading {
    margin-bottom: 24px;
}

.form-page-heading .eyebrow {
    color: var(--orange-text);
    margin-bottom: 6px;
}

.form-page-heading h1 {
    color: var(--navy);

    font-size: clamp(1.8rem, 8vw, 3rem);
    line-height: 1.1;

    margin-bottom: 10px;
}

.form-page-heading > p:last-child {
    max-width: 650px;

    color: var(--medium-gray);

    font-size: 16px;
    line-height: 1.55;
}


/* =========================
   FORM CARD
   ========================= */

.service-form {
    background-color: var(--white);

    border-radius: 16px;

    padding: 20px;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.08);
}

.form-step[hidden] {
    display: none !important;
}


/* =========================
   STEP HEADING
   ========================= */

.step-heading {
    margin-bottom: 24px;
}

.step-number {
    color: var(--orange-text);

    font-size: 13px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.6px;

    margin-bottom: 6px;
}

.step-heading h2 {
    color: var(--navy);

    font-size: 24px;
    line-height: 1.2;
}

/*
   Step headings receive programmatic focus when a new step opens
   so screen-reader users are moved to the new section. Because these
   headings use tabindex="-1", they are not part of normal keyboard
   tab navigation. Suppress only the browser's visual focus ring here.
*/
.step-heading h2[tabindex="-1"]:focus {
    outline: none;
}


/* =========================
   SCREEN READER ONLY
   ========================= */

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}


/* =========================
   LABEL HELPERS
   ========================= */

.required-indicator,
.dynamic-required {
    color: #8f1d16;

    font-size: 13px;
    font-weight: 700;

    margin-left: 4px;
}

.optional {
    color: var(--medium-gray);

    font-size: 13px;
    font-weight: 600;

    margin-left: 3px;
}


/* =========================
   APPLIANCE GRID
   ========================= */

.appliance-selector {
    border: 0;
}

.appliance-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}

.appliance-option {
    position: relative;

    min-height: 116px;

    padding: 14px 8px;

    background-color: var(--light-gray);

    border: 2px solid #e2e8f0;
    border-radius: 14px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 8px;

    text-align: center;

    color: var(--navy);

    font-size: 15px;
    font-weight: 800;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.appliance-option:hover {
    border-color: var(--orange);
}

.appliance-option input {
    position: absolute;

    opacity: 0;

    width: 1px;
    height: 1px;
}

.appliance-option img {
    width: 48px;
    height: 48px;

    object-fit: contain;
}

.appliance-option:has(input:checked) {
    background-color: var(--light-orange);

    border-color: var(--orange);

    box-shadow:
        0 0 0 3px rgba(212, 160, 23, 0.14);
}

.appliance-option:has(input:focus-visible) {
    outline: 3px solid var(--orange);
    outline-offset: 3px;
}


/* =========================
   GENERAL FORM FIELDS
   ========================= */

.form-grid {
    display: grid;

    grid-template-columns: 1fr;

    gap: 18px;
}

.form-field {
    display: flex;

    flex-direction: column;

    gap: 7px;

    margin-top: 20px;
}

.form-field label,
.problem-selector legend,
.contact-preference legend {
    color: var(--navy);

    font-size: 16px;
    font-weight: 800;

    line-height: 1.35;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;

    min-height: 54px;

    padding: 13px 14px;

    background-color: var(--white);
    color: var(--dark);

    border: 2px solid #cbd5e1;
    border-radius: 10px;

    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-field textarea {
    min-height: 140px;

    resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #7b8794;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--orange);

    outline: none;

    box-shadow:
        0 0 0 3px rgba(212, 160, 23, 0.22);
}

.field-help {
    color: var(--medium-gray);

    font-size: 14px;
    line-height: 1.45;
}


/* =========================
   OTHER APPLIANCE
   ========================= */

.other-appliance-field {
    margin-top: 24px;
}


/* =========================
   PROBLEM OPTIONS
   ========================= */

.problem-selector {
    border: 0;

    margin-top: 28px;
}

.problem-selector legend {
    margin-bottom: 4px;
}

.problem-options {
    display: grid;

    grid-template-columns: 1fr;

    gap: 10px;

    margin-top: 14px;
}

.problem-option {
    position: relative;

    min-height: 52px;

    padding: 13px 14px;

    display: flex;
    align-items: center;

    background-color: var(--light-gray);

    border: 2px solid #e2e8f0;
    border-radius: 10px;

    color: var(--navy);

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;
}

.problem-option input {
    width: 20px;
    height: 20px;

    flex: 0 0 20px;

    margin-right: 11px;

    accent-color: var(--orange);
}

.problem-option:has(input:checked) {
    background-color: var(--light-orange);

    border-color: var(--orange);
}


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

.photo-upload-section {
    margin-top: 30px;

    padding: 22px;

    background-color: var(--light-gray);

    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.photo-upload-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 7px;
}

.photo-upload-heading label {
    color: var(--navy);

    font-size: 16px;
    font-weight: 800;

    line-height: 1.35;
}

.photo-count {
    flex-shrink: 0;

    padding: 5px 9px;

    border-radius: 999px;

    background-color: var(--light-orange);

    color: var(--orange-text);

    font-size: 13px;
    font-weight: 800;
}

.photo-help {
    margin-bottom: 14px;
}

#appliance-photo-picker {
    display: block;

    width: 100%;

    min-height: 58px;

    padding: 8px;

    background-color: var(--white);

    border: 2px solid #cbd5e1;
    border-radius: 10px;

    color: var(--dark);

    font-family: inherit;
    font-size: 15px;
}

#appliance-photo-picker:focus {
    border-color: var(--orange);

    outline: none;

    box-shadow:
        0 0 0 3px rgba(212, 160, 23, 0.22);
}

#appliance-photo-picker::file-selector-button {
    min-height: 40px;

    margin-right: 12px;

    padding: 8px 13px;

    border: 0;
    border-radius: 8px;

    background-color: var(--navy);
    color: var(--white);

    font-family: inherit;
    font-size: 14px;
    font-weight: 800;

    cursor: pointer;
}

.photo-error {
    margin-top: 10px;

    color: #8f1d16;

    font-size: 14px;
    font-weight: 700;

    line-height: 1.4;
}

.photo-preview {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;

    margin-top: 16px;
}

.photo-preview:empty {
    display: none;
}

.photo-preview-item {
    position: relative;

    overflow: hidden;

    min-width: 0;

    border-radius: 10px;

    background-color: var(--white);

    border: 1px solid #d8dee6;
}

.photo-preview-item img {
    display: block;

    width: 100%;
    height: 135px;

    object-fit: cover;
}

.photo-preview-meta {
    padding: 8px 10px;

    color: var(--medium-gray);

    font-size: 12px;
    font-weight: 700;
}

.photo-preview-remove {
    position: absolute;

    top: 7px;
    right: 7px;

    width: 38px;
    height: 38px;

    padding: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 2px solid var(--white);
    border-radius: 50%;

    background-color: var(--navy);
    color: var(--white);

    font-size: 21px;
    font-weight: 800;

    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18);
}

.photo-preview-remove:hover {
    opacity: 0.9;
}

.photo-preview-remove:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 2px;
}


/* Internal Netlify fields */

.netlify-photo-input {
    display: none !important;
}


/* =========================
   GOOGLE AUTOCOMPLETE
   ========================= */

.google-address-autocomplete {
    width: 100%;
}

.google-address-autocomplete
gmp-place-autocomplete {
    width: 100%;

    min-height: 54px;
}


/* =========================
   CONTACT OPTIONS
   ========================= */

.contact-preference {
    border: 0;

    margin-top: 28px;
}

.contact-options {
    display: grid;

    grid-template-columns: 1fr;

    gap: 12px;

    margin-top: 12px;
}

.contact-option {
    min-height: 56px;

    padding: 14px 16px;

    display: flex;

    align-items: center;

    background-color: var(--light-gray);

    border: 2px solid #e2e8f0;
    border-radius: 10px;

    color: var(--navy);

    font-size: 16px;
    font-weight: 800;

    cursor: pointer;
}

.contact-option input {
    width: 21px;
    height: 21px;

    flex: 0 0 21px;

    margin-right: 12px;

    accent-color: var(--orange);
}

.contact-option:has(input:checked) {
    background-color: var(--light-orange);

    border-color: var(--orange);
}


/* =========================
   NAVIGATION
   ========================= */

.step-actions {
    display: flex;

    flex-direction: column;

    gap: 14px;

    margin-top: 34px;

    clear: both;
}

.step-actions .button {
    width: 100%;

    min-height: 54px;

    font-size: 16px;
}

.form-back {
    background-color: transparent;

    color: var(--navy);

    border: 2px solid var(--navy);
}

.form-back:hover {
    background-color: var(--navy);

    color: var(--white);
}


/* =========================
   REVIEW
   ========================= */

.request-summary {
    padding: 20px;

    background-color: var(--light-gray);

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    color: var(--dark);

    font-size: 16px;
    line-height: 1.55;
}

.request-summary-row {
    padding-top: 11px;
    padding-bottom: 11px;

    border-bottom: 1px solid #e2e8f0;
}

.request-summary-row:first-child {
    padding-top: 0;
}

.request-summary-row:last-child {
    padding-bottom: 0;

    border-bottom: 0;
}

.request-summary-label {
    display: block;

    color: var(--navy);

    font-size: 13px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.4px;

    margin-bottom: 3px;
}


/* =========================
   VALIDATION
   ========================= */

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
    border-color: #b42318;
}

.appliance-selector.has-error,
.problem-selector.has-error,
.contact-preference.has-error {
    padding: 12px;

    border: 2px solid #b42318;
    border-radius: 10px;
}

.field-error {
    margin-top: 6px;

    color: #8f1d16;

    font-size: 14px;
    font-weight: 700;

    line-height: 1.4;
}


/* =========================
   VERY SMALL MOBILE
   ========================= */

@media (max-width: 359px) {

    .form-page {
        padding-top: 20px;
        padding-bottom: 36px;
    }

    .form-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .service-form {
        padding: 16px;
    }

    .form-page-heading h1 {
        font-size: 1.75rem;
    }

    .step-heading h2 {
        font-size: 21px;
    }

    .appliance-grid {
        gap: 9px;
    }

    .appliance-option {
        min-height: 108px;

        padding: 12px 6px;

        font-size: 14px;
    }

    .appliance-option img {
        width: 44px;
        height: 44px;
    }

    .photo-upload-section {
        padding: 16px;
    }

    .photo-upload-heading {
        align-items: flex-start;
    }

    .photo-preview {
        grid-template-columns: 1fr;
    }
}


/* =========================
   TABLET
   ========================= */

@media (min-width: 600px) {

    .form-page {
        padding-top: 40px;
        padding-bottom: 60px;
    }

    .service-form {
        padding: 32px;
    }

    .form-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .problem-options {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .photo-preview {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .contact-options {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .step-actions {
        flex-direction: row;

        align-items: center;

        justify-content: space-between;
    }

    .step-actions .button {
        width: auto;

        min-width: 180px;
    }

    .step-actions .form-back {
        order: 1;
    }

    .step-actions .button-primary {
        order: 2;
    }

    .single-action .button-primary {
        margin-left: auto;
    }
}


/* =========================
   DESKTOP
   ========================= */

@media (min-width: 1024px) {

    .form-page {
        padding-top: 52px;
        padding-bottom: 72px;
    }

    .service-form {
        padding: 40px;
    }

    .appliance-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));

        gap: 16px;
    }

    .appliance-option {
        min-height: 130px;
    }

    .problem-options {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .photo-upload-section {
        margin-top: 34px;

        padding: 24px;
    }
}

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

.submit-message {
    margin-top: 20px;

    padding: 20px;

    border-radius: 14px;

    font-size: 16px;
    line-height: 1.55;
}

.submit-message h3 {
    margin-bottom: 6px;
}

.submit-success {
    background-color: #edf8f1;

    border: 1px solid #b7dfc5;

    color: #174d2e;
}

.submit-error {
    background-color: #fff1f0;

    border: 1px solid #efb5af;

    color: #8f1d16;

    display: flex;

    flex-direction: column;

    gap: 6px;
}

.submit-error a {
    color: inherit;

    font-weight: 800;

    text-decoration: underline;
}