/* ═══════════════════════════════════════════════════════════════════════════
   POPUP OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.popup-overlay {
    min-height: 100vh;
    background: var(--second-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    position: relative;
}

/* ─── Close button ───────────────────────────────────────────────────────── */

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 40px;
    opacity: 0.6;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.popup-close > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

.popup-close__icon {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close__icon img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POPUP CARD
═══════════════════════════════════════════════════════════════════════════ */

.popup-card {
    background: var(--white);
    width: 650px;
    max-width: 100%;
    padding: 60px 80px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
}

/* ─── Decorative mask at top ─────────────────────────────────────────────── */

.popup-card__mask-wrap {
    position: absolute;
    left: 0;
    right: 0;
    top: -40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.popup-card__mask-inner {
    width: 100%;
    height: 100%;
    transform: rotate(180deg) scaleX(-1);
    position: relative;
    flex-shrink: 0;
}

.popup-card__mask-inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

/* ─── Text block ─────────────────────────────────────────────────────────── */

.popup-card__text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.popup-card__title {
    font-family: var(--font-plus);
    font-weight: 700;
    font-size: 39px;
    line-height: 1;
    color: var(--black);
}

.popup-card__subtitle {
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 20px;
    line-height: 1.5;
    color: var(--black-70);
}

/* ═══════════════════════════════════════════════════════════════════════════
   POPUP FORM
═══════════════════════════════════════════════════════════════════════════ */

.popup-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 440px;
}

.modal--free-estimate .wpcf7 {
    width: 100%;
}

.modal--free-estimate .wpcf7-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    gap: 20px;
    margin: 0;
}

.modal--free-estimate .wpcf7 p {
    margin: 0;
}

.modal--free-estimate .wpcf7-form-control-wrap {
    display: block;
}

/* ─── Input row ──────────────────────────────────────────────────────────── */

.popup-form__row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.popup-input-wrap {
    flex: 1;
    border-bottom: 1px solid var(--black-30);
    padding: 20px 0;
}

.modal--free-estimate .popup-input-wrap {
    border-bottom: 0;
    padding: 0;
}

.popup-input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1;
    color: var(--black-30);
}

.modal--free-estimate .popup-input {
    border-bottom: 1px solid var(--black-30);
    padding: 20px 0;
}

.modal--free-estimate .popup-input:focus {
    border-bottom-color: var(--black-70);
}

.popup-input::placeholder {
    color: var(--black-30);
}

.popup-input-wrap.is-invalid,
.popup-dropdown__top.is-invalid {
    border-color: #d64b4b;
}

.popup-input.is-invalid {
    color: var(--black);
}

.modal--free-estimate .popup-input.wpcf7-not-valid,
.modal--free-estimate .popup-dropdown__select.wpcf7-not-valid {
    border-bottom: 1px solid #d64b4b;
    color: var(--black);
}

.modal--free-estimate .wpcf7-not-valid {
    color: var(--black);
}

.modal--free-estimate .wpcf7-not-valid-tip {
    display: none;
}

/* ─── Dropdown ───────────────────────────────────────────────────────────── */

.popup-dropdown {
    width: 100%;
    border-bottom: 1px solid var(--black-30);
    position: relative;
}

.modal--free-estimate .popup-dropdown {
    border-bottom: 0;
}

.modal--free-estimate .popup-dropdown .wpcf7-form-control-wrap {
    width: 100%;
}

.modal--free-estimate .popup-dropdown__select {
    width: 100%;
    appearance: none;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--black-30);
    border-radius: 0;
    padding: 20px 32px 20px 0;
    outline: none;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1;
    color: var(--black-30);
    cursor: pointer;
}

.modal--free-estimate .popup-dropdown__select:focus {
    border-bottom-color: var(--black-70);
}

.modal--free-estimate .popup-dropdown__select option {
    color: var(--black);
}

.modal--free-estimate .select2-container {
    width: 100% !important;
    display: block;
}

.modal--free-estimate .select2-container--default .select2-selection--single {
    height: auto;
    min-height: 61px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--black-30);
    border-radius: 0;
    outline: none;
}

.modal--free-estimate .select2-container--default.select2-container--open .select2-selection--single,
.modal--free-estimate .select2-container--default .select2-selection--single:focus {
    border-bottom-color: var(--black-70);
}

.modal--free-estimate .popup-dropdown__select.wpcf7-not-valid + .select2-container .select2-selection--single {
    border-bottom-color: #d64b4b;
}

.modal--free-estimate .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 20px 32px 20px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.25;
    color: var(--black-30);
}

.modal--free-estimate .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--black-30);
}

.modal--free-estimate .select2-container--default .select2-selection--single .select2-selection__arrow {
    display: none;
}

.modal--free-estimate .popup-dropdown:has(.select2-container--open) .popup-dropdown__chevron {
    transform: translateY(-50%) rotate(180deg);
}

