/**
 * AVIL LAB Contact Form Styles
 * Styles for form validation and messages
 */

/* Form Messages */
.form-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.form-message i {
    font-size: 18px;
}

.form-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message-success i {
    color: #28a745;
}

.form-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-message-error i {
    color: #dc3545;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field Error States */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: fadeIn 0.2s ease-out;
}

.field-error::before {
    content: "⚠";
    font-size: 14px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Submit Button States */
.contact-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.contact-form button[type="submit"] .fa-spinner {
    margin-right: 5px;
}

/* Form Field Focus States */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

/* Success State for Fields */
.form-group input:valid:not(:placeholder-shown),
.form-group select:valid:not([value=""]),
.form-group textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

/* Required Field Indicator */
.form-group label::after {
    content: "";
}

.form-group input[required] ~ label::after,
.form-group select[required] ~ label::after,
.form-group textarea[required] ~ label::after {
    content: " *";
    color: #dc3545;
}

/* Loading Overlay (optional) */
.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 10px;
}

.form-loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .form-message {
        font-size: 13px;
        padding: 12px 15px;
    }

    .field-error {
        font-size: 11px;
    }
}

/* Checkbox Error State */
.checkbox-group.error {
    color: #dc3545;
}

.checkbox-group.error label {
    color: #dc3545;
}

/* Tooltip for Additional Help */
.field-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    color: #666;
    cursor: help;
}

.field-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Accessibility Improvements */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Form Progress Indicator (optional) */
.form-progress {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.form-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Character Counter (optional) */
.character-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.character-counter.warning {
    color: #ff9800;
}

.character-counter.error {
    color: #dc3545;
}
