/* ====================================================================
   FORM STYLES - Bloomington University
   Form validation and message styling
   ==================================================================== */

/* Form Message Styles */
.form-message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #28a745;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #dc3545;
}

/* Form Input Focus States */
.bu-connect-form input:focus,
.er-footer-newsletter-input:focus {
    outline: none;
    border-color: var(--bu-gold, #D4AF37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Form Validation States */
.bu-connect-form input.invalid,
.er-footer-newsletter-input.invalid {
    border-color: #dc3545;
}

.bu-connect-form input.valid,
.er-footer-newsletter-input.valid {
    border-color: #28a745;
}

/* Submit Button Loading State */
.bu-connect-form button[type="submit"]:disabled,
.er-footer-newsletter-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.bu-connect-form button[type="submit"]:disabled::after,
.er-footer-newsletter-btn:disabled::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 20px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Required Field Indicator */
.bu-connect-form label:has(+ input[required])::after,
.bu-connect-form label:has(+ select[required])::after {
    content: ' *';
    color: #dc3545;
    font-weight: bold;
}

/* Checkbox Consent Styling */
.bu-connect-checkbox,
.er-footer-newsletter-consent {
    margin: 15px 0;
}

.bu-connect-checkbox input[type="checkbox"],
.er-footer-newsletter-consent input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bu-connect-checkbox label,
.er-footer-newsletter-consent label {
    cursor: pointer;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Form Error Tooltip */
.form-field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.form-field-error.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Form Adjustments */
@media (max-width: 768px) {
    .form-message {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .bu-connect-form button[type="submit"],
    .er-footer-newsletter-btn {
        width: 100%;
    }
}

/* Form Success Animation */
@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.form-success-animation {
    animation: successPulse 0.5s ease-out;
}

/* Loading Spinner for Form Submission */
.form-loading {
    position: relative;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--bu-gold, #D4AF37);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}
