/* ClearDNS DNS Leak Test — Design tokens from cleardns-website/public/globals.css */

:root {
  --template-colors-1: #f9f9f9;
  --template-colors-2: rgba(255,255,255,1);
  --template-colors-3: rgba(29,29,29,0.025);
  --template-colors-text: rgba(29,29,29,1);
  --template-colors-text-muted: rgba(29,29,29,0.5);
  --template-colors-divider: color-mix(in srgb, var(--template-colors-text) 12%, transparent);
  --template-colors-toggle-bg: rgba(29,29,29,0.05);
  --template-colors-toggle-knob: rgba(255,255,255,1);

  --primary: rgba(60,109,234,1);
  --success: rgba(56,177,133,1);
  --warning: rgba(255,149,0,1);
  --danger: rgba(234,72,66,1);

  --font-family: "Segoe UI", "Inter", Inter, system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}

.theme-dark {
  --primary: rgba(79,127,255,1);
  --template-colors-1: #1D1D1D;
  --template-colors-2: rgba(255,255,255,0.03);
  --template-colors-3: rgba(255,255,255,0.03);
  --template-colors-text: rgba(255,255,255,1);
  --template-colors-text-muted: rgba(255,255,255,0.4);
  --template-colors-divider: color-mix(in srgb, var(--template-colors-text) 16%, transparent);
  --template-colors-toggle-bg: rgba(255,255,255,0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) {
    --primary: rgba(79,127,255,1);
    --template-colors-1: #1D1D1D;
    --template-colors-2: rgba(255,255,255,0.03);
    --template-colors-3: rgba(255,255,255,0.03);
    --template-colors-text: rgba(255,255,255,1);
    --template-colors-text-muted: rgba(255,255,255,0.4);
    --template-colors-divider: color-mix(in srgb, var(--template-colors-text) 16%, transparent);
    --template-colors-toggle-bg: rgba(255,255,255,0.12);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font-family);
  background: var(--template-colors-1);
  color: var(--template-colors-text);
  letter-spacing: -0.03em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

/* ── Theme Toggle — pill with sun/moon ── */
.theme-toggle {
  width: 52px;
  height: 28px;
  border-radius: 9999px;
  background-color: var(--template-colors-toggle-bg);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}
.theme-dark .theme-toggle { justify-content: flex-end; }
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .theme-toggle { justify-content: flex-end; }
}
.theme-toggle-knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--template-colors-toggle-knob);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-knob svg {
  width: 14px;
  height: 14px;
  color: var(--template-colors-text-muted);
}
/* Show sun by default (light mode), moon in dark */
.icon-moon { display: none; }
.icon-sun { display: block; }
.theme-dark .icon-moon { display: block; }
.theme-dark .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .icon-moon { display: block; }
  :root:not(.theme-light) .icon-sun { display: none; }
}

/* ── Hero Card — dark with animated nodes ── */
.hero-card {
  background-color: rgba(13,13,13,1);
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 90% 80%, rgba(60,109,234,0.2), transparent);
}
.hero-content { position: relative; z-index: 1; }
.hero-card h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  margin-bottom: 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.04em;
}
.hero-desc {
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 420px;
}

/* ── Hero Animated Nodes ── */
.hero-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.node {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(60,109,234,0.6);
  box-shadow: 0 0 8px rgba(60,109,234,0.4);
}
.node::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(60,109,234,0.15);
  animation: nodeRing 3s ease-in-out infinite;
}
.n1 { top: 18%; left: 72%; animation: nodePulse 4s ease-in-out infinite; }
.n2 { top: 35%; left: 85%; animation: nodePulse 3.5s ease-in-out 0.5s infinite; }
.n3 { top: 60%; left: 78%; animation: nodePulse 4.2s ease-in-out 1s infinite; }
.n4 { top: 75%; left: 90%; animation: nodePulse 3.8s ease-in-out 1.5s infinite; }
.n5 { top: 25%; left: 92%; animation: nodePulse 4.5s ease-in-out 0.8s infinite; }
.n6 { top: 50%; left: 65%; animation: nodePulse 3.2s ease-in-out 2s infinite; }

