/* ============================================
   Domain Analyzer Tools
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #f8fbe9;
  --panel: #f2f7da;
  --panel-2: #e6efc3;
  --border: #afbd84;
  --border-strong: #8ea36a;
  --text: #1a2410;
  --muted: #4a5535;
  --head: #3d5c1e;
  --link: #2a5090;
  --pass: #1a6b1a;
  --warn: #8a5500;
  --fail: #a63a2f;
  --info: #1a5276;
  --nav-bg: #3a5a1c;
  --nav-text: #e8f5d0;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Verdana, Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Top Navigation --- */
.top-nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 0;
  border-bottom: 3px solid #2a4510;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.top-nav__brand {
  color: var(--nav-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav__brand:hover { opacity: 0.9; text-decoration: none; }

.top-nav__links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-nav__links a {
  color: #c8e0a0;
  font-size: 12px;
  text-decoration: none;
}

.top-nav__links a:hover { color: #fff; text-decoration: underline; }

.top-nav__search {
  flex: 1;
  max-width: 420px;
  min-width: 0;
}

.nav-search-form {
  display: flex;
  gap: 4px;
}

.nav-search-input {
  flex: 1;
  border: 1px solid #5a7a30;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  min-width: 0;
}

.nav-search-btn {
  background: #7cb342;
  color: #fff;
  border: 1px solid #5a8a20;
  border-radius: 3px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.nav-search-btn:hover { background: #689f38; }

/* --- Main Shell --- */
.legacy-shell {
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
  padding: 20px 24px 28px;
  flex: 1;
}

/* --- Hero Section --- */
.hero-box {
  text-align: center;
  padding: 32px 20px;
  margin-bottom: 16px;
}

.hero-title {
  margin: 0 0 10px;
  color: var(--head);
  font-size: 28px;
  line-height: 1.3;
}

.hero-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-form {
  display: flex;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto 12px;
}

.hero-input {
  flex: 1;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  min-width: 0;
}

.hero-input:focus {
  outline: none;
  border-color: var(--head);
  box-shadow: 0 0 0 3px rgba(95, 124, 58, 0.2);
}

.hero-btn {
  background: var(--head);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.hero-btn:hover { background: #2d4a12; }

.hero-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.hero-hint a { color: var(--link); }

/* --- Domain Header (scan page) --- */
.domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.domain-header__title {
  margin: 0;
  color: var(--head);
  font-size: 22px;
  word-break: break-word;
}

.domain-header__meta {
  color: var(--muted);
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

/* --- Share Button --- */
.header-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  text-align: center;
}

.action-btn:hover {
  text-decoration: none;
}

.action-btn--share {
  background: var(--head);
  color: #fff;
}

.action-btn--share:hover {
  background: #2d4a12;
}

.action-btn--share.copied {
  background: var(--pass);
}

.action-btn--rescan {
  background: #e8f5e9;
  color: var(--pass);
  border: 1px solid var(--pass);
}

.action-btn--rescan:hover {
  background: #c8e6c9;
}

/* --- Scan Footer Actions --- */
.scan-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.action-btn--new {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.action-btn--new:hover {
  background: #d4e4aa;
}

/* --- Health Badge --- */
.health-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid;
  flex-shrink: 0;
}

.health-badge__grade {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.health-badge__score {
  font-size: 11px;
  opacity: 0.85;
  font-weight: 600;
}

.grade-a { border-color: var(--pass); color: var(--pass); background: #e8f5e9; }
.grade-b { border-color: #558b2f; color: #33691e; background: #f1f8e9; }
.grade-c { border-color: #e6a800; color: #7a5800; background: #fff8e1; }
.grade-d { border-color: #e65100; color: #bf360c; background: #fff3e0; }
.grade-f { border-color: var(--fail); color: #b71c1c; background: #ffebee; }

/* --- Health Summary Bar --- */
.health-summary {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.health-summary__item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-right: 1px solid var(--border);
}

.health-summary__item:last-child { border-right: none; }

.health-summary__count {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.health-summary__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.health-summary__item--pass { background: #e8f5e9; color: var(--pass); }
.health-summary__item--warn { background: #fff8e1; color: var(--warn); }
.health-summary__item--fail { background: #ffebee; color: var(--fail); }
.health-summary__item--info { background: #e3f2fd; color: var(--info); }
.health-summary__item--total { background: var(--panel-2); color: var(--text); }

/* --- Section Navigation --- */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.section-nav__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 4px;
}

.section-nav__link {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.section-nav__link:hover {
  background: #d4e4aa;
  text-decoration: none;
}

/* --- Scan Timing --- */
.scan-timing {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 8px;
}

/* --- Legacy Box --- */
.legacy-title {
  margin: 0;
  color: var(--head);
  font-size: 26px;
}

.legacy-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legacy-toolbar {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px;
}

.legacy-box {
  border: 1px solid var(--border);
  background: var(--panel);
  margin-top: 10px;
}

.legacy-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  padding: 10px 14px;
}

.legacy-box-head h2,
.legacy-box-head h3 {
  margin: 0;
  color: var(--head);
  font-size: 14px;
}

.legacy-box-body {
  padding: 14px;
  overflow-x: auto;
}

.error-box {
  border-color: #cf9d95;
  background: #fff2ef;
}

/* --- Legacy Table --- */
.legacy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.legacy-table th,
.legacy-table td {
  border: 1px solid #d2dbb1;
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}

.legacy-table th {
  background: #edf3d1;
  color: #2a3a18;
  font-weight: 700;
  white-space: nowrap;
  font-size: 13px;
}

.legacy-table tr:nth-child(even) td { background: #fbfde8; }

/* Unresponsive nameserver row */
.legacy-table tr.ns-down td {
  background: #ffebee;
  border-color: #ef9a9a;
}

.legacy-table tr.ns-down td:first-child {
  font-weight: 700;
  color: var(--fail);
}

/* --- Test Table --- */
.test-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.test-row td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e8c8;
  vertical-align: top;
}

.test-row:last-child td { border-bottom: none; }

.test-row--pass { background: #eaf5dc; }
.test-row--warning { background: #fef9e0; }
.test-row--fail, .test-row--error { background: #fce8e5; }
.test-row--info { background: #e8f0fb; }

.test-icon {
  width: 28px;
  text-align: center;
  font-size: 14px;
}

.test-name {
  width: 200px;
  font-weight: 600;
  color: #2a3a18;
  font-size: 13px;
}

.test-detail {
  color: var(--text);
}

.test-desc {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.test-detail code {
  background: #e6efc3;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 11px;
  word-break: break-all;
}

/* --- Status Icons --- */
.si {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.si-pass { background: #4caf50; color: #fff; }
.si-fail { background: #e53935; color: #fff; }
.si-warn { background: #ff9800; color: #fff; }
.si-info { background: #2196f3; color: #fff; }

/* --- Status Dot (section headers) --- */
.status-dot { margin-right: 4px; }
.status-dot.status-pass { color: var(--pass); }
.status-dot.status-warning { color: var(--warn); }
.status-dot.status-fail { color: var(--fail); }
.status-dot.status-info { color: var(--info); }

/* --- Status Text --- */
.status-pass { color: var(--pass); font-weight: 700; font-size: 13px; }
.status-warning { color: var(--warn); font-weight: 700; font-size: 13px; }
.status-fail { color: var(--fail); font-weight: 700; font-size: 13px; }
.status-info { color: var(--info); font-weight: 700; font-size: 13px; }

/* --- Info Table (key-value pairs) --- */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}

.info-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e8c8;
  vertical-align: top;
}

.info-table__label {
  width: 190px;
  font-weight: 700;
  color: #2a3a18;
  background: #edf3d1;
  white-space: nowrap;
  font-size: 13px;
}

.info-table__value {
  color: var(--text);
  word-break: break-word;
  font-size: 13px;
}

/* --- Record Group Title --- */
.record-group-title {
  margin: 12px 0 6px;
  color: var(--head);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.record-group-title:first-child { margin-top: 0; }

/* --- Tags (domain status) --- */
.tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  margin: 2px 2px;
  color: var(--text);
  word-break: break-word;
}

/* --- Misc --- */
.legacy-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.mono {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  word-break: break-all;
}

.muted { color: var(--muted); font-size: 12px; }

.legacy-pre {
  margin: 8px 0 0;
  overflow-x: auto;
  border: 1px solid #ccd7a5;
  background: #f9fcea;
  padding: 10px;
  color: #2a3a18;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.legacy-kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 6px 10px;
}

.legacy-kv dt { color: #2a3a18; font-weight: 700; font-size: 13px; }
.legacy-kv dd { margin: 0; word-break: break-word; font-size: 13px; }

.legacy-input,
.legacy-button {
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
}

.legacy-input {
  width: 100%;
  background: #fff;
  padding: 6px 7px;
}

.legacy-button {
  background: #c6dca1;
  color: #2a3a18;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.legacy-button:hover { background: #b5cc8e; }

/* --- Features Table (homepage) --- */
.features-table td { vertical-align: middle; }
.features-icon { font-size: 16px; text-align: center; }

/* --- Recent Scans Table --- */
.recent-scans-scroll {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.recent-scans-scroll thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.recent-scans-scroll .legacy-table {
  margin: 0;
}

.recent-scans-table td { vertical-align: middle; }
.recent-scans-table td:first-child a {
  font-weight: 600;
}

.health-badge-sm {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid;
}

.health-badge-sm.grade-a { border-color: var(--pass); color: var(--pass); background: #e8f5e9; }
.health-badge-sm.grade-b { border-color: #558b2f; color: #33691e; background: #f1f8e9; }
.health-badge-sm.grade-c { border-color: #e6a800; color: #7a5800; background: #fff8e1; }
.health-badge-sm.grade-d { border-color: #e65100; color: #bf360c; background: #fff3e0; }
.health-badge-sm.grade-f { border-color: var(--fail); color: #b71c1c; background: #ffebee; }

/* --- How it works --- */
.how-it-works {
  margin: 0;
  padding-left: 24px;
}

.how-it-works li {
  margin-bottom: 8px;
}

/* --- Error Page --- */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page__code {
  font-size: 80px;
  font-weight: 700;
  color: var(--head);
  margin: 0;
  line-height: 1;
}

.error-page__title {
  font-size: 24px;
  color: var(--text);
  margin: 16px 0 8px;
}

.error-page__desc {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 8px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.error-page__hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* --- Content Pages (About, Privacy, Contact) --- */
.content-page {
  max-width: 800px;
  margin: 0 auto;
}

.content-body {
  margin-top: 20px;
}

.content-body h2 {
  color: var(--head);
  font-size: 18px;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.content-body h2:first-child {
  margin-top: 0;
}

.content-body p {
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0;
}

.content-body ul {
  margin: 8px 0;
  padding-left: 24px;
}

.content-body li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 6px;
}

.content-body a {
  color: var(--link);
}

/* --- Header Row (scan page) --- */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row .legacy-input { min-width: 260px; flex: 1 1 260px; }

/* --- Footer --- */
.site-footer {
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  padding: 20px 16px;
  margin-top: 24px;
}

.site-footer__inner {
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.site-footer__inner p { margin: 4px 0; }
.site-footer__inner a { color: var(--link); }

.footer-sponsor-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.footer-sponsors {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.footer-sponsors a {
  display: inline-flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.footer-sponsors a:hover {
  opacity: 1;
}

.footer-sponsors img {
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

/* ============================================
   RESPONSIVE — Mobile First
   ============================================ */

/* --- Tablet (768px and below) --- */
@media (max-width: 768px) {
  .top-nav__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .top-nav__brand {
    text-align: center;
  }

  .top-nav__search {
    max-width: none;
  }

  .nav-search-input,
  .nav-search-btn {
    font-size: 14px;
    padding: 8px 12px;
  }

  .legacy-shell {
    padding: 12px 12px 20px;
  }

  .hero-box {
    padding: 24px 12px;
  }

  .hero-title {
    font-size: 24px;
  }

  .hero-form {
    flex-direction: column;
  }

  .hero-input {
    font-size: 16px; /* prevent iOS zoom */
  }

  .hero-btn {
    width: 100%;
    padding: 12px;
  }

  .domain-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .domain-header__right {
    align-self: flex-start;
  }

  .domain-header__title {
    font-size: 20px;
  }

  .health-badge {
    width: 64px;
    height: 64px;
  }

  .health-badge__grade {
    font-size: 20px;
  }

  .health-summary {
    flex-wrap: wrap;
  }

  .health-summary__item {
    min-width: 20%;
    flex: 1 1 20%;
  }

  .section-nav {
    gap: 4px;
    padding: 6px;
  }

  .section-nav__link {
    font-size: 10px;
    padding: 3px 6px;
  }

  /* Tables: horizontal scroll */
  .legacy-box-body {
    padding: 8px;
  }

  .legacy-table,
  .info-table,
  .test-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .info-table__label {
    width: 140px;
  }

  .test-name {
    width: 140px;
    min-width: 100px;
  }

  .legacy-kv {
    grid-template-columns: 140px 1fr;
  }
}

/* --- Mobile (480px and below) --- */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .top-nav__inner {
    padding: 10px;
  }

  .top-nav__brand {
    font-size: 14px;
  }

  .nav-search-form {
    flex-direction: column;
    gap: 6px;
  }

  .nav-search-btn {
    width: 100%;
  }

  .legacy-shell {
    padding: 10px 10px 18px;
  }

  .hero-box {
    padding: 18px 10px;
  }

  .hero-title {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .hero-input {
    padding: 12px;
    font-size: 16px;
  }

  .hero-btn {
    padding: 14px;
    font-size: 15px;
  }

  .domain-header__title {
    font-size: 20px;
    word-break: break-word;
  }

  .health-badge {
    width: 60px;
    height: 60px;
  }

  .health-badge__grade {
    font-size: 20px;
  }

  .health-badge__score {
    font-size: 11px;
  }

  .health-summary__item {
    min-width: 45%;
    flex: 1 1 45%;
  }

  .health-summary__count {
    font-size: 20px;
  }

  .section-nav {
    gap: 5px;
  }

  .section-nav__link {
    font-size: 11px;
    padding: 4px 7px;
  }

  .legacy-box-head {
    padding: 8px 10px;
    gap: 6px;
  }

  .legacy-box-head h2,
  .legacy-box-head h3 {
    font-size: 13px;
  }

  .legacy-table th,
  .legacy-table td {
    padding: 6px 7px;
    font-size: 12px;
  }

  .info-table td {
    padding: 6px 7px;
    font-size: 12px;
  }

  .info-table__label {
    width: 130px;
    font-size: 12px;
  }

  .test-row td {
    padding: 6px 7px;
    font-size: 12px;
  }

  .test-name {
    width: auto;
    min-width: 0;
  }

  .test-icon {
    width: 24px;
  }

  .si {
    width: 18px;
    height: 18px;
    line-height: 18px;
    font-size: 11px;
  }

  .legacy-kv {
    grid-template-columns: 1fr;
  }

  .legacy-kv dt {
    margin-top: 6px;
  }

  .mono {
    font-size: 12px;
  }

  .tag {
    font-size: 10px;
    padding: 2px 5px;
  }

  .footer-sponsors {
    gap: 16px;
  }

  .footer-sponsors img {
    height: 24px;
    max-width: 130px;
  }

  /* Stack table cells on very small screens for certain tables */
  .legacy-table.auth-ns-table,
  .legacy-table.propagation-table {
    font-size: 11px;
  }

  .legacy-table.auth-ns-table th,
  .legacy-table.auth-ns-table td,
  .legacy-table.propagation-table th,
  .legacy-table.propagation-table td {
    padding: 5px 6px;
    font-size: 11px;
  }
}

/* --- Large Desktop (1200px+) --- */
@media (min-width: 1200px) {
  .legacy-shell {
    padding: 20px 24px 32px;
  }

  .hero-title {
    font-size: 32px;
  }
}
