/* Referral Program Manager - Frontend Styles */

.rpm-form-container {
    max-width: 100%;
    position: relative;
    overflow: visible !important;
}

.rpm-form-title {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 500;
    color:#1D365C;
    text-align: left;
    font-family: 'Poppins';
}

.rpm-form-fields {
    margin-bottom: 20px;
    position: relative;
    overflow: visible !important;
}

.rpm-field-group {
    margin-bottom: 20px;
    position: relative;
    overflow: visible !important;
}

/* When intl-tel-input dropdown is open, increase z-index of the field group */
.rpm-field-group:has(.iti--open),
.rpm-field-group .iti--open {
    z-index: 100000 !important;
}

.rpm-field-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #13233E;
    font-size: 16px;
    font-family: 'Poppins';
}

.rpm-required {
    color: #d63638;
    font-weight: bold;
}

.rpm-field-input {
    width: 100%;
    padding: 20px 15px !important;
    border: 2px solid #7F91B14D !important;
    border-radius: 99px !important;
    font-size: 14px !important;
    color: #7F91B1 !important;
    font-family: 'Poppins' !important;
    font-weight: 400 !important;
    box-sizing: border-box;
}

.rpm-field-input:focus {
    outline: none !important;
    border-color: #7F91B14D !important;
}

.rpm-field-input.error {
    border-color: #7F91B14D !important;
}

.rpm-field-input.success {
    border-color: #00a32a;
}

textarea.rpm-field-input {
    min-height: 100px;
    resize: vertical;
}

/* Intl-Tel-Input Integration Styles */
.rpm-field-group {
    position: relative;
    z-index: 1;
}

.rpm-field-group .iti {
    width: 100%;
    display: block;
    position: relative;
    z-index: 10;
}

.rpm-field-group .iti__flag-container {
    border-radius: 99px 0 0 99px;
    background-color: #fff;
    position: relative;
    z-index: 2;
}

.rpm-field-group input.rpm-phone-input {
    width: 100%;
    padding-left: 60px !important; /* Make room for flag */
    border-radius: 99px !important;
    position: relative;
    z-index: 1;
}

/* Match your existing input styling */
.rpm-field-group .iti__selected-flag {
    background-color: #fff;
    border-radius: 99px 0 0 99px;
    padding: 0 8px 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Adjust dropdown arrow */
.rpm-field-group .iti__arrow {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #13233E;
}

.rpm-field-group .iti__arrow.iti__arrow--up {
    border-top: none;
    border-bottom: 4px solid #13233E;
}

/* Dropdown styling - FIX Z-INDEX ISSUE */
.iti__country-list {
    position: absolute !important;
    z-index: 99999 !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    margin-top: 2px !important;
    width: 100%;
}

/* Ensure the dropdown container has proper positioning */
.iti--allow-dropdown .iti__flag-container,
.iti--separate-dial-code .iti__flag-container {
    position: absolute !important;
    z-index: 2 !important;
    left: 2px;
    top: 2px;
    bottom: 2px;
    padding: 0;
}

.iti__country {
    padding: 8px 15px !important;
    background: #fff !important;
}

.iti__country:hover {
    background-color: #f5f5f5 !important;
}

.iti__country.iti__highlight {
    background-color: #FBAA3A !important;
    color: #13233E !important;
}

.iti__dial-code {
    color: #7F91B1 !important;
}

/* Override any conflicting z-index from form container */
.rpm-form-container {
    position: relative;
    z-index: auto;
}

.rpm-form-fields {
    position: relative;
    z-index: auto;
}

/* When dropdown is open, increase field group z-index */
.rpm-field-group .iti--container {
    z-index: 100000 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rpm-field-group input.rpm-phone-input {
        padding-left: 60px !important;
    }

    .iti__country-list {
        max-height: 180px !important;
    }
}

.rpm-form-submit {
    margin-bottom: 20px;
}

.rpm-submit-btn {
    background: #FBAA3A !important;
    color: #13233E !important;
    border: none !important;
    padding: 18px 30px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    border-radius: 100px !important;
    cursor: pointer !important;
    min-width: 150px;
    font-family: 'Poppins' !important;
    word-spacing: 5px;
}

/* .rpm-submit-btn::after {
    content: " →";
    display: inline-block;
    margin-left: 8px; 
    font-size: 16px; 
    font-weight: bold; 
} */

.rpm-submit-btn:hover {
    background: #FBAA3A !important;
    


}

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

.rpm-submit-btn.loading {
    background: #0073aa;
    cursor: not-allowed;
    position: relative;
}

.rpm-submit-btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: rpm-spin 1s linear infinite;
}

@keyframes rpm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rpm-form-messages {
    text-align: center;
}

.rpm-success-message {
    background: #d1e7dd;
    color: #0f5132;
    padding: 15px;
    border: 1px solid #badbcc;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: 500;
}

.rpm-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 500;
}

.rpm-field-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 0;
    display: block;
    position: absolute;
    right: 30px;
    bottom: -20px;
}

/* Mobile responsiveness */
@media screen and (max-width: 600px) {
    .rpm-form-container {
        margin: 10px;
        padding: 15px;
        border-radius: 4px;
    }

    .rpm-form-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .rpm-field-input {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .rpm-submit-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
}



/* Form animations */
.rpm-form-container {
    animation: rpm-fadeIn 0.5s ease-in;
}

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

.rpm-field-group {
    animation: rpm-slideIn 0.3s ease-out;
    animation-fill-mode: both;
}

.rpm-field-group:nth-child(1) { animation-delay: 0.1s; }
.rpm-field-group:nth-child(2) { animation-delay: 0.2s; }
.rpm-field-group:nth-child(3) { animation-delay: 0.3s; }
.rpm-field-group:nth-child(4) { animation-delay: 0.4s; }
.rpm-field-group:nth-child(5) { animation-delay: 0.5s; }

@keyframes rpm-slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Custom checkbox and radio styles */
input[type="checkbox"].rpm-field-input,
input[type="radio"].rpm-field-input {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
}

/* Select field styles */
select.rpm-field-input {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zM2 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
}

/* Focus states for better accessibility */
.rpm-field-input:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Loading overlay */
.rpm-form-container.loading {
    position: relative;
    pointer-events: none;
}

.rpm-form-container.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: 8px;
}

/* Success state */
.rpm-form-container.success .rpm-field-input {
    border-color: #00a32a;
}

.rpm-form-container.success .rpm-submit-btn {
    background: #00a32a;
}

.rpm-form-container.success .rpm-submit-btn::after {
    content: "✓";
    animation: none;
    position: static;
    margin: 0;
    border: none;
}