/* Error Handling Styles */

/* Enhanced error messages */
.invalid-feedback {
    display: block !important;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 5px;
    border-left: 4px solid #dc3545;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced alert styles */
.alert {
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 5px solid #dc3545;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 5px solid #28a745;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 5px solid #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left: 5px solid #17a2b8;
}

/* Form validation states */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Loading states */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Phone number specific error styling */
.phone-error {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-error i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Database error specific styling */
.database-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #dc3545;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.database-error h4 {
    color: #dc3545;
    margin-bottom: 15px;
}

.database-error .error-icon {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

/* Success states */
.success-message {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 5px solid #28a745;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.success-message i {
    font-size: 1.2rem;
    color: #28a745;
}

/* Responsive error handling */
@media (max-width: 768px) {
    .invalid-feedback {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .alert {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .phone-error {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .database-error {
        padding: 15px;
    }
    
    .database-error .error-icon {
        font-size: 2.5rem;
    }
}

/* Focus states for better accessibility */
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border-color: #007bff;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    border-color: #dc3545;
}

/* Tooltip-style error messages */
.error-tooltip {
    position: relative;
    display: inline-block;
}

.error-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #dc3545;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.error-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Enhanced button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary:disabled {
    background: #6c757d;
    border-color: #6c757d;
}

/* Error page specific styles */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.error-card {
    max-width: 500px;
    width: 100%;
    margin: 20px;
}

.error-number {
    font-size: 6rem;
    font-weight: bold;
    color: #dc3545;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.error-title {
    font-size: 1.5rem;
    color: #495057;
    margin-bottom: 15px;
}

.error-description {
    color: #6c757d;
    margin-bottom: 30px;
    line-height: 1.6;
}