/* ============================================================
   Downloader — styled to match baakhoff.com
   Palette:  #0B0C0E / #1C1E22 / #1C1E34 / #007BFF / #F8F9FA
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Roboto+Mono:wght@400;500;600&display=swap');

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #0B0C0E;
  color: #F8F9FA;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a, button, input, select, textarea, [class*="card"], [class*="btn"], .nav-link {
  transition: color 200ms ease, background-color 200ms ease,
              border-color 200ms ease, box-shadow 200ms ease,
              opacity 200ms ease, transform 200ms ease;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0B0C0E; }
::-webkit-scrollbar-thumb { background: #1C1E34; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #007BFF; }

/* ── Background patterns ──────────────────────────────────────── */
.hero-glow {
  background: radial-gradient(ellipse 80% 60% at 50% -5%,
    rgba(0, 123, 255, 0.09) 0%, transparent 65%);
}
.grid-pattern {
  background-image:
    linear-gradient(rgba(28, 30, 52, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 30, 52, 0.3) 1px, transparent 1px);
  background-size: 52px 52px;
}

/* ── Navigation ───────────────────────────────────────────────── */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  border-bottom: 1px solid #1C1E34;
  background: rgba(11, 12, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: #F8F9FA;
  text-decoration: none;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-logo .dot { color: #007BFF; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9CA3AF;
  text-decoration: none;
  border: 1px solid transparent;
  padding: 0.45rem 0.75rem;
}
.nav-link:hover {
  color: #F8F9FA;
  border-color: #1C1E34;
}

.nav-user {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B7280;
}

.btn-signout {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6B7280;
  border: 1px solid #1C1E34;
  background: transparent;
  padding: 0.45rem 1rem;
  cursor: pointer;
}
.btn-signout:hover {
  color: #F8F9FA;
  border-color: #4B5563;
}

/* ── Layout helpers ───────────────────────────────────────────── */
.section-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #007BFF;
  margin-bottom: 0.625rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: #F8F9FA;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-sub {
  font-size: 0.9375rem;
  color: #6B7280;
  margin-top: 0.75rem;
  max-width: 560px;
  line-height: 1.65;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #9CA3AF;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  display: block;
}

.form-input,
.form-select {
  width: 100%;
  background: #1C1E22;
  border: 1px solid #1C1E34;
  color: #F8F9FA;
  padding: 0.85rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  outline: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus {
  border-color: #007BFF;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}
.form-input::placeholder { color: #374151; }

.form-select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%236B7280' d='M2 4l4 4 4-4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  min-width: 175px;
}

/* ── Status pill (green dot) ──────────────────────────────────── */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  background: rgba(52, 211, 153, 0.06);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.22);
  margin-bottom: 1rem;
}
.status-tag::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: #007BFF;
  border: 1px solid #007BFF;
  padding: 0.85rem 2rem;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary:hover {
  background: transparent;
  color: #007BFF;
  box-shadow: 0 0 24px rgba(0, 123, 255, 0.3);
}
.btn-primary:disabled {
  background: #1C1E22;
  color: #4B5563;
  border-color: #1C1E34;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Tool panel ───────────────────────────────────────────────── */
.tool-panel {
  background: #1C1E22;
  border: 1px solid #1C1E34;
  padding: 1.75rem;
}

.tool-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  margin-top: 0.875rem;
}
.tool-row > .form-select { flex: 0 0 175px; }
.tool-row > .btn-primary { flex: 0 0 auto; }
.tool-row > .spacer     { flex: 1; }

