
/* ========================================
   Contact Form 7 Styling
   Match Figma Design - Contact Us Page
   ======================================== */

.contact-form-wrapper {
    /* Response message sizing - variables (not hardcoded vw) so the
       breakpoint overrides below always win regardless of how specific the
       status selector (.wpcf7-form.invalid/.sent/etc) that also sets these
       properties happens to be. */
    --cf7-msg-font-size: 0.9vw;
    --cf7-msg-padding: 1vw;
    --cf7-msg-margin-top: 1vw;
}

/* Form Container */
.contact-form-wrapper .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 1vw;
}

.contact-form-wrapper .wpcf7-form[hidden] {
    display: none;
}

/* Form Fields */
.contact-form-wrapper .wpcf7-form-control-wrap {
    display: block;
    position: relative;
    width: 100%;
}

/* Input and Textarea Base Styles */
.contact-form-wrapper input[type='text'],
.contact-form-wrapper input[type='email'],
.contact-form-wrapper input[type='tel'],
.contact-form-wrapper textarea {
    width: 100%;
    border: none;
    border-bottom: 1.5px solid #10417f;
    background: transparent;
    padding: 0.2vw 0;
    font-family: var(--font-body);
    font-size: 1.1vw;
    color: #333333;
    outline: none;
    transition: border-color 0.3s ease;
}

.contact-form-wrapper input[type='text']::placeholder,
.contact-form-wrapper input[type='email']::placeholder,
.contact-form-wrapper input[type='tel']::placeholder,
.contact-form-wrapper textarea::placeholder {
    color: #333333;
    opacity: 1;
    font-family: var(--font-body);
    font-size: 1.1vw;
}

.contact-form-wrapper input[type='text']:focus,
.contact-form-wrapper input[type='email']:focus,
.contact-form-wrapper input[type='tel']:focus,
.contact-form-wrapper textarea:focus {
    border-bottom-color: var(--color-brand-secondary);
}

/* Textarea Specific */
.contact-form-wrapper textarea {
    resize: vertical;
    min-height: 3.1vw;
    height: 4.1vw;
}

/* Labels */
.contact-form-wrapper label {
    display: block;
    font-family: var(--font-body);
    font-size: 1.1vw;
    color: #333333;
    margin-bottom: 0.5vw;
}

/* Submit Button - now rendered as the shared .btn .btn-primary hero button
   (see trac_style_wpcf7_submit_button() in functions.php); only positioning
   inside the vertical form layout needs overriding here. */
.contact-form-wrapper .wpcf7-submit {
    align-self: flex-start;
    border: 1px solid transparent;
}

.contact-form-wrapper .wpcf7-submit:hover {
    border-color: #e86125;
}

/* Validation Messages */
.contact-form-wrapper .wpcf7-not-valid-tip {
    font-size: 0.8vw;
    color: #dc2626;
    margin-top: 0.3vw;
    display: block;
}

/* CF7 6.x puts the submission status as a class on the <form> element
   itself (form.sent / form.invalid / form.failed / form.spam / form.aborted /
   form.unaccepted / form.payment-required), not on .wpcf7-response-output -
   so the status colour has to be selected via that ancestor class. */
.contact-form-wrapper .wpcf7-form.invalid .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.unaccepted .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.payment-required .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.failed .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.spam .wpcf7-response-output,
.contact-form-wrapper .wpcf7-form.aborted .wpcf7-response-output {
    border: 1.5px solid #dc2626;
    background-color: #fef2f2;
    color: #dc2626;
    padding: var(--cf7-msg-padding);
    margin-top: var(--cf7-msg-margin-top);
    border-radius: 0.5vw;
    font-size: var(--cf7-msg-font-size);
}

.contact-form-wrapper .wpcf7-form.sent .wpcf7-response-output {
    border: 1.5px solid #16a34a;
    background-color: #f0fdf4;
    color: #16a34a;
    padding: var(--cf7-msg-padding);
    margin-top: var(--cf7-msg-margin-top);
    border-radius: 0.5vw;
    font-size: var(--cf7-msg-font-size);
}

.contact-form-wrapper .wpcf7-response-output {
    text-align: left;
}

.contact-hero-form .contact-form-wrapper .wpcf7-form {
    gap: 0.55vw;
}

.contact-hero-form .contact-form-wrapper .wpcf7-form > p {
    margin: 0;
}

