* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;*/
    padding: 20px;
}

/* Pulsante ChatBot */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: glowPulse 2s infinite ease-in-out; /* Mantenuto l'effetto glow */
}

.chatbot-button:hover {
    transform: scale(1.05);
}

.chatbot-button img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* Effetto Glow Verde Pulsante */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(37, 211, 102, 0.4),
                    0 0 40px rgba(37, 211, 102, 0.2),
                    0 4px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(37, 211, 102, 0.8),
                    0 0 60px rgba(37, 211, 102, 0.4),
                    0 4px 20px rgba(0, 0, 0, 0.3);
    }
}


/* Container Chat */
.chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: #0a0a0a;
    border-radius: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    border: 8px solid #1f1f1f;
}

.chat-container.active {
    display: flex;
}

/* Header Chat */
.chat-header {
    background: #1f2c33;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #2a2f32;
}

.chat-logo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    /* Lo sfondo è gestito dall'immagine */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0; /* Nasconde l'eventuale "M" rimasta per sicurezza */
}

.chat-title {
    flex: 1;
}

.chat-name {
    color: #e9edef;
    font-size: 17px;
    font-weight: 500;
}

.chat-status {
    color: #8696a0;
    font-size: 13px;
    margin-top: 2px;
}

.close-button {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-button:hover {
    background: #2a3942;
}

/* Area Messaggi */
.chat-messages {
    flex: 1;
    background: #0b141a;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #374045;
    border-radius: 3px;
}

/* Messaggio */
.message {
    display: flex;
    margin-bottom: 8px;
}

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
}

.message.bot .message-bubble {
    background: #1f2c33;
    color: #e9edef;
    border-top-left-radius: 0;
}

.message.user .message-bubble {
    background: #005c4b; /* Colore messaggio utente (verde WhatsApp) */
    color: #e9edef;
    border-top-right-radius: 0;
}

.message-text {
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    margin-top: 4px;
    text-align: right;
}

/* Area Input */
.chat-input-area {
    background: #1f2c33;
    padding: 10px 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #2a2f32;
}

.chat-input {
    flex: 1;
    background: #2a3942;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    color: #e9edef;
    font-size: 15px;
    outline: none;
}

.chat-input::placeholder {
    color: #8696a0;
}

.send-button {
    background: #00a884;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-button:hover {
    background: #06cf9c;
}

.send-button:disabled {
    background: #2a3942;
    cursor: not-allowed;
}

/* Indicatore di digitazione */
.typing-indicator {
    display: none;
    padding: 10px 15px;
    background: #1f2c33;
    border-radius: 8px;
    border-top-left-radius: 0;
    max-width: 75%;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #8696a0;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        border-radius: 20px;
    }

    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }
}

/* Stili aggiunti per i loghi e attribuzione */

.chat-header .chat-logo {
    background: none;
    padding: 0;
}

.header-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.chat-attribution {
    text-align: center;
    padding: 8px 15px;
    background: #1f2c33;
    border-top: 1px solid #2a2f32;
    color: #8696a0;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.chat-attribution img {
    height: 12px;
    vertical-align: middle;
}