.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-open-btn {
    background-color: #008080; 
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease;
}
.chat-open-btn:hover {
    transform: scale(1.05);
}
.chat-open-btn span {
    transition: all 0.4s ease;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
}
.chat-open-btn span.hidden {
    opacity: 0;
    width: 0;
    margin-left: -10px;
}

.chat-window {
    width: 350px;
    max-height: 500px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transform-origin: bottom right;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0s 0.3s;
}
.chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}

.chat-header {
    background-color: #008080; 
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
}
.header-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
}
.chat-download-btn {
    background: none;
    border: none;
    color: white;
    opacity: 0.8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.2s ease;
}
.chat-download-btn:hover {
    opacity: 1;
}
.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}
.chat-close-btn:hover {
    opacity: 1;
}

.chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f0f2f5;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}
.chat-message.user {
    align-items: flex-end;
}
.chat-message.assistant {
    align-items: flex-start;
}
.chat-message .bubble {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.4;
}
.chat-message.user .bubble {
    background-color: #f39c12;
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-message.assistant .bubble {
    background-color: #e4e6eb;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.system-greeting {
    text-align: center;
    margin: 10px 0;
}
.system-greeting .bubble {
    background-color: transparent;
    border: 1px solid #d1e7dd;
    color: #0f5132;
    display: inline-block;
    max-width: 90%;
    border-radius: 12px;
}
.system-greeting .bubble i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #008080;
}

.chat-footer {
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: white;
}
.chat-footer form {
    display: flex;
    gap: 10px;
}
.chat-footer input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1rem;
}
.chat-footer button {
    background-color: #008080;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.attribution {
    font-size: 0.7rem;
    text-align: center;
    color: #aaa;
    margin: 8px 0 0 0;
    padding: 0;
}
.attribution a {
    color: #888;
    text-decoration: none;
}
.attribution a:hover {
    text-decoration: underline;
}

.chat-window.open + .chat-open-btn {
    display: none;
}
.typing-indicator .bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 15px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: #90949c;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: -0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: -0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}


.chat-message.system .bubble {
    background-color: #e2f3ff;
    color: #0c5460;
    font-style: italic;
    border: 1px solid #bde5f8;
    text-align: center;
    width: 100%;
    max-width: 100%;
}
.chat-message.system .bubble i {
    margin-right: 8px;
}
.chat-message.system-notification {
    align-items: center;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
    margin: 15px 0;
}
.chat-message.system-notification .bubble {
    background-color: transparent;
    border: none;
    padding: 0;
}


.assistant .agent-name {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    color: #008080;
    margin-bottom: 4px;
}


@media screen and (max-width: 768px) {

 
    .chat-widget-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        pointer-events: none;
    }


    .chat-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        top: 0;
        left: 0;
        border-radius: 0;
        pointer-events: auto; 
        transform: translateY(100%); 
    }

    
    .chat-window.open {
        transform: translateY(0);
    }
    
    
    .chat-open-btn {
        position: absolute;
        bottom: 20px;
        right: 20px;
        pointer-events: auto;
    }

    .chat-open-btn span {
        font-size: 0.85rem;
    }
}