/* SM8-IA Chat Widget Styles */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: #007bff;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center; 
}

.chat-toggle:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.chat-window {
    display: none;
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    flex-direction: column;
    overflow: hidden;
}

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

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

.chat-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.chat-status-indicator {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 5px;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
}

.message.user {
    justify-content: flex-end;
}

.message.agent {
    justify-content: flex-start;
}

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

.message.user .message-bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.agent .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin: 5px 10px 0;
}

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

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

.chat-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: #007bff;
}

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

.chat-send:hover {
    background: #0056b3;
}

.chat-send:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    margin-bottom: 15px;
    max-width: 60px;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: flex;
    align-items: center;
    height: 16px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: #6c757d;
    border-radius: 50%;
    margin-right: 3px;
    animation: typingDot 1.5s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    text-align: center;
}

.chat-welcome {
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 15px;
    padding: 10px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .chat-window {
        width: 100%;
        height: 70vh;
        max-height: 500px;
        right: auto;
        left: 0;
    }

    .message-bubble {
        max-width: 200px;
    }
}

/* Accessibility */
.chat-toggle:focus,
.chat-send:focus,
.chat-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.chat-input input:focus {
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #2d3748;
        color: #e2e8f0;
    }

    .chat-messages {
        background: #1a202c;
    }

    .message.agent .message-bubble {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }

    .chat-input {
        background: #2d3748;
        border-color: #4a5568;
    }

    .chat-input input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }

    .typing-indicator {
        background: #4a5568;
        border-color: #4a5568;
    }
}