/**
 * PRP Nigeria Location Fields - Frontend Styles
 */

/* Field wrapper */
.prp-field-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

/* Loading state */
.prp-field-wrapper.prp-loading select {
    opacity: 0.6;
    pointer-events: none;
}

/* Loading indicator */
.prp-loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Spinner animation */
.prp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: prp-spin 0.8s linear infinite;
}

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

/* Error message */
.prp-error {
    display: block;
    color: #d63638;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Disabled select styling */
.prp-location-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* PMPro specific overrides */
#prp-location-fields {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

#prp-location-fields .pmpro_form_fieldset {
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
}

#prp-location-fields .pmpro_form_legend {
    padding: 0 0.5rem;
    font-weight: 600;
    color: #1e1e1e;
}

#prp-location-fields .pmpro_form_fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

#prp-location-fields .pmpro_form_field {
    display: flex;
    flex-direction: column;
}

#prp-location-fields .pmpro_form_label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

#prp-location-fields .pmpro_form_input-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    appearance: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#prp-location-fields .pmpro_form_input-select:focus {
    border-color: #0073aa;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

#prp-location-fields .pmpro_form_input-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Required field indicator */
#prp-location-fields .pmpro_asterisk {
    color: #d63638;
}

/* Submit button loading state */
.pmpro_btn.prp-loading,
input[type="submit"].prp-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.pmpro_btn.prp-loading::after,
input[type="submit"].prp-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: prp-spin 0.8s linear infinite;
}

/* Mobile responsive */
@media (max-width: 600px) {
    #prp-location-fields .pmpro_form_fields {
        grid-template-columns: 1fr;
    }
    
    #prp-location-fields .pmpro_form_fieldset {
        padding: 1rem;
    }
}

/* Admin profile page styles */
#profile-page .prp-location-select,
.user-profile-form .prp-location-select {
    max-width: 25em;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #prp-location-fields .pmpro_form_input-select {
        border-width: 2px;
    }
    
    .prp-error {
        font-weight: bold;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .prp-spinner {
        animation: none;
    }
    
    .pmpro_btn.prp-loading::after,
    input[type="submit"].prp-loading::after {
        animation: none;
    }
}
