/* Enhanced Error Handling and UX Styles */

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
    animation: shake 0.4s ease-in-out;
}

.success-message {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
}

.success-message.show {
    opacity: 1;
    transform: translateY(0);
    animation: slideInFromTop 0.4s ease-out;
}

.error-highlight {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    animation: errorPulse 0.6s ease-in-out;
}

.form-error {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: 5px;
    animation: fadeInUp 0.3s ease-out;
}

/* Enhanced input animations */
.name-input, .message-input, textarea, select, input[type="text"], input[type="tel"], input[type="date"] {
    transition: all 0.3s ease;
    position: relative;
}

.name-input:focus, .message-input:focus, textarea:focus, select:focus, input:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
}

/* Loading states */
.loading-btn {
    position: relative;
    pointer-events: none;
}

.loading-btn::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Smooth hover effects */
.start-consulting-btn, .send-btn, .save-name-btn, .quick-action-btn {
    transition: all 0.3s ease;
    transform: translateY(0);
}

.start-consulting-btn:hover:not(:disabled), 
.send-btn:hover:not(:disabled), 
.save-name-btn:hover:not(:disabled), 
.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
}

.start-consulting-btn:active, 
.send-btn:active, 
.save-name-btn:active, 
.quick-action-btn:active {
    transform: translateY(0);
}

/* Notification animations */
@keyframes slideInFromTop {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes errorPulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

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

/* Enhanced responsive design */
@media (max-width: 768px) {
    .error-message, .success-message {
        margin: 10px 0;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .form-error {
        font-size: 0.8em;
    }
}

/* Improved disabled state */
.disabled, button:disabled, input:disabled {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

/* Enhanced focus indicators for accessibility */
*:focus {
    outline: 2px solid rgba(139, 69, 19, 0.5);
    outline-offset: 2px;
}

button:focus, .quick-action-btn:focus {
    outline-color: rgba(255, 255, 255, 0.8);
}

/* Smooth page transitions */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    animation: pageEnter 0.6s ease-out forwards;
}

@keyframes pageEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Connection status indicators */
.connection-status {
    position: fixed;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 1000;
    transition: all 0.3s ease;
}

.connection-status.online {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
}

.connection-status.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
