:root {
    --webchat-color: #39383b;
    --icon-color: #39383b;
    --scrollbar-color: #9098a1;
    --scrollbar-bg: #f1f1f1;
    --button-hover: #000;
}

.chat-header {
    padding: 10px;
    background-color: #fff;
    border-bottom: 1px solid #e4e4e4;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    flex-grow: 1;
    font-size: 18px;
    font-weight: normal;
    color: var(--webchat-color);
}

.icons {
    display: flex;
    gap: 10px;
}

.fullscreen-icon,
.close-icon {
    cursor: pointer;
    color: var(--icon-color);
}

.fullscreen-icon:hover,
.close-icon:hover {
    color: var(--button-hover);
}

#speakBtn {
    border-radius: 100px;
    height: 40px;
    padding: 5px 10px 5px 25px;
    background: black;
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#speakBtn:hover {
    background: #2b2b2b;
}

.chatbot-icon1 {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 160px;
    height: 50px;
    background-color: #ffffff;
    border-radius: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #0e0e0e;
    font-size: 15px;
    z-index: 1000;
    box-shadow: 0 0 64px 64px #0000001a;
    padding: 0 10px;
}

.chatbot-icon1.listening-animation {
    animation: listeningGlow 1.5s ease-in-out infinite;
}

.chatbot-icon1:hover {
    background-color: #0056b3;
    color: white;
}

.chat-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 340px;
    background: white;
    border: 1px solid #e4e4e4;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
    z-index: 1000;
    animation: slideUp 0.5s ease-out forwards;
}

.chat-container.close-animation {
    animation: fadeOut 0.3s ease-in-out forwards;
}

.chat-log {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    background: #f7f7f7;
    animation: fadeIn 0.5s ease-in forwards;
}

#messageLog {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.incoming,
.outgoing {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 5px;
    position: relative;
    word-wrap: break-word;
    animation: bounce 500ms linear both;
}

.incoming {
    background-color: #000;
    color: white;
    align-self: flex-start;
    margin-right: auto;
    border-radius: 12px 10px 10px 0px;
}

.outgoing {
    background-color: var(--webchat-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-radius: 10px 12px 0px 10px;
}

.incoming.error {
    background-color: #ffe6e6;
    color: #d32f2f;
    align-self: center;
    text-align: center;
}

#messageInput {
    padding: 17px 75px 17px 17px;
    border: transparent;
    box-shadow: 0px 6px 16px -6px rgba(1, 1, 1, 0.6);
    outline: none;
    transition: all 0.3s ease;
    border-radius: 0px;
    margin-bottom: 0px;
}

#messageInput:focus {
    border-color: #d4d0ef;
    box-shadow: 0 0 5px rgba(217, 215, 231, 0.5);
    background-color: #f9f9ff;
}

.message-input {
    display: flex;
    background-color: #f9f9f9;
    position: relative;
    animation: fadeIn 0.5s ease-in forwards;
}

.message-input input {
    flex: 1;
}

.message-input .send-btn {
    padding: 7px 14px;
    border: none;
    background-color: var(--webchat-color);
    color: white;
    cursor: pointer;
    border-radius: 5px;
    position: absolute;
    right: 7px;
    font-size: 14px;
    top: 7px;
    height: 80%;
}

.message-input .send-btn:hover {
    background-color: var(--button-hover);
}

.message-input .mic-btn {
    padding: 7px 14px;
    border: none;
    background-color: var(--webchat-color);
    color: white;
    cursor: pointer;
    border-radius: 5px;
    position: absolute;
    right: 65px;
    font-size: 14px;
    top: 7px;
    height: 80%;
}

.message-input .mic-btn:hover {
    background-color: var(--button-hover);
}

.chat-log::-webkit-scrollbar {
    width: 8px;
}

.chat-log::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-color);
}

.chat-log::-webkit-scrollbar-thumb:hover {
    background-color: #9fa9b2;
}

.chat-log::-webkit-scrollbar-track {
    background-color: var(--scrollbar-bg);
}

.chat-log {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--scrollbar-bg);
}

#audioPlayer {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 0 10px;
}

@keyframes bounce {
    0% { transform: matrix3d(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    4.7% { transform: matrix3d(0.45, 0, 0, 0, 0, 0.45, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    9.41% { transform: matrix3d(0.883, 0, 0, 0, 0, 0.883, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    14.11% { transform: matrix3d(1.141, 0, 0, 0, 0, 1.141, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    18.72% { transform: matrix3d(1.212, 0, 0, 0, 0, 1.212, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    24.32% { transform: matrix3d(1.151, 0, 0, 0, 0, 1.151, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    29.93% { transform: matrix3d(1.048, 0, 0, 0, 0, 1.048, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    35.54% { transform: matrix3d(0.979, 0, 0, 0, 0, 0.979, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    41.04% { transform: matrix3d(0.961, 0, 0, 0, 0, 0.961, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    52.15% { transform: matrix3d(0.991, 0, 0, 0, 0, 0.991, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    63.26% { transform: matrix3d(1.007, 0, 0, 0, 0, 1.007, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    85.49% { transform: matrix3d(0.999, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
    100% { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes listeningGlow {
    0% { background-color: #ffffff; }
    50% { background-color: #e0e7ff; }
    100% { background-color: #ffffff; }
}

@keyframes typingDots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: ''; }
}

.typing-dots {
    display: inline-block;
    width: 24px;
    height: 16px;
}

.typing-dots::after {
    content: '.';
    display: inline-block;
    animation: typingDots 1.2s steps(4) infinite;
}