/* PINET Assistente - widget di chat */
.pinetbot {
  --pinetbot-accent: #e8501c;
  --pinetbot-bg: #ffffff;
  --pinetbot-text: #222222;
  --pinetbot-muted: #666666;
  --pinetbot-bubble: #f1f1f1;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
.pinetbot *, .pinetbot *::before, .pinetbot *::after { box-sizing: border-box; }

.pinetbot-launcher {
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--pinetbot-accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  margin-left: auto;
}
.pinetbot-launcher:focus-visible { outline: 3px solid #111; outline-offset: 2px; }

.pinetbot-panel {
  position: absolute; right: 0; bottom: 72px;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 110px);
  background: var(--pinetbot-bg); color: var(--pinetbot-text);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.pinetbot-panel[hidden] { display: none; }

.pinetbot-header {
  background: var(--pinetbot-accent); color: #fff;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between;
}
.pinetbot-title { font-weight: 700; font-size: 15px; }
.pinetbot-close {
  background: transparent; border: 0; color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}

.pinetbot-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pinetbot-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; word-wrap: break-word; overflow-wrap: anywhere; }
.pinetbot-assistant { background: var(--pinetbot-bubble); align-self: flex-start; border-bottom-left-radius: 4px; }
.pinetbot-user { background: var(--pinetbot-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.pinetbot-assistant a { color: var(--pinetbot-accent); text-decoration: underline; }
.pinetbot-typing { color: var(--pinetbot-muted); letter-spacing: 2px; }
.pinetbot-error { background: #fdecea; color: #8a1c13; }

.pinetbot-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e5e5; }
.pinetbot-input {
  flex: 1; resize: none; border: 1px solid #ccc; border-radius: 8px;
  padding: 8px; font: inherit; color: var(--pinetbot-text); background: #fff; min-height: 42px;
}
.pinetbot-input:focus { outline: 2px solid var(--pinetbot-accent); outline-offset: 0; border-color: transparent; }
.pinetbot-send {
  border: 0; border-radius: 8px; background: var(--pinetbot-accent); color: #fff;
  padding: 0 14px; font-weight: 600; cursor: pointer;
}
.pinetbot-send:disabled, .pinetbot-input:disabled { opacity: .6; cursor: not-allowed; }

.pinetbot-counter { font-size: 11px; color: var(--pinetbot-muted); padding: 0 12px; min-height: 0; }
.pinetbot-foot { font-size: 11px; color: var(--pinetbot-muted); padding: 4px 12px 10px; }
.pinetbot-foot a { color: var(--pinetbot-muted); }

@media (max-width: 480px) {
  .pinetbot { right: 12px; bottom: 12px; }
  .pinetbot-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); bottom: 68px; }
}
@media print { .pinetbot { display: none; } }
