/* Live Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Chat Widget Button */
.chat-widget-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-widget-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.4);
}

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

/* Notification Badge */
.chat-widget-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.chat-window.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left {
    display: flex;
    align-items: center;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.chat-header-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Message Styles */
.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message.visitor {
    align-items: flex-end;
}

.message.admin {
    align-items: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.message.visitor .message-bubble {
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.admin .message-bubble {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    padding: 0 14px;
}

.message.visitor .message-time {
    text-align: right;
}

.message.admin .message-time {
    text-align: left;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.welcome-message h5 {
    margin: 0 0 8px 0;
    color: #374151;
}

.welcome-message p {
    margin: 0;
    font-size: 13px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 14px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0ms;
}

.typing-dot:nth-child(2) {
    animation-delay: 200ms;
}

.typing-dot:nth-child(3) {
    animation-delay: 400ms;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #2563eb;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    background: #1d4ed8;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Quick Replies */
.quick-replies {
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    display: none;
}

.quick-replies.show {
    display: block;
}

.quick-replies-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.quick-replies-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 15px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Session Info Modal */
.session-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.session-modal.show {
    display: flex;
}

.session-modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.session-modal h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
}

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

.session-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.session-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.session-form input:focus {
    border-color: #2563eb;
}

.session-form button {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.session-form button:hover {
    background: #1d4ed8;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 0;
    }
    
    .chat-widget-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

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

/* Online Status Indicator */
.online-status {
    position: relative;
}

.online-status::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}

/* Chat States */
.chat-status {
    font-size: 11px;
    opacity: 0.8;
}

.chat-status.online {
    color: #10b981;
}

.chat-status.offline {
    color: #ef4444;
}

.chat-status.away {
    color: #f59e0b;
}

/* AI Bot Message Styles */
.message.bot {
    align-items: flex-start;
}

.message.bot .message-bubble {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    color: #1f2937;
    border: 1px solid #7dd3fc;
    border-bottom-left-radius: 5px;
    padding: 12px 14px;
}

.bot-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #0369a1;
    background: rgba(3, 105, 161, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
}

.bot-badge i {
    font-size: 10px;
}

/* AI Suggestions */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    max-width: 85%;
}

.ai-suggestion-btn {
    background: white;
    border: 1px solid #7dd3fc;
    border-radius: 15px;
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    color: #0369a1;
    font-weight: 500;
}

.ai-suggestion-btn:hover {
    background: #0369a1;
    color: white;
    border-color: #0369a1;
    transform: translateY(-1px);
}

/* Typing Indicator Show State */
.typing-indicator.show {
    display: block;
}