/* Floating selection button and options panel.
   Kept in its own file so the same styles can be injected by an opt-in
   content script later without pulling in the whole site stylesheet. */

/* The hidden attribute must win over the display rules below; without this,
   `display: flex` overrides the browser default and the button stays visible. */
.tp-float-btn[hidden],
.tp-panel[hidden] {
  display: none !important;
}

.tp-float-btn {
  position: absolute;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
  cursor: pointer;
  animation: tp-pop 120ms ease-out;
}

.tp-float-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 14px rgb(0 0 0 / 24%);
}

.tp-float-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tp-float-btn.has-findings {
  border-color: var(--danger);
}

@keyframes tp-pop {
  from {
    opacity: 0;
    transform: translateY(-3px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tp-float-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font: 600 10px/16px "Segoe UI", system-ui, sans-serif;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Panel ------------------------------------------------------------------ */

.tp-panel {
  position: absolute;
  z-index: 901;
  width: 268px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 28px rgb(0 0 0 / 22%);
  font: 13px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--fg);
  animation: tp-pop 130ms ease-out;
}

.tp-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tp-panel-head strong {
  font-size: 13.5px;
}

.tp-panel-summary {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.tp-panel-summary.found {
  color: var(--danger);
  font-weight: 600;
}

.tp-panel-rules {
  max-height: 232px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.tp-panel-group {
  margin: 10px 0 4px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.tp-panel-group:first-child {
  margin-top: 0;
}

.tp-panel-rule {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
  line-height: 1.35;
}

.tp-panel-rule input {
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.tp-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tp-btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tp-btn:hover {
  border-color: var(--muted);
}

.tp-btn-primary {
  flex: 1 1 auto;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tp-btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.tp-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
