/*
 * Caviera Postcode Checker
 * Responsive layout designed to sit naturally inside Caviera's existing site styling.
 * Typography is inherited from the active theme; layout and CTA treatment are defined here.
 */
.caviera-postcode-checker {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
}

.cpc-copy {
    margin-bottom: 1.1rem;
}

.cpc-heading {
    margin: 0 0 .3rem;
}

.cpc-intro {
    margin: 0;
}

/*
 * Desktop first: postcode input + CHECK POSTCODE always share one line.
 * !important is intentional on width/flex properties to prevent the active
 * theme's generic form/button rules from forcing either control to full width.
 */
.cpc-form {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 1rem;
    width: 100%;
}

.cpc-postcode-input {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 54px;
    padding: .8rem 1rem;
    border: 1px solid currentColor;
    border-radius: 0;
    background: #fff;
    color: inherit;
    font: inherit;
    text-transform: uppercase;
    letter-spacing: .04em;
    box-sizing: border-box;
}

.cpc-postcode-input:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.cpc-submit,
.cpc-result-button {
    min-height: 54px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: .75rem 1.45rem;
    border: 1px solid #1a2c4f !important;
    border-radius: 7px;
    background: #1a2c4f !important;
    color: #fff !important;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    text-transform: uppercase;
    box-shadow: none !important;
    cursor: pointer;
    box-sizing: border-box;
}

.cpc-submit {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 190px;
    max-width: none !important;
}

.cpc-submit:hover,
.cpc-submit:focus,
.cpc-result-button:hover,
.cpc-result-button:focus {
    background: #10203b !important;
    border-color: #10203b !important;
    color: #fff !important;
    text-decoration: none !important;
}

.cpc-submit:disabled {
    opacity: .65;
    cursor: wait;
}

.cpc-status {
    min-height: 1.35em;
    margin-top: .55rem;
    font-size: .92em;
}

.cpc-status.is-error {
    font-weight: 600;
}

/* Successful result status remains available to screen readers without visual clutter. */
.cpc-status.is-success {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.cpc-result {
    margin-top: .9rem;
    padding: .95rem 0 0;
    border: 0;
}

.cpc-result[hidden] {
    display: none !important;
}

.cpc-result-summary {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.cpc-result-icon {
    width: 2rem;
    height: 2rem;
    border: 1px solid #1a2c4f;
    border-radius: 50%;
    color: #1a2c4f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

.cpc-result-text h3,
.cpc-result h3 {
    margin: 0 0 .25rem;
}

.cpc-result-text p,
.cpc-result p {
    margin: 0;
}

/* Result CTA sits full-width beneath the result copy. */
.cpc-result-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    width: 100%;
    margin-top: 1rem;
}

.cpc-result-button {
    width: 100% !important;
    max-width: none !important;
}

.cpc-change {
    align-self: flex-start;
    display: inline-block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .88em;
    line-height: 1.3;
    text-decoration: underline;
    text-transform: uppercase;
    cursor: pointer;
}

/* Desktop/tablet: heading and helper copy can share a line. */
@media (min-width: 768px) {
    .cpc-copy {
        display: flex;
        align-items: baseline;
        gap: 1.5rem;
    }

    .cpc-heading {
        flex: 0 0 auto;
        margin: 0;
    }

    .cpc-intro {
        flex: 1 1 auto;
    }
}

/* Mobile: stack the form controls and keep large touch targets. */
@media (max-width: 767px) {
    .caviera-postcode-checker {
        max-width: 100%;
    }

    .cpc-form {
        flex-direction: column !important;
        gap: .75rem;
    }

    .cpc-postcode-input,
    .cpc-submit,
    .cpc-result-button {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 420px) {
    .cpc-result-summary {
        grid-template-columns: 1fr;
    }

    .cpc-result-icon {
        margin-bottom: -.15rem;
    }
}
