/* BuscaTools AI Assistant widget — glass dark theme */
.btb-ai-mount { --btb-ai-accent: var(--btb-primary, #2563eb); }

.btb-ai-empty {
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #664d03;
    font-size: 14px;
}

.btb-ai-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--btb-ai-accent);
    color: #fff;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: transform .2s ease;
}
.btb-ai-fab:hover { transform: scale(1.08); }

.btb-ai-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #f3f4f6;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.btb-ai-panel.is-open { display: flex; }
.btb-ai-panel--inline { position: static; display: flex; width: 100%; max-width: 720px; margin: 16px auto; max-height: 600px; }

@media (max-width: 600px) {
    .btb-ai-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
}

.btb-ai-header {
    padding: 14px 16px;
    background: var(--btb-ai-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}
.btb-ai-header__close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.btb-ai-body { display: flex; flex-direction: column; flex: 1; min-height: 320px; }
.btb-ai-consent {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
    line-height: 1.5;
}
.btb-ai-consent__ok {
    background: var(--btb-ai-accent);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btb-ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.btb-ai-msg { display: flex; }
.btb-ai-msg--user { justify-content: flex-end; }
.btb-ai-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}
.btb-ai-msg--user .btb-ai-bubble { background: var(--btb-ai-accent); color: #fff; border-bottom-right-radius: 4px; }
.btb-ai-msg--bot .btb-ai-bubble { background: rgba(255,255,255,0.1); color: #f3f4f6; border-bottom-left-radius: 4px; }
.btb-ai-bubble a { color: #93c5fd; text-decoration: underline; }

.btb-ai-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #9ca3af;
    border-radius: 50%;
    animation: btb-ai-blink 1.2s infinite;
}
.btb-ai-dot:nth-child(2) { animation-delay: .2s; }
.btb-ai-dot:nth-child(3) { animation-delay: .4s; }
@keyframes btb-ai-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.btb-ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.btb-ai-chip {
    background: rgba(255,255,255,0.08);
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
}
.btb-ai-chip:hover { background: rgba(255,255,255,0.18); }

.btb-ai-form { display: flex; padding: 10px 12px 12px; gap: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.btb-ai-input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}
.btb-ai-input:focus { border-color: var(--btb-ai-accent); }
.btb-ai-submit {
    background: var(--btb-ai-accent);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}
.btb-edit-preview--ai {
    padding: 16px;
    background: #f3f4f6;
    border: 1px dashed #9ca3af;
    border-radius: 8px;
}
