/* ProxyPulse — premium dark website theme (matches the app's identity) */
:root {
  --bg: #0b1120;
  --bg-soft: #0e1730;
  --card: #121c30;
  --subcard: #182642;
  --inner: #1d2c4e;
  --line: #26355c;
  --text: #eef2ff;
  --sub: #b9c4de;
  --muted: #8494b8;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --green: #22c55e;
  --lime: #84cc16;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #06b6d4;
  --teal: #14b8a6;
  --blue: #3b82f6;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(2, 6, 18, 0.45);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win: class rules like .busy
   { display: flex } otherwise override the browser's built-in
   [hidden] style and keep "hidden" elements (the loading spinner,
   toasts, notes) visible at all times. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 480px at 85% -120px, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(900px 420px at -10% 0, rgba(99, 102, 241, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.30), rgba(139, 92, 246, 0.20) 55%, rgba(34, 197, 94, 0.08));
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 34px;
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo { width: 58px; height: 58px; flex: none; filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.45)); }
.logo.small { width: 46px; height: 46px; }
.brand-text h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, #fff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { margin: 2px 0 0; color: var(--sub); font-size: 15.5px; }
.hero-sub { margin: 18px 0 0; max-width: 720px; color: var(--sub); font-size: 15px; }

/* ---------- tabs ---------- */
.tabs {
  max-width: 1080px;
  width: 100%;
  margin: 22px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--sub);
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); border-color: var(--indigo); }
.tab.active {
  background: linear-gradient(120deg, var(--indigo), var(--violet));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

/* ---------- layout & cards ---------- */
.container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 40px;
  flex: 1;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card-title { margin: 18px 0 10px; font-size: 17px; }
.card-title:first-child { margin-top: 0; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 7px;
}
.field-label:first-child { margin-top: 0; }

textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; }
textarea:focus, input:focus, select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
select { width: auto; cursor: pointer; }

.preview {
  margin-top: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  color: var(--sub);
  background: var(--subcard);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  word-break: break-all;
}
.note-amber {
  margin-top: 10px;
  font-size: 13.5px;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 10px;
  padding: 9px 12px;
}

.row-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.proto-label { display: flex; align-items: center; gap: 9px; color: var(--sub); font-size: 14px; margin-right: auto; }

.btn-primary {
  appearance: none;
  border: none;
  background: linear-gradient(120deg, var(--indigo), var(--violet));
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 26px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-ghost {
  appearance: none;
  background: var(--subcard);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--indigo); }
.btn-ghost:disabled { opacity: 0.5; cursor: default; }

.btn-copy {
  appearance: none;
  flex: none;
  background: var(--inner);
  border: 1px solid var(--line);
  color: var(--sub);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-copy:hover { color: #fff; border-color: var(--green); }

.muted { color: var(--muted); font-size: 13.5px; }
.status-ok { color: var(--green); font-weight: 600; margin: 6px 0; }
.credit { text-align: center; color: var(--muted); font-size: 13px; margin: 22px 0 0; }

/* ---------- busy / progress ---------- */
.busy { display: flex; align-items: center; gap: 12px; color: var(--sub); padding: 14px 4px; }
.spinner {
  width: 20px; height: 20px; flex: none;
  border: 3px solid var(--line);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  position: relative;
  margin-top: 16px;
  background: var(--subcard);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 26px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  transition: width 0.25s ease;
}
.progress span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ---------- result cards ---------- */
.result-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.result-head {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  padding: 22px;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.07));
  border-bottom: 1px solid var(--line);
}
.gauge-wrap { text-align: center; flex: none; }
.gauge { width: 128px; height: 128px; }
.gauge .track { stroke: #22325a; }
.gauge .value { font-size: 30px; font-weight: 800; fill: var(--text); }
.gauge-caption { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); margin-top: 2px; }
.verdict { font-size: 17px; font-weight: 800; margin-top: 2px; }
.verdict.excellent, .verdict.good { color: var(--green); }
.verdict.fair { color: var(--amber); }
.verdict.risky { color: var(--red); }