.modal--free-estimate .popup-dropdown__select2-dropdown {
    margin-top: 0;
    background: var(--second-bg);
    border: 0;
    border-bottom: 2px solid var(--black-70);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.modal--free-estimate .popup-dropdown__select2-dropdown .select2-results__options {
    max-height: none;
}

.modal--free-estimate .popup-dropdown__select2-dropdown .select2-results__option {
    padding: 20px 54px;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.25;
    color: var(--black-70);
}

.modal--free-estimate .popup-dropdown__select2-dropdown .select2-results__option--highlighted[aria-selected],
.modal--free-estimate .popup-dropdown__select2-dropdown .select2-results__option--selected {
    background: var(--accent);
    color: var(--black);
}

.popup-dropdown__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    cursor: pointer;
}

.popup-dropdown__placeholder {
    flex: 1;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1;
    color: var(--black-30);
}

.popup-dropdown__chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
}

.modal--free-estimate .popup-dropdown__chevron {
    position: absolute;
    top: 50%;
    right: 0;
    pointer-events: none;
    transform: translateY(-50%);
}

.popup-dropdown__chevron img {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    display: block;
    max-width: none;
}

/* Dropdown list */

.popup-dropdown__list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--second-bg);
    display: flex;
    flex-direction: column;
    height: 0;
    overflow: hidden;
    z-index: 10;
    transition: height 0.2s ease;
}

.popup-dropdown__list--open {
    height: auto;
}

.popup-dropdown__item {
    padding: 10px 20px;
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 16px;
    line-height: 1;
    color: var(--black-70);
    cursor: pointer;
}

.popup-dropdown__item--active {
    background: var(--accent);
    color: var(--black);
}

.popup-dropdown__item:hover:not(.popup-dropdown__item--active) {
    background: rgba(255, 200, 94, 0.3);
}

/* ─── Privacy ────────────────────────────────────────────────────────────── */

.popup-privacy {
    font-family: var(--font-onest);
    font-weight: 400;
    font-size: 13px;
    line-height: 1.5;
    color: var(--black-70);
}

.popup-privacy a {
    color: var(--black);
    text-decoration: underline;
}

.popup-form__notice {
    font-family: var(--font-onest);
    font-size: 14px;
    line-height: 1.5;
}

.popup-form__notice--loading {
    color: var(--black-70);
}

.popup-form__notice--success {
    color: #2f7d32;
}

.modal--free-estimate .wpcf7 form .wpcf7-response-output {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    width: 100%;
    max-width: 440px;
    margin: 0;
    padding: 12px 14px;
    border: 0;
    border-radius: 8px;
    font-family: var(--font-onest);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    opacity: 0;
    transform: translate(-50%, 6px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.modal--free-estimate .wpcf7 form.sent .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.invalid .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.failed .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.aborted .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.spam .wpcf7-response-output {
    opacity: 1;
    transform: translate(-50%, 0);
}

.modal--free-estimate .wpcf7 form.sent .wpcf7-response-output {
    background: rgba(58, 130, 74, 0.12);
    color: #24542f;
}

.modal--free-estimate .wpcf7 form.invalid .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.failed .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.aborted .wpcf7-response-output,
.modal--free-estimate .wpcf7 form.spam .wpcf7-response-output {
    background: rgba(181, 55, 55, 0.12);
    color: #8f1f1f;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUBMIT BUTTON  (accent 3-piece parallelogram, 50px tall)
═══════════════════════════════════════════════════════════════════════════ */

.popup-btn {
    display: inline-flex;
    align-items: center;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    text-decoration: none;
}

.popup-btn:disabled {
    cursor: wait;
    opacity: 0.8;
}

.popup-submit-row {
    position: relative;
    gap: 10px;
}

.modal--free-estimate .wpcf7 form.submitting .popup-btn {
    opacity: 0.8;
}

.modal--free-estimate .wpcf7-spinner {
    position: static;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    background: transparent;
    border: 2px solid rgba(51, 54, 57, 0.2);
    border-top-color: var(--black);
    border-radius: 50%;
    opacity: 1;
    animation: popup-free-estimate-spin 0.8s linear infinite;
}

.modal--free-estimate .wpcf7-spinner::before {
    content: none;
}

@keyframes popup-free-estimate-spin {
    to {
        transform: rotate(360deg);
    }
}

.popup-btn__left {
    width: 20px;
    height: 50px;
    flex-shrink: 0;
    position: relative;
}

.popup-btn__left img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

.popup-btn__center {
    background: var(--accent);
    height: 50px;
    padding: 15px 20px;
    font-family: var(--font-plus);
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    color: var(--black);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-btn__right-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-btn__rotate {
    flex: none;
    transform: rotate(180deg);
}

.popup-btn__right {
    width: 20px;
    height: 50px;
    position: relative;
}

.popup-btn__right img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE  (≤ 768px)
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .page { min-width: 360px; }

    .popup-card {
        padding: 60px 20px 40px;
    }

    .popup-form__row {
        flex-direction: column;
        gap: 0;
    }

    .popup-card__title { font-size: 28px; }
}
