/* ========================================
   MODAL OVERLAY
   ======================================== */
.cpp-form-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
}

.cpp-form-modal.cpp-open {
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: cpp-fadeIn 0.25s ease;
}

.cpp-form-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cpp-form-modal-content {
    position: relative;
    width: 95%;
    max-width: 780px;
    max-height: 90vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 1;
    animation: cpp-scaleIn 0.3s ease;
}

.cpp-form-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cpp-form-modal-close:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

/* Background image inside modal */
.cpp-form-modal-content .cpp-form-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.cpp-form-modal-scroll {
    position: relative;
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
    padding: 10px 0;
}

/* ========================================
   FORM STYLES (shared by modal and page)
   ======================================== */
.cpp-form-wrapper {
    max-width: 540px;
    margin: 0 auto;
    padding: 30px 36px;
    font-family: inherit;
}

.cpp-form-title {
    font-size: 22px;
    font-weight: 700;
    color: #0E2A56;
    margin: 0 0 4px;
    text-align: center;
}

.cpp-form-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
    text-align: center;
}

.cpp-form-group {
    margin-bottom: 18px;
}

.cpp-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.cpp-required {
    color: #e74c3c;
}

.cpp-form-group input[type="text"],
.cpp-form-group input[type="email"],
.cpp-form-group input[type="tel"],
.cpp-form-group input[type="number"],
.cpp-form-group input[type="date"],
.cpp-form-group select,
.cpp-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background-color: #fff;
}

/* Select: full text visible */
.cpp-form-group select {
    height: auto;
    min-height: 46px;
    line-height: 1.4;
    white-space: normal;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.cpp-form-group select option {
    padding: 8px 12px;
    line-height: 1.4;
}

/* Phone field with country code */
.cpp-phone-field-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cpp-country-code-select {
    width: 30%;
    min-width: 88px;
    max-width: 116px;
    flex-shrink: 1;
    min-height: 46px;
    padding: 12px 28px 12px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230E2A56' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cpp-country-code-select:focus {
    outline: none;
    border-color: #0E2A56;
    box-shadow: 0 0 0 3px rgba(14, 42, 86, 0.12), 0 2px 8px rgba(14, 42, 86, 0.08);
}

.cpp-phone-input {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 12px 14px;
    box-sizing: border-box;
}

.cpp-form-group input:focus,
.cpp-form-group select:focus,
.cpp-form-group textarea:focus {
    outline: none;
    border-color: #0E2A56;
    box-shadow: 0 0 0 3px rgba(14, 42, 86, 0.12), 0 2px 8px rgba(14, 42, 86, 0.08);
}

.cpp-form-group input.cpp-input-error,
.cpp-form-group select.cpp-input-error,
.cpp-form-group textarea.cpp-input-error {
    border-color: #e74c3c;
}

.cpp-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.cpp-form-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.cpp-error {
    display: block;
    color: #e74c3c;
    font-size: 13px;
    margin-top: 4px;
    min-height: 16px;
}

.cpp-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cpp-checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.cpp-checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
}

/* Button: Home style (#F1BA2E + #0E2A56) */
.cpp-btn-submit {
    display: inline-block;
    width: 100%;
    padding: 16px 28px;
    background: linear-gradient(135deg, #F1BA2E 0%, #daa520 100%);
    color: #0E2A56;
    border: none;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 500;
    font-family: "Roboto", sans-serif;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.cpp-btn-submit:hover {
    background: linear-gradient(135deg, #daa520 0%, #c89418 100%);
    box-shadow: 0 4px 16px rgba(241, 186, 46, 0.3);
    color: #0E2A56;
}

.cpp-btn-submit:active {
    transform: scale(0.98);
}

.cpp-btn-submit:disabled {
    background-color: #ccc;
    color: #888;
    cursor: not-allowed;
    transform: none;
}

.cpp-btn-submit.cpp-loading {
    position: relative;
    color: transparent;
}

.cpp-btn-submit.cpp-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid #0E2A56;
    border-top-color: transparent;
    border-radius: 50%;
    animation: cpp-spin 0.6s linear infinite;
}

@keyframes cpp-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   SUCCESS MODAL (after submit)
   ======================================== */
.cpp-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    animation: cpp-fadeIn 0.25s ease;
}

.cpp-success-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    max-width: 460px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: cpp-scaleIn 0.3s ease;
    backdrop-filter: blur(4px);
}

.cpp-success-icon {
    width: 64px;
    height: 64px;
    background: #F1BA2E;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.cpp-success-icon svg {
    width: 32px;
    height: 32px;
    fill: #0E2A56;
}

.cpp-success-box h3 {
    font-size: 20px;
    font-weight: 600;
    color: #0E2A56;
    margin: 0 0 10px;
}

.cpp-success-box p {
    font-size: 15px;
    color: #555;
    margin: 0 0 24px;
    line-height: 1.5;
}

.cpp-success-btn {
    display: inline-block;
    padding: 14px 40px;
    background-color: #F1BA2E;
    color: #0E2A56;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    font-family: "Roboto", sans-serif;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cpp-success-btn:hover {
    background-color: #daa520;
}

.cpp-message {
    display: none;
}

/* ========================================
   STANDALONE PAGE (shortcode fallback)
   ======================================== */
.cpp-form-page {
    position: relative;
    min-height: 100vh;
}

.cpp-form-page .cpp-form-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.cpp-form-page .cpp-form-wrapper {
    position: relative;
    z-index: 1;
}

/* ========================================
   ANIMATIONS
   ======================================== */
.cpp-dynamic-field-enter {
    animation: cpp-fadeIn 0.3s ease;
}

@keyframes cpp-fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cpp-scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
    .cpp-form-modal-content {
        width: 96%;
        max-width: 96%;
    }

    .cpp-form-wrapper {
        padding: 24px 22px;
    }

    .cpp-form-title {
        font-size: 20px;
    }

    .cpp-btn-submit {
        font-size: 18px;
        padding: 14px 24px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .cpp-phone-field-group {
        flex-direction: column;
        gap: 6px;
    }

    .cpp-country-code-select {
        width: 100%;
        max-width: 100%;
        min-width: unset;
    }

    .cpp-form-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 0;
        height: 100dvh;
    }

    .cpp-form-modal-scroll {
        max-height: 100dvh;
        height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .cpp-form-modal-close {
        top: 8px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .cpp-form-wrapper {
        padding: 18px 16px;
    }

    .cpp-form-title {
        font-size: 18px;
    }

    .cpp-form-subtitle {
        font-size: 13px;
        margin-bottom: 18px;
    }

    .cpp-form-group label {
        font-size: 13px;
    }

    .cpp-form-group input[type="text"],
    .cpp-form-group input[type="email"],
    .cpp-form-group input[type="tel"],
    .cpp-form-group input[type="number"],
    .cpp-form-group input[type="date"],
    .cpp-form-group select,
    .cpp-form-group textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .cpp-form-group select {
        min-height: 42px;
    }

    .cpp-btn-submit {
        font-size: 16px;
        padding: 13px 20px;
        border-radius: 25px;
    }

    .cpp-success-box {
        padding: 28px 20px;
        width: 94%;
    }

    .cpp-success-box h3 {
        font-size: 18px;
    }

    .cpp-success-box p {
        font-size: 14px;
    }

    .cpp-success-btn {
        padding: 12px 32px;
        font-size: 15px;
    }

    .cpp-success-icon {
        width: 52px;
        height: 52px;
    }

    .cpp-success-icon svg {
        width: 26px;
        height: 26px;
    }
}
