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

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --border: #252525;
  --text: #e8e8e8;
  --muted: #777;
  --accent: #4f8ef7;
  --accent-h: #6ba3ff;
  --danger: #e05050;
  --ok: #50d080;
  --r: 8px;
  --max: 1200px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* View toggling */
.view { display: none; }
.view.active { display: block; }
#view-landing.active { display: flex; flex-direction: column; min-height: 100vh; }

/* Landing */
.landing-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44vh;
  padding: 48px 20px 24px;
  text-align: center;
}

.logo {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1.5px;
  margin-bottom: 10px;
}

.tagline {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  margin-bottom: 32px;
}

/* Search form */
.search-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}

.search-input {
  flex: 1;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

.search-btn {
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--accent-h); }

/* Header bar (results + detail views) */
.bar-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-sm {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
  color: var(--text);
}
.logo-sm:hover { color: var(--accent); }

.search-form--bar { flex: 1; max-width: 480px; }

.back-link {
  margin-left: auto;
  color: var(--accent);
  font-size: 0.88rem;
}
.back-link:hover { text-decoration: underline; }

/* Content area */
.content-area {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 24px 48px;
  width: 100%;
}

/* Top section on landing */
.top-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px 48px;
  width: 100%;
}

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 14px;
}

.results-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

/* Card grid — mobile-first */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Server card */
.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, transform 0.12s;
}
.server-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

.card-stats {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 500;
}
.badge-reg   { background: #0e1e38; color: #7aaaf0; }
.badge-safe  { background: #0a2010; color: var(--ok); }
.badge-vuln  { background: #2a0a0a; color: var(--danger); }
.badge-score { background: #241d08; color: #d4b04a; }
.badge-match { background: #08201a; color: #40c890; }

/* Detail view */
.detail-content {
  max-width: 860px;
}

.detail-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-link {
  color: var(--accent);
  font-size: 0.85rem;
}
.detail-link:hover { text-decoration: underline; }

.detail-desc {
  color: var(--muted);
  margin-bottom: 32px;
  font-size: 0.92rem;
  line-height: 1.7;
}

.detail-section { margin-bottom: 28px; }

.detail-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  margin-bottom: 7px;
}

.item-name {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 3px;
}

.item-desc {
  font-size: 0.80rem;
  color: var(--muted);
}

.severity-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.sev-CRITICAL { background: #3a0808; color: #ff7070; }
.sev-HIGH     { background: #2e1408; color: #ff9960; }
.sev-MEDIUM   { background: #242008; color: #ffc840; }
.sev-LOW      { background: #082010; color: #40c870; }

.empty-state {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13,13,13,0.75);
  z-index: 100;
}
.loading-overlay[hidden] {
  display: none;
}

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

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

/* Mobile overrides */
@media (max-width: 480px) {
  .logo { font-size: 2rem; }
  .bar-header { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .search-form--bar { order: 3; width: 100%; max-width: 100%; }
  .back-link { margin-left: 0; }
  .content-area, .top-section { padding-left: 16px; padding-right: 16px; }
  .detail-title { font-size: 1.3rem; }
}
