/* Modern Live Chat Styles */

/* Live Chat Form */
.live-chat-form .message-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid var(--primary-color, #dc2626);
    color: var(--text-primary, #1f2937);
    padding: 24px;
    border-radius: var(--radius-xl, 1rem);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.live-chat-form h4 {
    color: var(--primary-color, #dc2626);
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.live-chat-form .form-group {
    margin-bottom: 20px;
}

.live-chat-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    font-size: 14px;
}

.live-chat-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-lg, 0.75rem);
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-primary, #ffffff);
    font-family: inherit;
}

.live-chat-form input:focus {
    outline: none;
    border-color: var(--primary-color, #dc2626);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.live-chat-form input::placeholder {
    color: var(--text-muted, #9ca3af);
    font-weight: 500;
}

.live-chat-connect-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color, #dc2626) 0%, var(--primary-dark, #b91c1c) 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-lg, 0.75rem);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    position: relative;
    overflow: hidden;
}

.live-chat-connect-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.live-chat-connect-btn:hover::before {
    left: 100%;
}

.live-chat-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    background: linear-gradient(135deg, var(--primary-dark, #b91c1c) 0%, var(--primary-light, #ef4444) 100%);
}

.live-chat-connect-btn:active {
    transform: translateY(0);
}

.live-chat-connect-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Live Chat Connected State */
.live-chat-connected .message-content {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid var(--success-color, #10b981);
    color: var(--success-color, #10b981);
    padding: 16px 20px;
    border-radius: var(--radius-lg, 0.75rem);
    font-weight: 600;
}

/* Live Chat Indicator */
.live-chat-indicator {
    background: linear-gradient(135deg, var(--success-color, #10b981) 0%, #059669 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 12px;
    animation: pulse 2s infinite;
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.05);
    }
}

/* End Chat Button */
.end-chat-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.end-chat-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Live Chat Messages */
.live-chat-message .message-content {
    background: var(--bg-primary, #ffffff);
    border: 1px solid var(--border-light, #f3f4f6);
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    padding: 16px 20px;
    border-radius: var(--radius-lg, 0.75rem);
}

/* Connecting Animation */
.message.connecting .message-content {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px solid var(--warning-color, #f59e0b);
    color: var(--warning-color, #f59e0b);
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
    font-weight: 500;
}

/* Live Chat Ended */
.live-chat-ended .message-content {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 2px solid #a855f7;
    color: #7c3aed;
    padding: 16px 20px;
    border-radius: var(--radius-lg, 0.75rem);
    font-weight: 600;
}

/* Spinner Animation */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Live Chat Form Message */
.live-chat-form-message .message-content {
    max-width: 100%;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Live Chat Header Updates */
.chatbot-header h3 {
    transition: all 0.3s ease;
}

/* Live Chat Status Indicators */
.message.live-chat-message .message-content::before {
    content: "👤 ";
    margin-right: 8px;
    font-size: 16px;
}

.message.live-chat-message.system .message-content::before {
    content: "🔧 ";
    margin-right: 8px;
    font-size: 16px;
}

/* Enhanced Form Styling */
.live-chat-form .form-group:last-of-type {
    margin-bottom: 0;
}

.live-chat-form input:invalid {
    border-color: var(--error-color, #ef4444);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.live-chat-form input:valid {
    border-color: var(--success-color, #10b981);
}

/* Live Chat Error States */
.message.error .message-content {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid var(--error-color, #ef4444);
    color: var(--error-color, #ef4444);
    font-weight: 600;
}

/* Live Chat Success States */
.message.live-chat-connected .message-content {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid var(--success-color, #10b981);
    color: var(--success-color, #10b981);
    font-weight: 600;
}

/* Live Chat Loading States */
.live-chat-connect-btn .spinner {
    vertical-align: middle;
}

/* Live Chat Modal Overlay */
.live-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    backdrop-filter: blur(4px);
}

/* Live Chat Form Focus States */
.live-chat-form input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

/* Live Chat Button Hover Effects */
.live-chat-connect-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark, #b91c1c) 0%, var(--primary-light, #ef4444) 100%);
}

/* Live Chat Form Animation */
.live-chat-form {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Live Chat Message Animation */
.live-chat-message {
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Live Chat Header Animation */
.live-chat-indicator {
    animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design for Live Chat */
@media (max-width: 480px) {
    .live-chat-form input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .live-chat-connect-btn {
        font-size: 14px;
        padding: 14px;
    }
    
    .live-chat-indicator {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .live-chat-form .message-content {
        padding: 20px;
    }
    
    .live-chat-form h4 {
        font-size: 18px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .live-chat-form .message-content {
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
        border-color: #3b82f6;
        color: #f9fafb;
    }
    
    .live-chat-form h4 {
        color: #60a5fa;
    }
    
    .live-chat-form input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .live-chat-form input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
    
    .live-chat-connected .message-content {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        border-color: #10b981;
        color: #6ee7b7;
    }
    
    .live-chat-ended .message-content {
        background: linear-gradient(135deg, #581c87 0%, #7c2d12 100%);
        border-color: #a855f7;
        color: #c4b5fd;
    }
}

/* Accessibility improvements */
.live-chat-connect-btn:focus,
.end-chat-btn:focus {
    outline: 2px solid var(--primary-color, #dc2626);
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
.live-chat-connect-btn,
.end-chat-btn,
.live-chat-form input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}