/* ── Status messages ──────────────────────────────────────────── */
/* ── Probe info (title preview under URL input) ───────────────── */
.probe-info:empty { display: none; }
.probe-info {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 123, 255, 0.04);
  border: 1px solid rgba(0, 123, 255, 0.18);
  border-left-width: 2px;
  font-size: 0.8125rem;
  color: #D1D5DB;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 38px;
}
.probe-info.muted {
  background: transparent;
  border-color: #1C1E34;
  color: #6B7280;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.probe-info.err {
  background: rgba(248, 113, 113, 0.05);
  border-color: rgba(248, 113, 113, 0.25);
  color: #f87171;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}
.probe-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.probe-meta {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B7280;
  flex-shrink: 0;
}
.probe-spinner {
  width: 10px; height: 10px;
  border: 1.5px solid rgba(0, 123, 255, 0.25);
  border-top-color: #007BFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

#status:empty { display: none; }
#status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
#status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
#status.info {
  color: #007BFF;
  border-color: rgba(0, 123, 255, 0.25);
  background: rgba(0, 123, 255, 0.05);
}
#status.info::before {
  background: #007BFF;
  box-shadow: 0 0 6px #007BFF;
}
#status.ok {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.05);
}
#status.ok::before {
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}
#status.err {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}
#status.err::before { background: #f87171; }

/* Login error block (server-rendered) */
.err {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}

/* ── Supported platforms grid ─────────────────────────────────── */
.platforms-section {
  margin-top: 4rem;
}

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #1C1E34;
  margin-top: 1.75rem;
}

.platform-card {
  background: #1C1E22;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  min-height: 148px;
  overflow: hidden;
}
.platform-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: #007BFF;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 250ms ease;
}
.platform-card:hover::after { transform: scaleY(1); }
.platform-card:hover { background: #1F2126; }

.platform-cat-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #007BFF;
}

.platform-cat-name {
  font-size: 1rem;
  font-weight: 600;
  color: #F8F9FA;
  margin: 0 0 0.25rem 0;
}

.platform-cat-sites {
  font-size: 0.8125rem;
  color: #9CA3AF;
  line-height: 1.55;
}