.line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60,109,234,0.2), transparent);
  transform-origin: left center;
}
.l1 { top: 20%; left: 65%; width: 25%; transform: rotate(10deg); animation: lineShine 5s ease-in-out infinite; }
.l2 { top: 38%; left: 73%; width: 18%; transform: rotate(-15deg); animation: lineShine 4s ease-in-out 1s infinite; }
.l3 { top: 55%; left: 66%; width: 20%; transform: rotate(25deg); animation: lineShine 6s ease-in-out 0.5s infinite; }
.l4 { top: 68%; left: 78%; width: 15%; transform: rotate(-8deg); animation: lineShine 4.5s ease-in-out 2s infinite; }
.l5 { top: 30%; left: 80%; width: 16%; transform: rotate(30deg); animation: lineShine 5.5s ease-in-out 1.5s infinite; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}
@keyframes nodeRing {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 1; transform: scale(2); }
}
@keyframes lineShine {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.5; }
}

/* ── Stats Row — 3 columns ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stat-item {
  background: var(--template-colors-2);
  border-radius: 1rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--template-colors-text-muted);
  font-weight: 500;
}
.stat-value {
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── Action Button — full width, pill shape ── */
.action-row {
  margin-bottom: 1rem;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 32px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.03em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  line-height: 1.25;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Status Line ── */
.status-line {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.status-line .status-value.running { color: var(--primary); }
.status-line .status-value.done { color: var(--success); }
.status-line .status-value.leak { color: var(--warning); }

/* ── Cards — no border, no shadow, just background ── */
.card {
  background: var(--template-colors-2);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}
.card-subtitle {
  font-size: 0.8125rem;
  color: var(--template-colors-text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.card-text {
  font-size: 0.8125rem;
  color: var(--template-colors-text-muted);
  line-height: 1.625;
}
.card-text strong {
  color: var(--template-colors-text);
  font-weight: 600;
}

/* ── DNS Capabilities — 4 stat cards ── */
.caps-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.cap-card {
  background: var(--template-colors-2);
  border-radius: 1rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.cap-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--template-colors-text-muted);
}
.cap-value.pass { color: var(--success); }
.cap-value.fail { color: var(--danger); }
.cap-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--template-colors-text-muted);
  font-weight: 500;
}

/* ── Your IP Card ── */
.ip-card-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ip-flag {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.ip-info {
  flex: 1;
  min-width: 0;
}
.ip-isp {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ip-location {
  font-size: 0.75rem;
  color: var(--template-colors-text-muted);
  margin-top: 1px;
}
.ip-addr-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 4px;
}
.ip-addr {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0;
  color: var(--template-colors-text);
}
.ip-proto-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.ip-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--template-colors-text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.ip-copy-btn:hover { color: var(--primary); }
.ip-copy-btn svg { width: 14px; height: 14px; }
.ip-ptr {
  font-size: 0.625rem;
  color: var(--primary);
  font-family: var(--font-mono);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── DNSSEC Table ── */
.dnssec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.dnssec-table th {
  font-weight: 600;
  font-size: 0.6875rem;
  color: var(--template-colors-text-muted);
  text-align: center;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--template-colors-divider);
  line-height: 1.3;
}
.dnssec-table th:first-child { text-align: left; }
.dnssec-table td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--template-colors-divider);
  font-size: 0.75rem;
}
.dnssec-table td:first-child {
  font-weight: 500;
  color: var(--template-colors-text-muted);
}
.dnssec-table tr:last-child td { border-bottom: none; }
.ds-cell {
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.ds-pass { color: var(--success); }
.ds-fail { color: var(--danger); }

/* ── Resolver Row ── */
.resolver-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--template-colors-divider);
  animation: slideIn 0.3s ease;
}
.resolver-row:last-child { border-bottom: none; }
.resolver-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
}
.resolver-icon.dns {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.resolver-details {
  flex: 1;
  min-width: 0;
}
.resolver-ip {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.resolver-meta {
  font-size: 0.6875rem;
  color: var(--template-colors-text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resolver-ptr {
  font-size: 0.5625rem;
  color: var(--primary);
  font-family: var(--font-mono);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resolver-proto {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--template-colors-3);
  color: var(--template-colors-text-muted);
}

/* ── Resolver Badge ── */
.resolver-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}
.resolver-badge.ok {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}
.resolver-badge.warn {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
}

/* ── Empty State ── */
.empty-state {
  padding: 1.5rem 0;
  text-align: center;
  color: var(--template-colors-text-muted);
  font-size: 0.8125rem;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 1rem 0;
  font-size: 0.75rem;
  color: var(--template-colors-text-muted);
}
.footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.footer a:hover { text-decoration: underline; }

/* ── Animations ── */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .hero-card { padding: 1.5rem 1rem; }
  .hero-card h1 { font-size: 1.375rem; }
  .caps-row { grid-template-columns: repeat(2, 1fr); }
  .dnssec-table { font-size: 0.6875rem; }
  .dnssec-table th, .dnssec-table td { padding: 0.25rem 0.375rem; }
}
