/* Stili PolpoBot V3 */
#polpobot-container { position: fixed; bottom: 20px; right: 20px; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#polpobot-toggle { background-color: #009688; color: white; border: none; border-radius: 50px; padding: 14px 24px; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 150, 136, 0.3); transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; }
#polpobot-toggle:hover { background-color: #00796b; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 150, 136, 0.4); }
#polpobot-chat-window { position: absolute; bottom: 70px; right: 0; width: 380px; height: 550px; max-height: calc(100vh - 100px); background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-origin: bottom right; border: 1px solid #e0f2f1; }
#polpobot-chat-window.polpobot-hidden { opacity: 0; transform: scale(0.8); pointer-events: none; }
#polpobot-header { background: linear-gradient(135deg, #009688 0%, #00acc1 100%); color: #ffffff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 16px; }
.polpobot-header-actions { display: flex; gap: 10px; align-items: center; }
#polpobot-close, #polpobot-reset { background: none; border: none; color: white; cursor: pointer; line-height: 1; opacity: 0.8; transition: opacity 0.2s, transform 0.2s; padding: 0; }
#polpobot-close { font-size: 28px; } #polpobot-reset { font-size: 18px; }
#polpobot-close:hover, #polpobot-reset:hover { opacity: 1; transform: scale(1.1); }
#polpobot-messages { flex-grow: 1; padding: 20px; overflow-y: auto; background-color: #f8fcfc; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.polpobot-message { max-width: 88%; padding: 14px 18px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; word-wrap: break-word; animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.polpobot-message.bot { background-color: #ffffff; color: #333333; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.04); border: 1px solid #f0f0f0; }
.polpobot-message.user { background-color: #00acc1; color: #ffffff; align-self: flex-end; border-bottom-right-radius: 4px; box-shadow: 0 4px 15px rgba(0, 172, 193, 0.2); }
.polpobot-citations { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,0.06); font-size: 11.5px; color: #666; }
.polpobot-citations a { color: #009688; text-decoration: none; font-weight: 500; } .polpobot-citations a:hover { text-decoration: underline; }
.polpobot-actions-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.polpobot-quick-action { background-color: #e0f2f1; color: #00796b; padding: 8px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600; text-decoration: none; transition: all 0.2s ease; border: 1px solid transparent; cursor:pointer; }
.polpobot-quick-action:hover { background-color: #b2dfdb; border-color: #009688; transform: translateY(-1px); }
.polpobot-message.bot.typing { background-color: transparent; box-shadow: none; border:none; padding: 5px 10px; }
.typing-indicator { display: flex; gap: 4px; padding: 10px 15px; background: #fff; border-radius: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); width: fit-content; }
.typing-indicator span { width: 8px; height: 8px; background-color: #009688; border-radius: 50%; animation: typing 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; } .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
#polpobot-input-area { padding: 15px; background-color: #ffffff; border-top: 1px solid #f0f0f0; display: flex; gap: 10px; align-items: center; }
#polpobot-input { flex-grow: 1; padding: 12px 18px; border: 1px solid #e0e0e0; border-radius: 24px; outline: none; font-size: 14.5px; background-color: #f9f9f9; transition: all 0.3s ease; }
#polpobot-input:focus { border-color: #009688; background-color: #ffffff; box-shadow: 0 0 0 3px rgba(0,150,136,0.1); }
#polpobot-send { background-color: #009688; color: white; border: none; border-radius: 24px; padding: 12px 22px; cursor: pointer; font-weight: 600; font-size: 14.5px; transition: all 0.2s ease; }
#polpobot-send:hover { background-color: #00796b; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,150,136,0.2); }
#polpobot-send:active { transform: scale(0.95); } #polpobot-send:disabled { background-color: #cccccc; cursor: not-allowed; transform: none; box-shadow:none; }
#polpobot-privacy-note { font-size: 10px; text-align: center; color: #999; padding: 5px 15px 10px; background: #fff; }
#polpobot-messages::-webkit-scrollbar { width: 6px; } #polpobot-messages::-webkit-scrollbar-track { background: transparent; } #polpobot-messages::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 10px; } #polpobot-messages::-webkit-scrollbar-thumb:hover { background: #aaaaaa; }
@media screen and (max-width: 600px) {
    #polpobot-chat-window { position: fixed; width: 100vw; height: 100dvh; max-height: 100dvh; bottom: 0; right: 0; border-radius: 0; z-index: 999999; }
    #polpobot-toggle { bottom: 15px; right: 15px; }
    .polpobot-toggle-text { display: none; }
}

/* Nuvoletta teaser PolpoBot */
#polpobot-teaser {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 245px;
    background: #ffffff;
    color: #123;
    border-radius: 18px;
    padding: 14px 42px 14px 16px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
    border: 1px solid #dff3f1;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transform-origin: bottom right;
    animation: polpobotTeaserIn 0.45s ease forwards, polpobotTeaserPulse 2.6s ease-in-out 0.7s infinite;
    z-index: 1000000;
}

#polpobot-teaser::after {
    content: "";
    position: absolute;
    right: 28px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-right: 1px solid #dff3f1;
    border-bottom: 1px solid #dff3f1;
    transform: rotate(45deg);
}

.polpobot-teaser-hidden {
    display: none !important;
}

.polpobot-teaser-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #009688 0%, #00acc1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex: 0 0 38px;
}

.polpobot-teaser-text {
    font-size: 14px;
    line-height: 1.35;
}

.polpobot-teaser-text strong {
    color: #009688;
}

#polpobot-teaser-close {
    position: absolute;
    top: 7px;
    right: 10px;
    border: none;
    background: transparent;
    color: #789;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#polpobot-teaser-close:hover {
    color: #009688;
}

@keyframes polpobotTeaserIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes polpobotTeaserPulse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

@media screen and (max-width: 600px) {
    #polpobot-teaser {
        right: 0;
        bottom: 68px;
        width: 225px;
        padding: 13px 38px 13px 14px;
    }
}
