/* Floating support widget -- bottom-right, pulsing to draw attention while
   closed. Uses the same design tokens as the rest of the site (tokens.css)
   so it re-themes automatically with the light/dark switch. */

.tv-sw { position: fixed; right: 20px; bottom: 20px; z-index: 400; }

.tv-sw-toggle {
  width: 56px; height: 56px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--mint); color: #06170f; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--mint) 45%, transparent);
  animation: tv-sw-pulse 2.4s ease-out infinite;
  position: relative;
}
.tv-sw-toggle:hover { filter: brightness(1.08); }
.tv-sw[data-open="true"] .tv-sw-toggle { animation: none; }

@keyframes tv-sw-pulse {
  0% { box-shadow: 0 6px 20px color-mix(in srgb, var(--mint) 45%, transparent), 0 0 0 0 color-mix(in srgb, var(--mint) 55%, transparent); }
  70% { box-shadow: 0 6px 20px color-mix(in srgb, var(--mint) 45%, transparent), 0 0 0 14px color-mix(in srgb, var(--mint) 0%, transparent); }
  100% { box-shadow: 0 6px 20px color-mix(in srgb, var(--mint) 45%, transparent), 0 0 0 0 color-mix(in srgb, var(--mint) 0%, transparent); }
}

.tv-sw-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--ember); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink);
}
/* every .tv-sw-* element toggled via the `hidden` attribute (JS sets
   el.hidden = true/false) needs this: an unconditional `display:...` above
   always beats the browser's default [hidden]{display:none} at equal
   specificity (author origin > user-agent origin) -- same bug class fixed
   repeatedly elsewhere on this site (.tv-account-menu, .ch-pos-detail,
   .vt-badge -- see docs/RULES.md "Правило на будущее"). Fell into it again
   here; fixing all three instances in this file at once this time. */
.tv-sw-badge[hidden] { display: none; }

.tv-sw-panel {
  position: absolute; right: 0; bottom: 68px; width: 340px; max-width: calc(100vw - 32px);
  max-height: min(520px, 70vh); display: flex; flex-direction: column;
  background: var(--ink-panel); border: 1px solid var(--ink-line); border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35); overflow: hidden;
}
.tv-sw-panel[hidden] { display: none; }

.tv-sw-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--ink-line); font-family: var(--font-display); font-weight: 700; font-size: 14px;
  color: var(--ink-text);
}
.tv-sw-x { background: none; border: none; color: var(--ink-text-soft); font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.tv-sw-x:hover { color: var(--ink-text); }

.tv-sw-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tv-sw-empty { text-align: center; margin: auto; }

.tv-sw-msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; }
.tv-sw-msg.mine { align-self: flex-end; background: var(--mint); color: #06170f; border-bottom-right-radius: 4px; }
.tv-sw-msg.reply { align-self: flex-start; background: var(--ink-panel-2); color: var(--ink-text); border-bottom-left-radius: 4px; }
.tv-sw-time { font-size: 10.5px; color: var(--ink-text-faint); margin-top: 2px; }

.tv-sw-form { border-top: 1px solid var(--ink-line); padding: 12px; }
.tv-sw-anon { margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.tv-sw-anon[hidden] { display: none; }
.tv-sw-anon .vt-input { padding: 8px 10px; font-size: 13px; }
.tv-sw-row { display: flex; gap: 8px; align-items: flex-end; }
.tv-sw-row textarea.vt-input { resize: none; min-height: 38px; max-height: 100px; padding: 9px 12px; font-size: 13.5px; }
.tv-sw-send {
  width: 38px; height: 38px; flex: none; border-radius: 999px; border: none; cursor: pointer;
  background: var(--mint); color: #06170f; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.tv-sw-send:disabled { opacity: 0.5; cursor: default; }
.tv-sw-err { color: var(--ember); font-size: 12.5px; margin: 8px 0 0; }

@media (max-width: 480px) {
  .tv-sw { right: 14px; bottom: 14px; }
  .tv-sw-panel { width: calc(100vw - 28px); bottom: 66px; }
}
