/**
 * Form Validation Styles
 * Red borders, light gray placeholders, and descriptive error messages
 */

/* Field Error States */
.form-field-error {
    border: 2px solid #dc3545 !important;
    border-radius: 4px;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    background-color: #ffffff !important;
}

.form-field-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    outline: none !important;
}

/* Error Message Styling */
.form-error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
    font-weight: 500;
}

.form-error-message:before {
    content: "⚠ ";
    margin-right: 0.25rem;
}

/* General Form Error */
.form-general-error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 0.375rem;
    background-color: #f8d7da;
    color: #721c24;
    display: none;
}

/* Light Gray Placeholders */
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #6c757d !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
    color: #6c757d !important;
    opacity: 1;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: #6c757d !important;
}

/* Form Field Containers */
.form-group {
    position: relative;
    margin-bottom: 1rem;
}

.form-group.has-error .form-control {
    border-color: #dc3545;
}

/* Enhanced Input Styling */
.form-control {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: #ffffff;
}

/* Select Dropdown Styling */
.form-select {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select.form-field-error {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dc3545' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

/* Textarea Styling */
.form-control[type="textarea"],
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Required Field Indicators */
.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Validation Success States */
.form-field-success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.form-success-message {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.form-success-message:before {
    content: "✓ ";
    margin-right: 0.25rem;
}

/* Button States */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 0.5rem;
    }
    
    .form-error-message {
        font-size: 0.8rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-field-error {
        border-width: 3px;
    }
    
    .form-error-message {
        font-weight: bold;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .form-select {
        transition: none;
    }
}

/* Custom Validation Styles for Specific Fields */
.password-strength-indicator {
    margin-top: 0.25rem;
    height: 4px;
    background-color: #dee2e6;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-indicator .strength-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.password-strength-indicator .strength-bar.weak {
    width: 33%;
    background-color: #dc3545;
}

.password-strength-indicator .strength-bar.medium {
    width: 66%;
    background-color: #ffc107;
}

.password-strength-indicator .strength-bar.strong {
    width: 100%;
    background-color: #28a745;
}