/* ============================================
   IPTrails - IP Intelligence Platform
   Style Sheet
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --border: #30363d;
  --border-light: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #238636;
  --accent-blue: #1f6feb;
  --accent-blue-light: #388bfd;
  --accent-green: #3fb950;
  --accent-red: #f85149;
  --accent-yellow: #d29922;
  --accent-purple: #8b949e;
  --link: #58a6ff;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

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

code, .mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
}

/* ============================================ NAVBAR */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-brand:hover { text-decoration: none; }

.nav-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-badge {
  background: var(--accent-blue);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

/* ============================================ HERO */
.hero {
  padding: 80px 24px 60px;
  text-align: center;
  background: radial-gradient(ellipse at top center, rgba(31,111,235,0.12) 0%, transparent 70%);
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56,139,253,0.1);
  border: 1px solid rgba(56,139,253,0.3);
  color: var(--accent-blue-light);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero h1 span {
  background: linear-gradient(135deg, #388bfd, #79c0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================ SEARCH */
.search-container {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.search-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrapper:focus-within {
  border-color: var(--accent-blue-light);
  box-shadow: 0 0 0 3px rgba(56,139,253,0.15);
}

.search-icon {
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  padding: 16px 0;
  font-family: inherit;
}

#searchInput::placeholder { color: var(--text-muted); }

.search-btn {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 0 24px;
  height: 56px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-btn:hover { background: var(--accent-blue-light); }

.search-hints {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.hint-chip {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.hint-chip:hover {
  background: var(--bg-hover);
  color: var(--link);
  border-color: var(--accent-blue);
}

/* ============================================ FEATURES */
.features {
  padding: 60px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: default;
}

.feature-card:hover {
  border-color: var(--accent-blue-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.feature-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================ MY IP BANNER */
.myip-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  max-width: 700px;
  margin: -16px auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.myip-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.myip-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(63,185,80,0.2);
}

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

.myip-addr {
  font-family: monospace;
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

.myip-lookup-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.myip-lookup-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue-light);
}

/* ============================================ RESULTS PAGE */
.results-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-type-badge {
  background: rgba(56,139,253,0.1);
  border: 1px solid rgba(56,139,253,0.3);
  color: var(--accent-blue-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-query {
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.results-search {
  display: flex;
  gap: 8px;
  min-width: 300px;
}

.results-search input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  font-family: monospace;
  transition: border-color 0.2s;
}

.results-search input:focus { border-color: var(--accent-blue-light); }

.results-search button {
  background: var(--accent-blue);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.results-search button:hover { background: var(--accent-blue-light); }

.results-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

/* ============================================ SIDEBAR */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.info-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

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

.info-value.mono { font-size: 12px; }

.info-value .flag { font-size: 16px; margin-right: 4px; }

/* ============================================ STATUS BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(63,185,80,0.15);
  color: var(--accent-green);
  border: 1px solid rgba(63,185,80,0.3);
}

.badge-red {
  background: rgba(248,81,73,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248,81,73,0.3);
}

.badge-yellow {
  background: rgba(210,153,34,0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(210,153,34,0.3);
}

.badge-blue {
  background: rgba(56,139,253,0.15);
  color: var(--accent-blue-light);
  border: 1px solid rgba(56,139,253,0.3);
}

.badge-gray {
  background: rgba(139,148,158,0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(139,148,158,0.3);
}

/* ============================================ MAIN CONTENT TABS */
.main-content {
  min-width: 0;
}

.tabs-nav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.tab-btn.active {
  color: var(--accent-blue-light);
  border-bottom-color: var(--accent-blue-light);
}

.tab-count {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================ SECTION CARD */
.section-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.section-body {
  padding: 20px;
}

/* ============================================ DNS TABLE */
.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dns-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.dns-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
  word-break: break-all;
}

.dns-table tr:last-child td { border-bottom: none; }

.dns-table tr:hover td { background: rgba(255,255,255,0.02); }

.dns-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  min-width: 44px;
  text-align: center;
}

.dns-type-A    { background: rgba(63,185,80,0.15);  color: #3fb950; border: 1px solid rgba(63,185,80,0.3); }
.dns-type-AAAA { background: rgba(56,139,253,0.15); color: #388bfd; border: 1px solid rgba(56,139,253,0.3); }
.dns-type-MX   { background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }
.dns-type-NS   { background: rgba(139,148,158,0.15);color: #8b949e; border: 1px solid rgba(139,148,158,0.3); }
.dns-type-TXT  { background: rgba(188,140,255,0.15);color: #bc8cff; border: 1px solid rgba(188,140,255,0.3); }
.dns-type-CNAME{ background: rgba(248,81,73,0.15);  color: #f85149; border: 1px solid rgba(248,81,73,0.3); }
.dns-type-SOA  { background: rgba(255,166,87,0.15); color: #ffa657; border: 1px solid rgba(255,166,87,0.3); }
.dns-type-CAA  { background: rgba(56,189,248,0.15); color: #38bdf8; border: 1px solid rgba(56,189,248,0.3); }
.dns-type-PTR  { background: rgba(240,246,252,0.1); color: #c9d1d9; border: 1px solid rgba(240,246,252,0.2); }

/* ============================================ WHOIS */
.whois-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.whois-field {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.whois-field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
  margin-bottom: 5px;
}

.whois-field-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

.raw-whois {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: monospace;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.7;
}

.raw-whois::-webkit-scrollbar { width: 6px; }
.raw-whois::-webkit-scrollbar-track { background: var(--bg-tertiary); }
.raw-whois::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================ BLACKLIST */
.blacklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.blacklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.2s;
}

.blacklist-item.listed {
  border-color: rgba(248,81,73,0.4);
  background: rgba(248,81,73,0.05);
}

.blacklist-item.clean {
  border-color: rgba(63,185,80,0.2);
}

.bl-name {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.bl-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}

.bl-status.clean { color: var(--accent-green); }
.bl-status.listed { color: var(--accent-red); }

.blacklist-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bl-stat {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  text-align: center;
  min-width: 100px;
}

.bl-stat-num {
  font-size: 24px;
  font-weight: 700;
}

.bl-stat-num.clean { color: var(--accent-green); }
.bl-stat-num.listed { color: var(--accent-red); }
.bl-stat-num.loading { color: var(--text-muted); }

.bl-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ============================================ HEADERS */
.headers-table {
  width: 100%;
  border-collapse: collapse;
}

.headers-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  font-family: monospace;
  font-size: 12px;
}

.headers-table td:first-child {
  color: var(--accent-blue-light);
  white-space: nowrap;
  width: 1%;
  padding-right: 24px;
  font-weight: 600;
}

.headers-table td:last-child {
  color: var(--text-secondary);
  word-break: break-all;
}

.headers-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ============================================ PORTS */
.ports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.port-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.port-item.open {
  border-color: rgba(63,185,80,0.4);
  background: rgba(63,185,80,0.05);
}

.port-item.closed {
  opacity: 0.5;
}

.port-num {
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
}

.port-service {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.port-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.port-status.open { color: var(--accent-green); }
.port-status.closed { color: var(--text-muted); }
.port-status.checking { color: var(--accent-yellow); }

/* ============================================ SSL */
.ssl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.ssl-field {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.ssl-valid-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.ssl-valid-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-green);
}

/* ============================================ LOADING */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--text-muted);
  font-size: 14px;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================ ERROR STATE */
.error-state {
  text-align: center;
  padding: 60px 20px;
}

.error-icon { font-size: 48px; margin-bottom: 16px; }

.error-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent-red);
}

.error-msg {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================ EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 36px; margin-bottom: 12px; }

/* ============================================ COPY BUTTON */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue-light);
}

.copy-btn.copied {
  color: var(--accent-green);
  border-color: rgba(63,185,80,0.4);
}

/* ============================================ ACTION BUTTONS */
.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue-light);
}

/* ============================================ TOGGLE */
.toggle-section {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
  transition: all 0.2s;
}

.toggle-section:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ============================================ FOOTER */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 60px;
}

.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--link); }

/* ============================================ RESPONSIVE */
@media (max-width: 900px) {
  .results-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 15px; }
  .navbar { padding: 0 16px; }
  .results-page { padding: 16px; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .results-search { width: 100%; min-width: 0; }
  .myip-banner { flex-direction: column; text-align: center; }
  .nav-links { display: none; }
}

/* ============================================ TOOLTIPS */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

/* ============================================ SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ============================================ PROGRESS BAR */
.progress-bar {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-light));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ============================================ GEOLOCATION */
.geo-map-placeholder {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
  font-size: 13px;
  position: relative;
  overflow: hidden;
}

.geo-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56,139,253,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,139,253,0.06) 1px, transparent 1px);
  background-size: 30px 30px;
}

.geo-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent-blue-light);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(56,139,253,0.2), 0 0 20px rgba(56,139,253,0.4);
}

