/* Form Component Styles */

/* Labels */
label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

/* Input Fields */
input, select {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background: #ffffff;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: #4BA0C7;
}

/* Only show validation states after user interaction */
input:user-invalid {
    border-color: #ef4444;
}

/* Fallback for browsers that don't support :user-invalid */
input.error, select.error {
    border-color: #ef4444;
}

/* Select Dropdown Styling */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Country-specific field styling */
.field-inline select {
    margin-bottom: 0;
}

/* Ensure consistent styling for country dropdown */
#country {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background: #ffffff;
    font-family: inherit;
}

#country:focus {
    outline: none;
    border-color: #4BA0C7;
}

/* Field Group Layouts */
.field-group {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.field-inline {
    flex: 1;
}

.field-inline label {
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.field-inline input,
.field-inline select {
    margin-bottom: 0;
}

.field-inline.full-width {
    flex: 1;
    width: 100%;
}

/* Specific field group styles */
.field-group.name .field-inline {
    flex: 1;
}

.field-group.contact .field-inline {
    flex: 1;
}

.field-group.company .field-inline {
    flex: 1;
}

.field-group.location .field-inline {
    flex: 2;
}

.field-group.location .field-inline.state-field {
    flex: 1;
    max-width: 120px;
}

/* Error Messages */
.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: -12px;
    margin-bottom: 8px;
    display: none;
    font-weight: 500;
}

.error-message.show {
    display: block;
}

/* Input Validation States - Only apply when explicitly set by JavaScript */
.field-inline input.valid {
    border-color: #10b981;
}

.field-inline input.invalid {
    border-color: #ef4444;
}

.field-inline select.valid {
    border-color: #10b981;
}

.field-inline select.invalid {
    border-color: #ef4444;
}

select.valid {
    border-color: #10b981;
}

select.invalid {
    border-color: #ef4444;
}

select.error {
    border-color: #ef4444;
}

/* Placeholder Styling */
input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

select option {
    color: #374151;
}

/* Focus States */
.field-inline:focus-within label {
    color: #073E64;
}

/* Required Field Indicator */
label::after {
    content: "";
}

label[for]:has(+ input[required])::after,
label[for]:has(+ select[required])::after {
    content: " *";
    color: #ef4444;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .field-group {
        flex-direction: column;
        gap: 0;
    }
    
    .field-group.contact,
    .field-group.company {
        flex-direction: column;
    }
    
    .field-group.location {
        flex-direction: column;
    }
    
    .field-inline.state-field {
        max-width: none;
    }
    
    input, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .field-group {
        gap: 0;
    }
    
    input, select {
        padding: 12px 14px;
    }
}