/* RDAP/WHOIS lookup tool — scoped under .rdap-tool so nothing here can collide
   with the rest of the site. Uses the site's existing --bg/--surface/--text/
   --muted/--border/--blue tokens (already themed by style.css) plus a few
   status colours defined locally, tinted per-theme via color-mix() so pills/
   borders/status-lines stay correct in both light and dark automatically. */

.rdap-tool {
  --rdap-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --rdap-ok: #1a7f37;
  --rdap-warn: #9a6700;
  --rdap-err: #cf222e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rdap-tool {
    --rdap-ok: #3fb950;
    --rdap-warn: #d29922;
    --rdap-err: #f85149;
  }
}
:root[data-theme="dark"] .rdap-tool {
  --rdap-ok: #3fb950;
  --rdap-warn: #d29922;
  --rdap-err: #f85149;
}

.rdap-tool .disclaimer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 24px;
}
.rdap-tool .disclaimer p { margin: 0 0 8px; }
.rdap-tool .disclaimer p:last-child { margin-bottom: 0; }

.rdap-tool .tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.rdap-tool .tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-family: inherit;
}
.rdap-tool .tab-btn:hover { color: var(--text); }
.rdap-tool .tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.rdap-tool .badge {
  display: inline-block;
  background: var(--border);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 1px 7px;
  margin-left: 4px;
}
/* Unseen dropping-domain alerts — deliberately louder than the neutral .badge above. */
.rdap-tool .badge.badge-alert {
  background: var(--rdap-err);
  color: #fff;
  font-weight: 700;
}
.rdap-tool .tab-panel[hidden] { display: none; }

.rdap-tool form.row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.rdap-tool .toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* Background/text colour for these come from the site-wide input/select/textarea
   rule in style.css — only layout + the monospace font are added here. */
.rdap-tool input[type="text"],
.rdap-tool textarea {
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--rdap-mono);
  min-width: 180px;
}
.rdap-tool textarea { min-height: 110px; resize: vertical; }
.rdap-tool input[type="text"]:focus,
.rdap-tool textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.rdap-tool button {
  padding: 10px 20px;
  font-size: 0.95rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  font-family: inherit;
}
.rdap-tool button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.rdap-tool button.small { padding: 5px 10px; font-size: 0.78rem; font-weight: 500; }
.rdap-tool button:disabled { opacity: 0.6; cursor: default; }
.rdap-tool button:hover:not(:disabled) { filter: brightness(1.08); }

.rdap-tool .status-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
  min-height: 1.2em;
}
.rdap-tool .status-line.err { color: var(--rdap-err); }

.rdap-tool .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.rdap-tool .card h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.rdap-tool .card .body { padding: 14px 16px; }

.rdap-tool dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.rdap-tool dl.kv dt { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.rdap-tool dl.kv dd { margin: 0; font-family: var(--rdap-mono); font-size: 0.9rem; word-break: break-word; }

.rdap-tool .pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.rdap-tool .pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent);
  color: var(--blue);
  font-size: 0.78rem;
  font-family: var(--rdap-mono);
}
.rdap-tool .pill.warn {
  background: color-mix(in srgb, var(--rdap-warn) 15%, transparent);
  border-color: color-mix(in srgb, var(--rdap-warn) 35%, transparent);
  color: var(--rdap-warn);
}
.rdap-tool .pill.ok {
  background: color-mix(in srgb, var(--rdap-ok) 15%, transparent);
  border-color: color-mix(in srgb, var(--rdap-ok) 35%, transparent);
  color: var(--rdap-ok);
}
.rdap-tool .pill.err {
  background: color-mix(in srgb, var(--rdap-err) 15%, transparent);
  border-color: color-mix(in srgb, var(--rdap-err) 35%, transparent);
  color: var(--rdap-err);
}

/* Extension filter pills (e.g. the "All / .com × 46 / .co.uk × 37" row above the
   tracked-domains table) are real <button> elements, not <span>, so they need a
   couple of native-button resets on top of the plain .pill look above. */