.contact-hero-form .contact-form-wrapper input[type='text'],
.contact-hero-form .contact-form-wrapper input[type='email'],
.contact-hero-form .contact-form-wrapper input[type='tel'],
.contact-hero-form .contact-form-wrapper textarea,
.contact-hero-form .contact-form-wrapper .solution-picker-toggle {
    padding: 0.1vw 0;
}

.contact-hero-form .contact-form-wrapper textarea {
    min-height: 2.6vw;
    height: 3.3vw;
}

.contact-hero-form .contact-form-wrapper label,
.contact-hero-form .contact-form-wrapper .solution-picker-label {
    margin-bottom: 0.3vw;
}

/* "Thank you" panel that replaces the form on successful submission
   (see initContactFormSuccess() in main.js) */
.contact-form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4vw;
    padding: 0.8vw 1vw;
}

.contact-form-success[hidden] {
    display: none;
}

.contact-form-success__icon {
    color: #16a34a;
    width: 2vw;
    height: 2vw;
    margin-bottom: 0.2vw;
}

.contact-form-success__title {
    font-family: var(--font-body);
    font-size: 1.4vw;
    font-weight: 600;
    line-height: 1.3;
    color: #10417f;
    text-align: center;
    margin: 0;
}

.contact-form-success__text {
    font-family: var(--font-body);
    font-size: 1.1vw;
    line-height: 1.35;
    color: #333333;
    text-align: center;
    margin: 0;
}

@media (max-width: 1024px) {
    .contact-form-success {
        gap: 6px;
        padding: 16px 16px;
    }

    .contact-form-success__icon {
        width: 32px;
        height: 32px;
        margin-bottom: 4px;
    }

    .contact-form-success__title {
        font-size: 22px;
    }

    .contact-form-success__text {
        font-size: 18px;
    }
}

@media (max-width: 540px) {
    .contact-form-success__icon {
        width: 28px;
        height: 28px;
    }

    .contact-form-success__title {
        font-size: 19px;
    }

    .contact-form-success__text {
        font-size: 16px;
    }
}

/* Loading Spinner */
.contact-form-wrapper .wpcf7-spinner {
    position: absolute;
    right: 1vw;
    top: 50%;
    transform: translateY(-50%);
}

.contact-form-wrapper .wpcf7-spinner::before {
    background-color: #111111;
}

/* File Upload Container - Target the wrapper span with specific class names */
.contact-form-wrapper .wpcf7-form-control-wrap:has(input[type='file']),
.contact-form-wrapper .wpcf7-form-control-wrap.cv-upload,
.contact-form-wrapper .wpcf7-form-control-wrap.file-upload {
    position: relative;
    width: 100%;
    display: block;
}

