/* Stili per l'icona della chat */
.chat-icon {
    position: fixed;
    bottom: 70px;
    left: 20px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.chat-icon img {
    width: 36px;
    height: 36px;
}

/* Stili per la finestra della chat */
.chat-popup {
    display: none;
    position: fixed;
    bottom: 140px;
    left: 20px;
    width: 380px;
    max-width: 90vw;
    height: 400px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1002;
    overflow: hidden;
    flex-direction: column;
}

.chat-popup[style*="display: block"] {
    display: flex !important;
}

.chat-header {
    background-color: #007bff;
    color: white;
    padding: 12px 15px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h4 {
    margin: 0;
    font-size: 1.1em;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.chat-body {
    flex: 1;
    min-height: 0;
    padding: 15px;
    overflow-y: auto !important;
    background-color: #f9f9f9;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    margin-bottom: 10px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.4;
}

.user-message {
    background-color: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: #e9e9eb;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.chat-footer {
    padding: 10px 15px;
    border-top: 1px solid #ddd;
    display: flex;
    background: #fff;
    flex-shrink: 0;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
}

#send-chat {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 16px;
}

/* Indicatore "Sto pensando..." */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-style: italic;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: #007bff;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