.rdap-tool .pill.pill-filter {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font: inherit;
}
.rdap-tool .pill.pill-filter:hover {
  background: color-mix(in srgb, var(--blue) 25%, transparent);
}
.rdap-tool .pill.pill-filter.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.rdap-tool .pill.pill-filter.active span { opacity: 0.85 !important; }

.rdap-tool ul.ns { margin: 0; padding-left: 18px; font-family: var(--rdap-mono); font-size: 0.9rem; }
.rdap-tool .entity-block { padding: 10px 0; border-top: 1px solid var(--border); }
.rdap-tool .entity-block:first-child { border-top: none; padding-top: 0; }
.rdap-tool .entity-role { font-size: 0.72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }
.rdap-tool details summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; padding: 10px 16px; }
.rdap-tool pre.raw {
  margin: 0;
  padding: 14px 16px;
  font-size: 0.78rem;
  overflow-x: auto;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-family: var(--rdap-mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.rdap-tool .empty-note { color: var(--muted); font-size: 0.85rem; }

.rdap-tool table.results-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rdap-tool table.results-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.rdap-tool table.results-table th.sortable { cursor: pointer; }
.rdap-tool table.results-table th.sortable:hover { color: var(--text); }
.rdap-tool table.results-table th .arrow { display: inline-block; width: 10px; opacity: 0.7; }
.rdap-tool table.results-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.rdap-tool table.results-table tr:last-child td { border-bottom: none; }
.rdap-tool table.results-table td.domain-cell { font-family: var(--rdap-mono); }
.rdap-tool table.results-table th:first-child,
.rdap-tool table.results-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.25);
}
.rdap-tool table.results-table th:last-child,
.rdap-tool table.results-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.25);
}

.rdap-tool .link-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  font-size: 0.82rem;
  text-decoration: underline;
  font-family: inherit;
}
.rdap-tool .actions-cell { display: flex; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.rdap-tool .help-text { font-size: 0.78rem; color: var(--muted); margin: -8px 0 16px; }

/* Dropping-domain rows with an unseen alert get a soft red wash so they stand out at a glance. */
.rdap-tool table.results-table tr.row-alert td {
  background: color-mix(in srgb, var(--rdap-err) 8%, transparent);
}
.rdap-tool table.results-table tr.row-alert td.domain-cell {
  font-weight: 600;
}

.rdap-tool .rdap-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 16px;
  cursor: pointer;
}
.rdap-tool .rdap-checkbox-label input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
  accent-color: var(--blue);
}

.rdap-intro { color: var(--muted); max-width: 720px; margin: 0 0 24px; }

/* ---- Educational / FAQ content below the tool ---- */
.rdap-info h2 { margin: 36px 0 12px; font-size: 1.25rem; color: var(--ink); scroll-margin-top: 16px; }
.rdap-info h2:first-child { margin-top: 0; }
.rdap-info p { max-width: 760px; }
.rdap-compare { max-width: 760px; padding-left: 20px; margin: 0 0 16px; }
.rdap-compare li { margin-bottom: 8px; color: var(--text); }

.rdap-status-codes { max-width: 760px; margin: 0 0 20px; }
.rdap-status-codes dt {
  font-family: var(--rdap-mono, monospace);
  font-weight: 600;
  color: var(--ink);
  background: var(--accent-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  margin-top: 14px;
  font-size: 0.88rem;
}
.rdap-status-codes dt:first-child { margin-top: 0; }
.rdap-status-codes dd { margin: 6px 0 0; color: var(--text); }
.rdap-faq-item { margin-bottom: 20px; max-width: 760px; }
.rdap-faq-item h3 { margin: 0 0 6px; font-size: 1rem; color: var(--ink); }
.rdap-faq-item p { margin: 0; color: var(--text); }
.rdap-callout {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 14px 18px;
  max-width: 760px;
  margin: 16px 0 28px;
}
.rdap-callout p { margin: 0 0 8px; }
.rdap-callout p:last-child { margin-bottom: 0; }

@media (max-width: 700px) {
  .rdap-tool table.results-table th:first-child,
  .rdap-tool table.results-table td:first-child,
  .rdap-tool table.results-table th:last-child,
  .rdap-tool table.results-table td:last-child {
    position: static;
    box-shadow: none;
  }
}
