/* Pulsante "Segnala un problema": 40px sotto il pannello Mercato criptovalute, centrato con esso */
.bug-fab {
  position: absolute;
  top: 331px;
  left: calc(50% + 474px);
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: calc(168px + 1.4rem + 2px);
  gap: 0.4rem;
  background: linear-gradient(90deg, #22c55e, #3b82f6, #a855f7, #22c55e);
  background-size: 200% 200%;
  animation: bugFlow 6s ease infinite;
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.1s, filter 0.2s;
}
.bug-fab:hover { filter: brightness(1.12); }
.bug-fab:active { transform: translateX(-50%) scale(0.97); }
@keyframes bugFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .bug-fab { animation: none; }
}
.bug-fab svg { width: 18px; height: 18px; fill: currentColor; }

@media (max-width: 840px) {
  .bug-fab {
    position: fixed;
    top: auto;
    left: auto;
    right: 22px;
    bottom: 22px;
    transform: none;
  }
  .bug-fab:active { transform: scale(0.97); }
}

/* Pannello chat */
.bug-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 380px;
  max-width: 92vw;
  height: 78vh;
  max-height: 720px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  animation: bugSlideIn 0.18s ease;
}
@keyframes bugSlideIn {
  from { transform: translateX(18px); opacity: 0.35; }
  to { transform: translateX(0); opacity: 1; }
}
.bug-panel.hidden { display: none; }

.bug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: #0b1120;
  border-bottom: 1px solid #334155;
}
.bug-head .ttl { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #e2e8f0; }
.bug-head .ttl svg { width: 16px; height: 16px; fill: #4ade80; }
.bug-head small { display: block; color: #64748b; font-weight: 400; font-size: 0.7rem; }
.bug-close { background: transparent; border: none; color: #64748b; font-size: 1.2rem; cursor: pointer; line-height: 1; }
.bug-close:hover { color: #e2e8f0; }

.chat { flex: 1; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }
.msg { max-width: 88%; padding: 0.5rem 0.7rem; border-radius: 10px; font-size: 0.86rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { background: #0b1120; border: 1px solid #334155; color: #e2e8f0; align-self: flex-start; border-bottom-left-radius: 3px; }
.msg.user { background: #22c55e; color: #121212; align-self: flex-end; border-bottom-right-radius: 3px; }

.quick { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem 0.9rem; }
.quick button {
  background: #0b1120;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 16px;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.15s;
}
.quick button:hover { border-color: #22c55e; color: #fff; background: #172033; }

.inputrow { display: flex; gap: 0.4rem; padding: 0.6rem 0.9rem; border-top: 1px solid #334155; }
.inputrow input {
  flex: 1;
  background: #0b1120;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
}
.inputrow input:focus { outline: none; border-color: #22c55e; }
.inputrow button { background: #22c55e; border: none; color: #121212; border-radius: 8px; padding: 0 0.9rem; cursor: pointer; font-weight: 700; }
.inputrow button:hover { background: #16a34a; }
.inputrow.hidden, .quick.hidden { display: none; }

.summary { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.summary h4 { margin: 0; font-size: 0.9rem; color: #e2e8f0; }
.summary pre {
  background: #0b1120;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.72rem;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  color: #cbd5e1;
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.actions a.gl, .actions button.gl {
  border: 1px solid #16a34a;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  color: #121212;
  background: #22c55e;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.actions button.gl:disabled { opacity: 0.7; cursor: default; }
.actions button {
  border: 1px solid #334155;
  background: transparent;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.privacy { color: #64748b; font-size: 0.7rem; line-height: 1.4; }
