#perso-chat-widget {
    position: fixed;
    bottom: 25px; 
    right: 85px; 
    z-index: 9999;
    font-family: 'Arial', sans-serif;
    max-width: 100vw;
    max-height: 100vh;
    box-sizing: border-box;
}

#chat-toggle-btn {
    background-color: #000000; 
    color: white;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    z-index: 10000; 
}

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

#chat-window {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 350px; 
    height: 500px; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    position: fixed; 
    bottom: 90px;
    right: 20px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: calc(100vw - 40px); 
    max-height: calc(100vh - 110px); 
    box-sizing: border-box;
    z-index: 9999;
}

#chat-window.chat-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none; 
}

.chat-header {
    background-color: #000000;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    flex-shrink: 0; 
}

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

.chat-status-dot {
    width: 8px;
    height: 8px;
    background-color: #4CAF50; 
    border-radius: 50%;
    margin-right: 6px;
}

.chat-title {
    font-weight: bold;
    font-size: 1em;
}

.chat-subtitle {
    font-size: 0.75em;
    opacity: 0.8;
}

.chat-header-right {
    display: flex; 
    align-items: center;
    gap: 5px;
}

.chat-header-right .chat-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1em; 
    padding: 6px; 
    border-radius: 50%; 
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex; 
    justify-content: center;
    align-items: center;
}

.chat-header-right .chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.2); 
    transform: scale(1.1); 
}

.chat-header-right .chat-btn svg {
    width: 18px; 
    height: 18px;
    fill: currentColor; 
}


.chat-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow: hidden; 
    background-color: #f9f9f9;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 6px; 
    -webkit-overflow-scrolling: touch; 
}

.chat-message {
    padding: 8px 10px;
    border-radius: 15px;
    margin-bottom: 8px;
    max-width: calc(100% - 30px);
    word-wrap: break-word;
    word-break: break-word;
    font-size: 0.88em;
    line-height: 1.3;
}

.message-bot {
    background-color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.message-user {
    background-color: #000000;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.typing-indicator {
    background-color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
    display: inline-block;
    padding: 8px 12px;
    animation: pulse 1.5s infinite;
    font-size: 0.88em;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.chat-input-area {
    padding: 8px 0;
    border-top: 1px solid #eee;
    background-color: #fff;
    flex-shrink: 0; 
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 18px;
    padding: 8px 12px;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: #040816;
}

.chat-input-wrapper button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: #666;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-input-wrapper button:hover {
    background-color: #f0f0f0;
    color: #0d2060;
}

.chat-input-wrapper .send-btn {
    background-color: #000000;
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-input-wrapper .send-btn:hover {
    background-color: #2c3242;
    color: white;
}


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

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}

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


@media (max-width: 768px) {
    

    #chat-toggle-btn {
        z-index: 10000;
    }

    #chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 70px;
        right: 15px;
        left: 15px;
        margin: auto;
        border-radius: 10px;
        max-height: calc(100vh - 120px);
    }

    .chat-header {
        padding: 8px 12px;
    }

    .chat-header-right .chat-btn svg {
        width: 16px;
        height: 16px;
    }

    .chat-title {
        font-size: 0.95em;
    }

    .chat-subtitle {
        font-size: 0.7em;
    }

    .chat-message {
        font-size: 0.85em;
        padding: 7px 9px;
        margin-bottom: 6px;
        max-width: calc(100% - 25px);
    }

    #chat-input {
        padding: 7px 10px;
        font-size: 0.85em;
    }

    .chat-input-wrapper .send-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    

    #chat-toggle-btn {
        z-index: 10000;
    }

    #chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 110px);
        bottom: 65px;
        right: 10px;
        left: 10px;
        margin: auto;
        border-radius: 10px;
        max-height: calc(100vh - 110px);
    }

    .chat-header {
        padding: 6px 10px;
    }

    .chat-header-right .chat-btn svg {
        width: 14px;
        height: 14px;
    }

    .chat-title {
        font-size: 0.9em;
    }

    .chat-subtitle {
        font-size: 0.65em;
    }

    .chat-message {
        font-size: 0.8em;
        padding: 6px 8px;
        margin-bottom: 5px;
        max-width: calc(100% - 20px);
    }

    #chat-input {
        padding: 6px 8px;
        font-size: 0.8em;
    }

    .chat-input-wrapper .send-btn {
        width: 30px;
        height: 30px;
    }
}