.head-main { flex: 1; min-width: 260px; }
.fraud-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 8px; }
.fraud-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(38, 53, 92, 0.8);
}
.fraud-row:last-of-type { border-bottom: none; }
.fraud-provider { color: var(--sub); font-weight: 600; min-width: 128px; }
.fraud-big { font-size: 27px; font-weight: 800; line-height: 1; }
.fraud-risk { color: var(--muted); font-size: 13.5px; }
.fraud-error { color: var(--red); font-size: 13.5px; }
.badge {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #052e12;
  background: linear-gradient(120deg, #4ade80, var(--green));
}
.badge.warn { background: linear-gradient(120deg, #fbbf24, var(--amber)); color: #3a2703; }
.badge.bad { background: linear-gradient(120deg, #f87171, var(--red)); color: #3d0a0a; }
.badge.neutral { background: var(--inner); color: var(--sub); border: 1px solid var(--line); }
.evidence { color: var(--muted); font-size: 12.5px; margin-top: 7px; }

.result-error {
  padding: 20px 22px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  font-weight: 600;
  word-break: break-word;
}
.result-error .err-title { color: var(--red); font-weight: 800; letter-spacing: 0.08em; font-size: 12.5px; display: block; margin-bottom: 5px; }

.subcards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 18px;
}
.subcard {
  background: var(--subcard);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 0;
}
.subcard.wide { grid-column: 1 / -1; }
.subcard h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subcard h3::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent, var(--indigo));
  flex: none;
}
.acc-location { --accent: var(--blue); }
.acc-address { --accent: var(--teal); }
.acc-isp { --accent: var(--violet); }
.acc-scores { --accent: var(--green); }
.acc-detection { --accent: var(--amber); }
.acc-dns { --accent: var(--cyan); }
.acc-session { --accent: #64748b; }

.kv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6.5px 0;
  border-bottom: 1px solid rgba(38, 53, 92, 0.55);
}
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--muted); font-size: 13.5px; flex: 0 0 128px; }
.kv-value { flex: 1; font-weight: 600; font-size: 14.5px; word-break: break-word; min-width: 0; }
.kv-value.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; }

.address-full {
  background: var(--inner);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.address-full span { flex: 1; font-weight: 600; word-break: break-word; }
.caption { color: var(--muted); font-size: 12.5px; margin-top: 9px; }

.comp-line { color: var(--sub); font-size: 13px; padding: 2.5px 0 2.5px 14px; }
.det-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(38, 53, 92, 0.55); }
.det-row:last-of-type { border-bottom: none; }
.det-name { color: var(--sub); font-size: 14px; }
.pill {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 3.5px 11px;
  border-radius: 999px;
}
.pill.detected { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }
.pill.clean { background: rgba(34, 197, 94, 0.13); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.45); }
.pill.nodata { background: var(--inner); color: var(--muted); border: 1px solid var(--line); }

.samples-list { margin: 10px 0 0; padding-left: 20px; color: var(--sub); font-size: 14px; }
.samples-list li { padding: 2px 0; }

/* ---------- bulk & history lists ---------- */
.group-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: var(--subcard);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.group-head h3 { margin: 0; font-size: 16px; }
.group-count {
  background: var(--inner);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
}
.group-head .btn-copy, .group-head .btn-ghost { margin-left: auto; }
.group-zero .group-head { background: rgba(34, 197, 94, 0.10); }
.group-high .group-head, .group-failed .group-head { background: rgba(239, 68, 68, 0.08); }

.bulk-row { border-bottom: 1px solid rgba(38, 53, 92, 0.6); }
.bulk-row:last-child { border-bottom: none; }
.bulk-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.bulk-proxy { font-family: ui-monospace, Consolas, monospace; font-size: 13px; flex: 1; min-width: 220px; word-break: break-all; }
.score-chip {
  font-weight: 800;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--inner);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.score-chip.s0 { color: #86efac; border-color: rgba(34, 197, 94, 0.5); }
.score-chip.slow { color: #bef264; }
.score-chip.smed { color: #fcd34d; border-color: rgba(245, 158, 11, 0.5); }
.score-chip.shigh { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }
.btn-expand {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--sub);
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
}
.btn-expand:hover { color: #fff; border-color: var(--indigo); }
.bulk-details { padding: 4px 14px 14px; }
.bulk-details .result-card { box-shadow: none; margin-bottom: 4px; }

.history-head { margin: 0 0 16px; }
.history-head .muted { margin-right: auto; }
.history-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.history-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  flex-wrap: wrap;
  cursor: pointer;
}
.history-main:hover { background: var(--subcard); }
.history-when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.history-details { padding: 4px 14px 14px; }
.history-details .result-card { box-shadow: none; margin-bottom: 4px; }
.empty-note { color: var(--muted); text-align: center; padding: 34px 0; }

/* ---------- about & footer ---------- */
.about-head { display: flex; align-items: center; gap: 14px; }
.about-name { font-size: 19px; font-weight: 800; }
.about-tagline { font-weight: 700; margin: 14px 0 4px; }
.about-credit { font-weight: 700; margin: 14px 0 2px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px 26px;
  display: flex;
  gap: 10px 26px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #1d2c4e;
  border: 1px solid var(--green);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .subcards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brand-text h1 { font-size: 27px; }
  .hero-inner { padding: 30px 18px 26px; }
  .container, .tabs { padding-left: 14px; padding-right: 14px; }
  .kv-label { flex-basis: 104px; }
  .result-head { padding: 18px; gap: 16px; }
  .fraud-provider { min-width: 104px; }
}
