/* Popup Registration Styling */
body.popup-open {
    overflow: hidden !important;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.is-active {
    display: flex;
    opacity: 1;
}

.popup-modal.vertical-rectangle {
    width: 480px;
    /* Standard starting width */
    aspect-ratio: 1200 / 1913;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: popupScaleUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.registration-form-container input[type="text"] {
    margin-bottom: 16px;
}

@keyframes popupScaleUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-content-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.popup-background {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.popup-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* CF7 Form Styling inside Popup */
.registration-form-container {
    position: absolute;
    top: 31.4%;
    left: 10%;
    /* Căn lề trái theo khung đỏ */
    width: 80%;
    /* Độ rộng đẩy ra full 2 lề khung đỏ */
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Đảm bảo khoảng cách bằng nhau tuyệt đối */
    height: auto;
}

.registration-form-container p,
.registration-form-container .wpcf7-submit,
.registration-form-container .select-wrapper {
    margin: 0;
    /* Reset margin để gap lo nhiệm vụ spacing */
}

.registration-form-container br {
    display: none;
    /* Khắc phục lỗi wpautop sinh thêm thẻ br gây lệch khoảng cách giữa các hàng CF7 */
}

.registration-form-container input[type="text"],
.registration-form-container input[type="tel"],
.registration-form-container select,
.registration-form-container .wpcf7-select {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    padding: 0 24px;
    border: 1px solid #BF934E;
    border-radius: 999px;
    /* Pill shape */
    font-size: 15px;
    background: #fff;
    color: #7F6337;
    outline: none;
    transition: var(--transition-normal);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: normal;
}

/* Đồng bộ placeholder của input giống hệt text của select */
.registration-form-container input[type="text"]::placeholder,
.registration-form-container input[type="tel"]::placeholder {
    color: #7F6337;
    opacity: 1;
}

/* Custom Select Arrow */
.registration-form-container .select-wrapper {
    position: relative;
    width: 100%;
}

.registration-form-container .select-wrapper::after {
    content: '\25BE';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #7F6337;
    pointer-events: none;
}

.registration-form-container input:focus,
.registration-form-container select:focus {
    border-color: #BF934E;
    box-shadow: 0 0 0 3px rgba(191, 147, 78, 0.15);
}

.registration-form-container .wpcf7-submit {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    padding: 0 24px;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    /* Styles are inherited from .btn-cta, so we only apply dimensions to fit layout */
}

/* Close Button */
.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.3s;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.popup-backdrop.is-active {
    display: block;
    opacity: 1;
}

/* Blur effect for background */
body.popup-open #main-content,
body.popup-open .site-header,
body.popup-open .site-footer {
    filter: blur(3px);
    transition: filter 0.3s ease;
}

.popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Slightly lighter to see blur better */
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Hide labels/spinners for CF7 cleaner look */
/* Hide labels/spinners for CF7 cleaner look */
.wpcf7-not-valid-tip {
    font-size: 13px;
    color: #fff;
    background: rgba(255, 0, 0, 0.6);
    padding: 2px 10px;
    border-radius: 4px;
    margin-top: 5px;
    display: block;
    width: fit-content;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.wpcf7-response-output {
    margin: 20px 0 0 !important;
    padding: 12px 20px !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 14px;
    text-align: center;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Validation errors style */
.wpcf7-form.invalid .wpcf7-response-output {
    background: rgba(210, 47, 47, 0.8);
    box-shadow: 0 5px 15px rgba(210, 47, 47, 0.3);
}

/* Success style */
.wpcf7-form.sent .wpcf7-response-output {
    background: rgba(40, 167, 69, 0.8);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.wpcf7-spinner {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .popup-modal.vertical-rectangle {
        width: 85vw;
        height: auto;
        /* Fallback */
    }

    .registration-form-container input[type="text"],
    .registration-form-container input[type="tel"],
    .registration-form-container select,
    .registration-form-container .wpcf7-select,
    .registration-form-container .wpcf7-submit {
        height: 42px;
        padding: 0 16px;
        font-size: 13px;
    }

    .registration-form-container .wpcf7-submit {
        font-size: 15px;
    }
}