.platform-more {
  font-size: 0.75rem;
  color: #6B7280;
  margin-top: 1rem;
  text-align: center;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.05em;
}
.platform-more a { color: #007BFF; text-decoration: none; }
.platform-more a:hover { text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  border-top: 1px solid #1C1E34;
  background: #0B0C0E;
  margin-top: 4rem;
}
.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  color: #374151;
  letter-spacing: 0.1em;
}
.footer-copy .dot { color: #007BFF; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-link {
  font-size: 0.75rem;
  color: #374151;
  text-decoration: none;
}
.footer-link:hover { color: #9CA3AF; }

/* ── Login page ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  position: relative;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #1C1E22;
  border: 1px solid #1C1E34;
  padding: 2.25rem;
  position: relative;
  z-index: 1;
}
.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-brand .nav-logo {
  font-size: 1rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}
.login-sub {
  font-size: 0.8125rem;
  color: #6B7280;
}
.login-form > div + div,
.login-form > button {
  margin-top: 0.875rem;
}
.login-form .btn-primary {
  width: 100%;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-fade-up { animation: fadeUp 0.55s ease forwards; }
.delay-1 { animation-delay: 0.06s; opacity: 0; }
.delay-2 { animation-delay: 0.14s; opacity: 0; }
.delay-3 { animation-delay: 0.22s; opacity: 0; }
.delay-4 { animation-delay: 0.30s; opacity: 0; }

/* ══════════════════════════ Admin console ══════════════════════ */
.admin-wrap { max-width: 1100px; }

.admin-toolbar {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}
.admin-toolbar .filter-input {
  flex: 0 0 280px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
}
.admin-toolbar .spacer { flex: 1; }

.banner:empty { display: none; }
.banner {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.95rem;
  font-size: 0.8125rem;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.banner.ok  { color: #34d399; border-color: rgba(52, 211, 153, 0.25); background: rgba(52, 211, 153, 0.05); }
.banner.err { color: #f87171; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.05); }

.user-table-wrap {
  border: 1px solid #1C1E34;
  background: #1C1E22;
  overflow-x: auto;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.user-table thead th {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6B7280;
  text-align: left;
  padding: 0.85rem 1rem;
  background: #16171B;
  border-bottom: 1px solid #1C1E34;
  white-space: nowrap;
}
.user-table tbody td {
  padding: 0.85rem 1rem;
  border-top: 1px solid #1C1E34;
  color: #D1D5DB;
  vertical-align: middle;
}
.user-table tbody tr:hover { background: #1F2126; }
.user-table .t-id { font-family: 'Roboto Mono', monospace; color: #6B7280; }
.user-table .t-date {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  color: #9CA3AF;
  white-space: nowrap;
}
.user-table .email-val { font-weight: 500; color: #F8F9FA; }
.user-table .self-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  background: rgba(0, 123, 255, 0.12);
  color: #007BFF;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.user-table .t-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #6B7280;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.user-table .t-actions {
  white-space: nowrap;
  text-align: right;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-ok    { color: #34d399; border-color: rgba(52,211,153,0.25); background: rgba(52,211,153,0.06); }
.badge-off   { color: #f87171; border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.05); }
.badge-admin { color: #007BFF; border-color: rgba(0,123,255,0.3); background: rgba(0,123,255,0.07); }
.badge-user  { color: #9CA3AF; border-color: #2A2C36; background: transparent; }

.row-btn {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9CA3AF;
  border: 1px solid #2A2C36;
  background: transparent;
  padding: 0.4rem 0.7rem;
  margin-left: 0.4rem;
  cursor: pointer;
}
.row-btn:hover:not(:disabled) {
  color: #F8F9FA;
  border-color: #4B5563;
}
.row-btn:disabled {
  color: #374151;
  border-color: #1C1E34;
  cursor: not-allowed;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.875rem;
  color: #D1D5DB;
  cursor: pointer;
  user-select: none;
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #007BFF;
  cursor: pointer;
}

/* ── Modal dialogs (used by admin console) ────────────────────── */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  backdrop-filter: blur(3px);
}
.dialog.hidden { display: none; }

.dialog-card {
  width: 100%;
  max-width: 460px;
  background: #1C1E22;
  border: 1px solid #1C1E34;
  padding: 1.75rem;
  animation: fadeUp 220ms ease;
}
.dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #F8F9FA;
}
.dialog-instruction {
  margin: 0 0 0.9rem;
  font-size: 0.8125rem;
  color: #9CA3AF;
}
.dialog-form .form-label { margin-top: 0; }
.dialog-form .form-input { margin-top: 0.4rem; }

.dialog-err:empty { display: none; }
.dialog-err {
  margin-top: 0.875rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.75rem;
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.05);
  font-family: 'Roboto Mono', monospace;
}

.dialog-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.pw-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.pw-field {
  font-family: 'Roboto Mono', monospace !important;
  letter-spacing: 0.02em;
  font-size: 0.95rem !important;
}

/* ══════════════════════════ Responsive ═════════════════════════ */
@media (max-width: 720px) {
  body { overflow-x: hidden; }

  .section-wrap { padding: 4rem 1.25rem; }

  .admin-toolbar { flex-wrap: wrap; }
  .admin-toolbar .filter-input { flex: 1 1 100%; }
  .admin-toolbar .spacer { display: none; }
  .user-table tbody td,
  .user-table thead th { padding: 0.65rem 0.7rem; font-size: 0.75rem; }
  .row-btn { margin: 0.15rem 0.3rem 0.15rem 0; padding: 0.35rem 0.55rem; }
  .user-table .t-actions { text-align: left; }

  .tool-row { flex-wrap: wrap; }
  .tool-row > .form-select { flex: 1 1 auto; min-width: 0; }
  .tool-row > .spacer      { display: none; }
  .tool-row > .btn-primary { flex: 1 1 100%; justify-content: center; }

  .platforms-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }
}

@media (max-width: 480px) {
  .section-wrap { padding: 3rem 1rem; }
  .tool-panel { padding: 1.35rem; }
  .nav-inner { padding: 0 1rem; }
  .nav-user { display: none; }
  .login-card { padding: 1.75rem; }
  .platforms-grid { grid-template-columns: 1fr; }
}
