/**
 * BuddyPress XProfile Field Editor Styles
 */

/* Main container styling */
.gw-xprofile-editor-container {
    max-width: 100%;
    margin: 1rem 0;
    font-family: inherit;
}

/* Field group styling */
.gw-xprofile-field-group .gw-xprofile-group-title {
    margin: 0 0 1rem 0;
    padding: 0;
    font-size: 1.25em;
    font-weight: 600;
    color: #333;
}

.gw-xprofile-field-group .gw-xprofile-group-description {
    margin: 0 0 1.5rem 0;
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Individual field wrapper */
.gw-xprofile-field-wrapper {
    margin: 0 0 1.5rem 0;
    position: relative;
}

.gw-xprofile-field-wrapper:last-child {
    margin-bottom: 0;
}

/* Field labels */
.gw-xprofile-field-label {
    display: block;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: #333;
    font-size: 1em;
    line-height: 1.4;
}

.gw-xprofile-required-indicator {
    color: #dc3232;
    font-weight: bold;
    margin-left: 2px;
}

/* Field descriptions */
.gw-xprofile-field-description {
    margin: 0 0 0.75rem 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Input wrapper */
.gw-xprofile-field-input-wrapper {
    position: relative;
}

/* Base input styling */
.gw-xprofile-editor-field {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    line-height: 1.4;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.gw-xprofile-editor-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.3);
}

/* Textarea specific */
.gw-xprofile-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Number input specific */
.gw-xprofile-number {
    max-width: 200px;
}

/* Select dropdown specific */
.gw-xprofile-selectbox {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Radio button group */
.gw-xprofile-radio-group,
.gw-xprofile-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gw-xprofile-radio-option,
.gw-xprofile-checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gw-xprofile-radio,
.gw-xprofile-checkbox {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

.gw-xprofile-radio-option label,
.gw-xprofile-checkbox-option label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    font-size: 1em;
}

/* State styling */
.gw-xprofile-editor-field.gw-saving {
    border-color: #ffb900;
    background-color: #fffbf0;
}

.gw-xprofile-editor-field.gw-saved {
    border-color: #46b450;
    background-color: #f0fff0;
}

.gw-xprofile-editor-field.gw-error {
    border-color: #dc3232;
    background-color: #fff0f0;
}

/* Loading animation */
.gw-xprofile-editor-field.gw-saving::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid #ffb900;
    border-radius: 50%;
    border-top-color: transparent;
    animation: gw-spin 1s linear infinite;
}

@keyframes gw-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Feedback messages */
.gw-xprofile-field-feedback {
    margin: 0.5rem 0 0 0;
    min-height: 1.5em;
    font-size: 0.9em;
    line-height: 1.4;
}

.gw-xprofile-field-feedback.gw-feedback-saving {
    color: #ffb900;
}

.gw-xprofile-field-feedback.gw-feedback-saved {
    color: #46b450;
    font-weight: 600;
}

.gw-xprofile-field-feedback.gw-feedback-error {
    color: #dc3232;
    font-weight: 600;
}

/* Success checkmark */
.gw-feedback-saved::before {
    content: '✓ ';
    font-weight: bold;
}

/* Error styling */
.gw-xprofile-editor-error {
    padding: 1rem;
    background-color: #fff0f0;
    border: 1px solid #dc3232;
    border-radius: 4px;
    color: #dc3232;
    font-weight: 600;
    margin: 1rem 0;
}

/* Required field styling */
.gw-xprofile-required.gw-xprofile-editor-field:invalid {
    border-color: #dc3232;
}

/* Responsive design */
@media (max-width: 768px) {
    .gw-xprofile-editor-field {
        max-width: 100%;
    }
    
    .gw-xprofile-number {
        max-width: 100%;
    }
    
    .gw-xprofile-radio-group,
    .gw-xprofile-checkbox-group {
        gap: 0.75rem;
    }
}

/* Accessibility improvements */
.gw-xprofile-editor-field:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gw-xprofile-editor-field {
        border-width: 2px;
    }
    
    .gw-xprofile-editor-field:focus {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gw-xprofile-editor-field,
    .gw-xprofile-editor-field.gw-saving::after {
        transition: none;
        animation: none;
    }
}
