/* General Overlay Styling */
.aps-popup-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.admin-bar .aps-popup-wrapper {
    top: var(--wp-admin--admin-bar--height, 32px) !important;
}
@media screen and (max-width: 782px) {
    body.admin-bar .aps-popup-wrapper {
        top: 46px !important;
    }
}

.aps-popup-wrapper.aps-active {
    opacity: 1 !important;
    visibility: visible !important;
}

.aps-popup-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(4px) !important;
}

/* Form Container Style */
.aps-popup-container {
    position: relative !important;
    width: 90% !important;
    max-width: 760px;
    max-height: 85vh;
    overflow-y: auto !important;
    background-color: #FCFAF6 !important;
    border-radius: 28px !important;
    padding: 25px 35px !important; /* Compact padding */
    box-shadow: 0 20px 40px rgba(0,0,0,0.15) !important;
    z-index: 1000000000 !important;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box !important;
}

/* Scrollbar customized inside popup box */
.aps-popup-container::-webkit-scrollbar {
    width: 6px !important;
}
.aps-popup-container::-webkit-scrollbar-track {
    background: transparent !important;
}
.aps-popup-container::-webkit-scrollbar-thumb {
    background: rgba(88, 2, 27, 0.2) !important;
    border-radius: 10px !important;
}
.aps-popup-container::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 2, 27, 0.4) !important;
}

.aps-popup-wrapper.aps-active .aps-popup-container {
    transform: scale(1) !important;
}

/* Close Button */
.aps-popup-close {
    position: absolute !important;
    top: 20px !important;
    right: 24px !important;
    background: none !important;
    border: none !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #58021b !important;
    transition: color 0.2s ease;
    padding: 0 !important;
    box-shadow: none !important;
}

.aps-popup-close:hover {
    color: #2f0213 !important;
}

/* Header Styling */
.aps-popup-header {
    text-align: center !important;
    margin-bottom: 18px !important; /* Compact header space */
}

.aps-popup-logo {
    margin-bottom: 10px !important;
}

.aps-popup-logo img {
    height: 55px !important; /* Shorter logo */
    width: auto !important;
    object-fit: contain !important;
}

.aps-popup-title {
    font-family: inherit !important;
    font-size: 26px !important; /* Optimized font size */
    font-weight: 700 !important;
    color: #58021b !important;
    margin: 0 0 4px 0 !important;
}

.aps-popup-subtitle {
    font-size: 13px !important;
    color: #6b5a57 !important;
    margin: 0 !important;
}

/* Form Elements Grid */
.aps-form-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    margin: 0 -10px !important;
}

.aps-form-field {
    padding: 0 10px !important;
    margin-bottom: 12px !important; /* Tighter field margins */
    box-sizing: border-box !important;
}

.aps-col-50 {
    width: 50% !important;
}

.aps-col-100 {
    width: 100% !important;
}

@media (max-width: 767px) {
    .aps-col-50 {
        width: 100% !important;
    }
}

.aps-field-label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 5px !important;
    color: #58021b !important;
}

.aps-field-label .req {
    color: #ff4d4d !important;
    margin-left: 3px !important;
}

/* Standard Inputs & Selects */
.aps-form-input, 
.aps-form-select {
    width: 100% !important;
    height: 42px !important; /* Extremely clean and compact inputs */
    padding: 6px 12px !important;
    font-size: 14px !important;
    border: 1px solid #e8ddd0 !important;
    border-radius: 12px !important;
    background-color: #FCFAF6 !important;
    color: #2d1a1a !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aps-form-input:focus, 
.aps-form-select:focus {
    border-color: #58021b !important;
    box-shadow: 0 0 0 3px rgba(88, 2, 27, 0.1) !important;
}

/* Custom styled phone country wrapper */
.aps-phone-input-wrapper {
    display: flex !important;
    gap: 10px !important;
}

.aps-phone-country-indicator {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 6px 12px !important;
    background-color: #f1ebd9 !important;
    border: 1px solid #e8ddd0 !important;
    border-radius: 12px !important;
    height: 42px !important;
    box-sizing: border-box !important;
    user-select: none !important;
}

.aps-flag-dummy {
    font-size: 16px !important;
}

.aps-caret {
    font-size: 9px !important;
    color: #58021b !important;
}

.aps-tel-input {
    flex-grow: 1 !important;
}

/* Radio buttons Group styling */
.aps-radio-group {
    display: flex !important;
    gap: 20px !important;
    align-items: center !important;
    height: 42px !important;
}

.aps-radio-label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    color: #2d1a1a !important;
}

.aps-radio-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    border: 2px solid #58021b !important;
    border-radius: 50% !important;
    outline: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.aps-radio-input::before {
    content: "" !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background-color: #58021b !important;
    transform: scale(0) !important;
    transition: transform 0.15s ease-in-out !important;
}

.aps-radio-input:checked::before {
    transform: scale(1) !important;
}

/* Foolproof Checkbox design - COMPLETELY hides native element */
.aps-checkbox-label {
    display: inline-flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    color: #6b5a57 !important;
    margin-top: 6px !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Native input is entirely hidden and made layout-less to prevent duplication from themes */
.aps-checkbox-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Custom span acts as our solid styled checkbox */
.aps-custom-checkbox {
    width: 18px !important;
    height: 18px !important;
    border: 1.5px solid #58021b !important;
    border-radius: 4px !important;
    background-color: transparent !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: background-color 0.2s, border-color 0.2s;
    position: relative !important;
}

.aps-checkbox-input:checked + .aps-custom-checkbox {
    background-color: #58021b !important;
    border-color: #58021b !important;
}

.aps-custom-checkbox::before {
    content: "\2713" !important;
    font-size: 12px !important;
    color: white !important;
    font-weight: bold !important;
    transform: scale(0) !important;
    transition: transform 0.1s ease !important;
    display: block !important;
    line-height: 1 !important;
}

.aps-checkbox-input:checked + .aps-custom-checkbox::before {
    transform: scale(1) !important;
}

/* Force-block any browser/theme dynamic duplicate markers */
.aps-checkbox-input::after,
.aps-custom-checkbox::after {
    display: none !important;
}

/* Submit Section */
.aps-form-submit-container {
    text-align: center !important;
    margin-top: 15px !important;
}

.aps-submit-button {
    background: #58021b !important;
    color: white !important;
    border: none !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    padding: 11px 32px !important; /* Tighter button */
    border-radius: 50px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 4px 15px rgba(88, 2, 27, 0.25) !important;
}

.aps-submit-button:hover {
    background-color: #2f0213 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(88, 2, 27, 0.35) !important;
}

.aps-submit-button:active {
    transform: translateY(0) !important;
}

.aps-button-arrow {
    background: white !important;
    color: #58021b !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
}

/* Feedback Styling */
.aps-form-feedback {
    margin-top: 12px !important;
    font-size: 14px !important;
    text-align: center !important;
    font-weight: 500 !important;
}

.aps-form-feedback.success {
    color: #2e7d32 !important;
}

.aps-form-feedback.error {
    color: #d32f2f !important;
}

/* Editor preview adjustments */
.visible-editor-preview {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 20px 0 !important;
}
.visible-editor-preview .aps-popup-overlay {
    display: none !important;
}
.visible-editor-preview .aps-popup-container {
    margin: 0 auto !important;
    transform: none !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
}
