.chat-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(56, 110, 181, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(10px);
    animation: slideUp 0.4s ease-out forwards;
    border: 1px solid rgba(56, 110, 181, 0.1);
    z-index: 9999;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, #386eb5 0%, #4a7bc8 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.header-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

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

.chat-actions {
    margin-inline-start: auto;
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #386eb5;
    border-radius: 4px;
}

.message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.agent-avatar {
    background: linear-gradient(135deg, #386eb5 0%, #4a7bc8 100%);
    color: white;
}

.user-avatar {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    color: white;
}

.message-content {
    background: #f8fafc;
    padding-block: 12px;
    padding-inline: 16px;
    border-radius: 12px;
    max-width: 260px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #e2e8f0;
}

.message.user .message-content {
    background: linear-gradient(135deg, #386eb5 0%, #4a7bc8 100%);
    color: white;
    border: 1px solid #386eb5;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    text-align: center;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-block: 12px;
    padding-inline: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #386eb5;
    border-radius: 50%;
    animation: typing 1.5s infinite;
}

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

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

@keyframes typing {

    0%,
    60%,
    100% {
        opacity: 0.3;
    }

    30% {
        opacity: 1;
    }
}

.chat-input {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-field {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding-block: 12px;
    padding-inline: 16px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    max-height: 80px;
    min-height: 50px;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: #386eb5;
    box-shadow: 0 0 0 3px rgba(56, 110, 181, 0.1);
}

.send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #386eb5 0%, #4a7bc8 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.chat-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #386eb5 0%, #4a7bc8 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
    z-index: 9999;
}

.chat-toggle:hover {
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    border: 2px solid white;
}

.message-content.failed {
    color: #dc3545;
    font-weight: bold;
}

.failed-label {
    color: #dc3545;
    font-size: 0.8rem;
    margin-inline-start: 5px;
}


@media (max-width: 900px) {
    .chat-container {
        width: 85%;
    }
}