/* Hide the default file input but keep it accessible for clicks */
.contact-form-wrapper input[type='file'],
.contact-form-wrapper input[type='file'].wpcf7-file {
    position: absolute;
    width: 100%;
    height: 6.7vw;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

/* Custom File Upload Visual Button */
.contact-form-wrapper .wpcf7-form-control-wrap:has(input[type='file'])::before,
.contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::before,
.contact-form-wrapper .wpcf7-form-control-wrap.file-upload::before {
    content: '';
    display: block;
    width: 100%;
    height: 6.7vw;
    background-color: #2f5fa0;
    border-radius: 1.3vw;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Upload Icon */
.contact-form-wrapper .wpcf7-form-control-wrap:has(input[type='file'])::after,
.contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::after,
.contact-form-wrapper .wpcf7-form-control-wrap.file-upload::after {
    content: '';
    display: block;
    width: 2.1vw;
    height: 1.7vw;
    background-color: white;
    -webkit-mask-image: url('../../assets/icons/upload-icon.svg');
    mask-image: url('../../assets/icons/upload-icon.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    position: absolute;
    top: 2.6vw;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

/* Hover State */
.contact-form-wrapper
    .wpcf7-form-control-wrap:has(input[type='file']:hover)::before,
.contact-form-wrapper .wpcf7-form-control-wrap.cv-upload:hover::before,
.contact-form-wrapper .wpcf7-form-control-wrap.file-upload:hover::before {
    background-color: #274f87;
}

/* File Selected State (set by JS after a file is chosen) */
.contact-form-wrapper .wpcf7-form-control-wrap.cv-upload.has-file::before,
.contact-form-wrapper .wpcf7-form-control-wrap.file-upload.has-file::before {
    background-color: #1f3f6b;
}

/* "Max. 2MB" hint text, overlaid on the file upload box */
.contact-form-wrapper .file-upload-box {
    position: relative;
    display: block;
    margin-top: 1.5vw;
    /* Collapse the whitespace text node between the file input and the hint
       span so it doesn't add a phantom line box under the upload button. */
    font-size: 0;
}

.contact-form-wrapper .file-upload-hint {
    position: absolute;
    bottom: 1.3vw;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 0.8vw;
    color: white;
    z-index: 1;
    pointer-events: none;
}

/* Focus State (when file input is focused via keyboard) */
.contact-form-wrapper input[type='file']:focus + *,
.contact-form-wrapper
    .wpcf7-form-control-wrap:has(input[type='file']:focus)::before,
.contact-form-wrapper
    .wpcf7-form-control-wrap.cv-upload:has(input:focus)::before,
.contact-form-wrapper
    .wpcf7-form-control-wrap.file-upload:has(input:focus)::before {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}

/* File Name Display - populated by CF7's DOM reflection via [data-reflection-of] */
.contact-form-wrapper .wpcf7-file-name {
    font-family: var(--font-body);
    font-size: 0.9vw;
    color: #10417f;
    margin-top: 0.5vw;
    text-align: center;
    display: block;
}

.contact-form-wrapper .solution-picker {
    position: relative;
    width: 100%;
}

.contact-form-wrapper .solution-picker-label {
    display: block;
    font-family: var(--font-body);
    font-size: 1.1vw;
    color: #333333;
    margin-bottom: 0.5vw;
}

.contact-form-wrapper .solution-picker-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    border-bottom: 1.5px solid #10417f;
    background: transparent;
    padding: 0.2vw 0;
    font-family: var(--font-body);
    font-size: 1.1vw;
    color: #10417f;
    cursor: pointer;
    text-align: left;
}

.contact-form-wrapper .solution-picker-value {
    color: #333333;
    text-align: left;
    min-height: 1.4em;
}

.contact-form-wrapper .solution-picker-chevron {
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.contact-form-wrapper .solution-picker-toggle.is-open .solution-picker-chevron {
    transform: rotate(180deg);
}

/* Floats over the form instead of pushing the fields below it down */
.contact-form-wrapper .solution-picker-panel {
    position: absolute;
    top: calc(100% + 0.5vw);
    left: 0;
    right: 0;
    z-index: 20;
    display: block;
    height: auto;
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.2vw 1.4vw;
    background-color: #2f5fa0;
    border-radius: 1.3vw;
    box-shadow: 0 0.7vw 1.6vw rgba(11, 31, 58, 0.25);
}

.contact-form-wrapper .solution-picker-panel[hidden] {
    display: none;
}

.contact-form-wrapper .solution-picker-title {
    font-family: var(--font-body);
    font-size: 1vw;
    color: white;
    margin-bottom: 0.9vw;
}

.contact-form-wrapper .solution-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: column;
    grid-template-rows: repeat(4, auto);
    column-gap: 1.5vw;
    row-gap: 1.2vw;
}

/* Single-column variant, for shorter option lists (e.g. Carrier Services) */
.contact-form-wrapper .service-options {
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 1.2vw;
}

.contact-form-wrapper .solution-options .wpcf7-list-item,
.contact-form-wrapper .service-options .wpcf7-list-item {
    display: block;
}

.contact-form-wrapper .solution-options label,
.contact-form-wrapper .service-options label {
    display: flex;
    align-items: center;
    gap: 0.6vw;
    margin: 0;
    cursor: pointer;
}

.contact-form-wrapper .solution-options input[type='checkbox'],
.contact-form-wrapper .service-options input[type='checkbox'] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.contact-form-wrapper .solution-options .wpcf7-list-item-label,
.contact-form-wrapper .service-options .wpcf7-list-item-label {
    position: relative;
    padding-left: 1.6vw;
    font-family: var(--font-body);
    font-size: 1vw;
    color: white;
}

.contact-form-wrapper .solution-options .wpcf7-list-item-label::before,
.contact-form-wrapper .service-options .wpcf7-list-item-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1.1vw;
    height: 1.1vw;
    border: 1.5px solid white;
    border-radius: 0.25vw;
    background: transparent;
}

.contact-form-wrapper
    .solution-options
    input[type='checkbox']:checked
    + .wpcf7-list-item-label::before,
.contact-form-wrapper
    .service-options
    input[type='checkbox']:checked
    + .wpcf7-list-item-label::before {
    background-color: #e86224;
    border-color: #e86224;
}

.contact-form-wrapper
    .solution-options
    input[type='checkbox']:checked
    + .wpcf7-list-item-label::after,
.contact-form-wrapper
    .service-options
    input[type='checkbox']:checked
    + .wpcf7-list-item-label::after {
    content: '';
    position: absolute;
    left: 0.28vw;
    top: 38%;
    width: 0.55vw;
    height: 0.3vw;
    border-left: 1.5px solid white;
    border-bottom: 1.5px solid white;
    transform: translateY(-50%) rotate(-45deg);
}

.contact-form-wrapper
    .solution-options
    input[type='checkbox']:focus-visible
    + .wpcf7-list-item-label::before,
.contact-form-wrapper
    .service-options
    input[type='checkbox']:focus-visible
    + .wpcf7-list-item-label::before {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Tablet Styles (max-width: 1024px) */

@media (max-width: 1024px) {
    .contact-form-wrapper {
        --cf7-msg-font-size: 15px;
        --cf7-msg-padding: 16px;
        --cf7-msg-margin-top: 24px;
    }

    .contact-form-wrapper .wpcf7-form {
        gap: 24px;
    }

    .contact-form-wrapper input[type='text'],
    .contact-form-wrapper input[type='email'],
    .contact-form-wrapper input[type='tel'],
    .contact-form-wrapper textarea {
        font-size: 18px;
        padding: 8px 0;
    }

    .contact-form-wrapper textarea {
        min-height: 80px;
        height: 100px;
    }

    .contact-form-wrapper input[type='text']::placeholder,
    .contact-form-wrapper input[type='email']::placeholder,
    .contact-form-wrapper input[type='tel']::placeholder,
    .contact-form-wrapper textarea::placeholder {
        font-size: 18px;
    }

    .contact-form-wrapper label {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .contact-form-wrapper .wpcf7-not-valid-tip {
        font-size: 16px;
    }


    .contact-form-wrapper input[type='file'],
    .contact-form-wrapper input[type='file'].wpcf7-file {
        height: 100px;
    }

    .contact-form-wrapper
        .wpcf7-form-control-wrap:has(input[type='file'])::before,
    .contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::before,
    .contact-form-wrapper .wpcf7-form-control-wrap.file-upload::before {
        height: 100px;
        border-radius: 20px;
    }

    .contact-form-wrapper
        .wpcf7-form-control-wrap:has(input[type='file'])::after,
    .contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::after,
    .contact-form-wrapper .wpcf7-form-control-wrap.file-upload::after {
        width: 36px;
        height: 30px;
        top: 44px;
    }

    .contact-form-wrapper .file-upload-hint {
        bottom: 20px;
        font-size: 14px;
    }

    .contact-form-wrapper .wpcf7-file-name {
        font-size: 15px;
        margin-top: 8px;
    }

    .contact-form-wrapper .solution-picker-label {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .contact-form-wrapper .solution-picker-toggle {
        font-size: 18px;
        padding: 4px 0;
    }

    .contact-form-wrapper .solution-picker-panel {
        top: calc(100% + 8px);
        height: auto;
        max-height: 70vh;
        padding: 20px 22px;
        border-radius: 20px;
    }

    .contact-form-wrapper .solution-options {
        column-gap: 20px;
        row-gap: 14px;
    }

    .contact-form-wrapper .service-options {
        row-gap: 14px;
    }

    .contact-form-wrapper .solution-picker-title {
        font-size: 18px;
        margin-bottom: 14px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label,
    .contact-form-wrapper .service-options .wpcf7-list-item-label {
        font-size: 18px;
        padding-left: 28px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label::before,
    .contact-form-wrapper .service-options .wpcf7-list-item-label::before {
        width: 18px;
        height: 18px;
        border-radius: 4px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label::after,
    .contact-form-wrapper .service-options .wpcf7-list-item-label::after {
        left: 5px;
        width: 9px;
        height: 5px;
    }

    .contact-hero-form .contact-form-wrapper .wpcf7-form {
        gap: 14px;
    }

    .contact-hero-form .contact-form-wrapper input[type='text'],
    .contact-hero-form .contact-form-wrapper input[type='email'],
    .contact-hero-form .contact-form-wrapper input[type='tel'],
    .contact-hero-form .contact-form-wrapper textarea {
        padding: 5px 0;
    }

    .contact-hero-form .contact-form-wrapper textarea {
        min-height: 64px;
        height: 78px;
    }
}

@media (max-width: 540px) {
    .contact-form-wrapper {
        --cf7-msg-font-size: 15px;
        --cf7-msg-padding: 14px;
        --cf7-msg-margin-top: 32px;
    }

    .contact-form-wrapper .wpcf7-form {
        gap: 32px;
    }

    .contact-form-wrapper input[type='text'],
    .contact-form-wrapper input[type='email'],
    .contact-form-wrapper input[type='tel'],
    .contact-form-wrapper textarea {
        font-size: 16px;
        padding: 6px 0;
    }

    .contact-form-wrapper textarea {
        min-height: 60px;
        height: 80px;
    }

    .contact-form-wrapper input[type='text']::placeholder,
    .contact-form-wrapper input[type='email']::placeholder,
    .contact-form-wrapper input[type='tel']::placeholder,
    .contact-form-wrapper textarea::placeholder {
        font-size: 16px;
    }

    .contact-form-wrapper label {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .contact-form-wrapper .wpcf7-not-valid-tip {
        font-size: 14px;
    }


    .contact-form-wrapper input[type='file'],
    .contact-form-wrapper input[type='file'].wpcf7-file {
        height: 80px;
    }

    .contact-form-wrapper
        .wpcf7-form-control-wrap:has(input[type='file'])::before,
    .contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::before,
    .contact-form-wrapper .wpcf7-form-control-wrap.file-upload::before {
        height: 80px;
        border-radius: 16px;
    }

    .contact-form-wrapper
        .wpcf7-form-control-wrap:has(input[type='file'])::after,
    .contact-form-wrapper .wpcf7-form-control-wrap.cv-upload::after,
    .contact-form-wrapper .wpcf7-form-control-wrap.file-upload::after {
        width: 32px;
        height: 26px;
        top: 38px;
    }

    .contact-form-wrapper .file-upload-hint {
        bottom: 16px;
        font-size: 13px;
    }

    .contact-form-wrapper .wpcf7-file-name {
        font-size: 13px;
        margin-top: 6px;
    }

    .contact-form-wrapper .solution-picker-label {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .contact-form-wrapper .solution-picker-toggle {
        align-items: center;
        font-size: 16px;
        min-height: 35px;
        padding: 0;
    }

    .contact-form-wrapper .solution-picker-panel {
        top: calc(100% + 6px);
        height: auto;
        max-height: 70vh;
        padding: 16px 18px;
        border-radius: 16px;
        overflow-y: auto;
    }

    .contact-form-wrapper .solution-options {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        grid-template-rows: none;
        row-gap: 12px;
    }

    .contact-form-wrapper .service-options {
        row-gap: 12px;
    }

    .contact-form-wrapper .solution-picker-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label,
    .contact-form-wrapper .service-options .wpcf7-list-item-label {
        font-size: 16px;
        padding-left: 24px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label::before,
    .contact-form-wrapper .service-options .wpcf7-list-item-label::before {
        width: 16px;
        height: 16px;
        border-radius: 4px;
    }

    .contact-form-wrapper .solution-options .wpcf7-list-item-label::after,
    .contact-form-wrapper .service-options .wpcf7-list-item-label::after {
        left: 4px;
        width: 8px;
        height: 4px;
    }

    .contact-hero-form .contact-form-wrapper .wpcf7-form {
        gap: 14px;
    }

    .contact-hero-form .contact-form-wrapper input[type='text'],
    .contact-hero-form .contact-form-wrapper input[type='email'],
    .contact-hero-form .contact-form-wrapper input[type='tel'],
    .contact-hero-form .contact-form-wrapper textarea {
        padding: 4px 0;
    }

    .contact-hero-form .contact-form-wrapper textarea {
        min-height: 52px;
        height: 68px;
    }
}