.geo-ring {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(56,139,253,0.3);
  border-radius: 50%;
  animation: geoRing 2s infinite;
}

@keyframes geoRing {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ============================================ NOTIFICATION TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon { font-size: 16px; }

/* ============================================ DNS HISTORY */

/* Summary bar across the top of the DNS tab */
.hist-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(56,139,253,0.06);
  border: 1px solid rgba(56,139,253,0.2);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 8px;
}

.hist-summary-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hist-dot.changed { background: var(--accent-yellow); box-shadow: 0 0 0 3px rgba(210,153,34,0.2); }
.hist-dot.stable  { background: var(--accent-green);  box-shadow: 0 0 0 3px rgba(63,185,80,0.2);  }

.hist-scan-times {
  font-size: 12px;
  color: var(--text-muted);
}

/* "N changes" badge on each record-type card header */
.hist-change-badge {
  background: rgba(210,153,34,0.12);
  border: 1px solid rgba(210,153,34,0.35);
  color: var(--accent-yellow);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.hist-stable-badge {
  background: rgba(63,185,80,0.10);
  border: 1px solid rgba(63,185,80,0.25);
  color: var(--accent-green);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* Collapsed toggle bar at the bottom of each record-type card */
.hist-toggle-bar {
  border-top: 1px solid var(--border);
}

.hist-toggle-btn {
  width: 100%;
  background: none;
  border: none;
  padding: 10px 20px;
  text-align: left;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, color 0.2s;
}

.hist-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.hist-chevron {
  font-size: 10px;
  transition: transform 0.2s;
}

/* History table (inside the collapsed block) */
.hist-block {
  border-top: 1px solid var(--border-light);
  background: rgba(0,0,0,0.15);
}

.hist-table thead th {
  background: rgba(0,0,0,0.2);
  font-size: 10px;
}

.hist-row td {
  font-size: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

/* Active rows get a faint green left accent */
.hist-row-active td:first-child {
  border-left: 3px solid var(--accent-green);
}

/* Removed rows – muted + red left accent */
.hist-row-removed {
  opacity: 0.72;
}
.hist-row-removed td:first-child {
  border-left: 3px solid var(--accent-red);
}
.hist-row-removed td {
  text-decoration: none;
}

/* Status pill inside history table */
.hist-status-active {
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.hist-status-removed {
  color: var(--accent-red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Date cells */
.hist-date {
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  white-space: nowrap;
}

.hist-age {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-family: inherit;
  margin-top: 2px;
}

.hist-removed-date {
  color: var(--accent-red);
  font-size: 10px;
  margin-top: 2px;
}

/* "SQLite unavailable" notice */
.hist-unavailable {
  background: rgba(210,153,34,0.08);
  border: 1px solid rgba(210,153,34,0.25);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--accent-yellow);
  margin-bottom: 16px;
}

/* ================================================================
   AUTH PAGES (login.php / register.php)
   ================================================================ */
.auth-page {
  background: var(--bg-primary);
  min-height: 100vh;
}

.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 80px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-logo {
  font-size: 28px;
  line-height: 1;
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.auth-alert {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-alert-error {
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.3);
  color: var(--accent-red);
}

.auth-alert-success {
  background: rgba(63,185,80,0.1);
  border: 1px solid rgba(63,185,80,0.3);
  color: var(--accent-green);
}

.auth-field {
  margin-bottom: 18px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 40px 10px 12px;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
  font-family: inherit;
}

.auth-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
}

.auth-input-error {
  border-color: var(--accent-red) !important;
}

.auth-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}

.auth-avail-icon {
  position: absolute;
  right: 10px;
  font-size: 14px;
  pointer-events: none;
}

.auth-field-hint {
  font-size: 11px;
  margin-top: 4px;
  min-height: 14px;
  color: var(--text-muted);
}

/* Password strength bar */
.pw-strength-bar {
  height: 3px;
  background: var(--bg-secondary);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width .25s, background .25s;
}

/* Remember-me / checkbox row */
.auth-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Submit button */
.auth-submit-btn {
  width: 100%;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .15s;
  margin-top: 8px;
  font-family: inherit;
}

.auth-submit-btn:hover:not(:disabled) {
  opacity: .88;
}

.auth-submit-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.auth-btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer link row (Already have an account?) */
.auth-footer-links {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-footer-links a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer-links a:hover {
  text-decoration: underline;
}

/* ================================================================
   NAVBAR – USER AVATAR + DROPDOWN
   ================================================================ */
.nav-user-wrap {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}

.nav-user-btn:hover {
  border-color: var(--accent-blue);
  background: rgba(88,166,255,0.06);
}

.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
}

.nav-uname {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-caret {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform .2s;
}

.nav-user-btn[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  overflow: hidden;
  display: none;
}

.nav-dropdown.open {
  display: block;
}

.nav-dropdown-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.nav-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.nav-dropdown-email {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .12s, color .12s;
}

.nav-dropdown-item:hover {
  background: rgba(88,166,255,0.08);
  color: var(--text-primary);
}

.nav-dropdown-danger {
  color: var(--accent-red) !important;
}

.nav-dropdown-danger:hover {
  background: rgba(248,81,73,0.08) !important;
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Guest buttons in navbar */
.nav-auth-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color .15s;
}

.nav-auth-link:hover {
  color: var(--text-primary);
}

.nav-auth-primary {
  font-size: 13px;
  background: var(--accent-blue);
  color: #fff !important;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: opacity .15s;
}

.nav-auth-primary:hover {
  opacity: .88;
}

/* ================================================================
   PROFILE PAGE
   ================================================================ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-username {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.profile-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.profile-stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
}

.profile-stat {
  text-align: center;
}

.profile-stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1;
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* section-card and section-header used in profile */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-body {
  padding: 20px;
}

/* Save lookup button on lookup.php */
.save-lookup-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, color .15s, background .15s;
  font-family: inherit;
}

.save-lookup-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(88,166,255,0.06);
}

.save-lookup-btn.saved {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(63,185,80,0.08);
}

@media (max-width: 600px) {
  .auth-card {
    padding: 24px 18px;
  }
  .profile-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }
  .profile-stats {
    margin-left: 0;
  }
}
