/* ==========================================================================
   MyRecon — Design System
   Modern OSINT/cybersecurity aesthetic. Dark by default, full light theme.
   ========================================================================== */

:root {
  /* Brand */
  --brand-cyan: #22d3ee;
  --brand-indigo: #6366f1;
  --brand-grad: linear-gradient(135deg, #22d3ee 0%, #6366f1 100%);

  /* Dark theme (default) */
  --bg: #070b12;
  --bg-soft: #0b1220;
  --surface: #0e1626;
  --surface-2: #131d31;
  --border: #1e2a40;
  --border-strong: #2b3a56;
  --text: #e6edf7;
  --text-dim: #9fb0c8;
  --text-mute: #64748b;
  --accent: #22d3ee;
  --accent-2: #6366f1;
  --ring: rgba(99, 102, 241, 0.45);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, 0.6);

  /* Semantic */
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --info: #38bdf8;

  /* Layout */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 1200px;
  --nav-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f3f6fc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-dim: #475569;
  --text-mute: #94a3b8;
  --accent: #0891b2;
  --accent-2: #4f46e5;
  --ring: rgba(79, 70, 229, 0.35);
  --shadow: 0 18px 40px -20px rgba(15, 23, 42, 0.25);
  --shadow-sm: 0 6px 18px -12px rgba(15, 23, 42, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
/* Theme switch: transition surfaces/borders, but never the body background —
   transitioning a var()-derived background can leave it stale in Chromium. */
.nav, .panel, .card, .feature, .stat, .datarow, .input, .btn-ghost {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(50% 45% at 90% 10%, rgba(99, 102, 241, 0.12), transparent 55%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Focus visibility for accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.gradient-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Skip link */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 8px; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ============================ Navbar ============================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand .logo { width: 32px; height: 32px; }
.brand small {
  font-weight: 600; font-size: 0.6rem; letter-spacing: 0.18em;
  color: var(--accent); align-self: flex-start; margin-top: 2px;
}
.nav-links { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; color: var(--text-dim);
  font-size: 0.9rem; font-weight: 500; transition: all 0.18s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text-dim); transition: all 0.18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.nav-toggle { display: none; }

/* ============================ Hero ============================ */
.hero { padding: 68px 0 34px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  margin-bottom: 22px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.08; }
.hero p.lead { max-width: 620px; margin: 18px auto 0; color: var(--text-dim); font-size: clamp(1rem, 2vw, 1.15rem); }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 0.82rem; color: var(--text-dim);
}

/* ============================ Tool ============================ */
.tool { margin-top: 30px; }
.tool-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.tool-tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 10px 16px; border-radius: 12px 12px 0 0; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  color: var(--text-dim); font-weight: 600; font-size: 0.9rem; transition: all 0.18s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  color: var(--text); background: var(--surface);
  border-color: var(--border);
}
.tab .tab-ico { font-size: 1rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.panel-title { font-size: 0.95rem; font-weight: 700; }
.panel-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 3px; margin-bottom: 16px; }

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-wrap { position: relative; flex: 1; min-width: 220px; }
.input-wrap .in-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-mute); pointer-events: none;
}
.input {
  width: 100%; padding: 14px 16px 14px 42px; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  font-size: 0.98rem; transition: border-color 0.18s, box-shadow 0.18s;
}
.input::placeholder { color: var(--text-mute); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-weight: 700; font-size: 0.95rem; transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
  background: var(--brand-grad); color: #04121a; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px var(--accent); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { box-shadow: none; border-color: var(--border-strong); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }

.opt-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.85rem; color: var(--text-dim); }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { font-size: 0.8rem; color: var(--text-mute); }

/* ============================ Results ============================ */
.results { margin-top: 26px; }
.results-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.results-bar h2 { font-size: 1.05rem; font-weight: 700; }
.results-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.stat .num { font-size: 1.7rem; font-weight: 800; font-family: var(--mono); }
.stat .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); margin-top: 4px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
  position: relative; overflow: hidden; animation: rise 0.35s ease both;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--accent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-weight: 700; font-size: 0.95rem; }
.card-url { font-size: 0.76rem; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-url a:hover { color: var(--accent); }
.tag {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 6px; margin-left: auto; flex-shrink: 0;
}
.tag.profile { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tag.document { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.tag.mention { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.card-bio { font-size: 0.82rem; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.meta-tag {
  font-size: 0.7rem; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}

/* Data list (email/domain/ip results) */
.datalist { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.datarow { display: flex; gap: 14px; padding: 12px 16px; background: var(--surface); }
.datarow .k { flex: 0 0 40%; color: var(--text-mute); font-size: 0.85rem; }
.datarow .v { flex: 1; font-size: 0.9rem; word-break: break-word; font-family: var(--mono); }
.section-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); margin: 22px 0 10px; }

/* Breach banner */
.breach {
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
.breach.clean {
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}
.breach h3 { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.breach .sev { margin-left: auto; font-size: 0.7rem; font-weight: 800; padding: 4px 10px; border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pill { font-size: 0.72rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.pill.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* States */
.empty, .loading, .error-box {
  text-align: center; padding: 54px 20px; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface);
}
.empty svg { margin: 0 auto 14px; opacity: 0.5; }
.empty h3 { color: var(--text); font-size: 1.05rem; margin-bottom: 6px; }
.error-box { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); border-style: solid; }

/* Skeleton loading */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.skeleton {
  height: 118px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%; animation: shimmer 1.3s infinite linear;
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 16px; }
.progress > i { display: block; height: 100%; width: 30%; background: var(--brand-grad); border-radius: 999px; animation: indeterminate 1.3s ease-in-out infinite; }

/* History */
.history-list { display: grid; gap: 8px; }
.history-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; transition: border-color 0.16s;
}
.history-item:hover { border-color: var(--border-strong); }
.history-item .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); }
.history-item .meta { flex: 1; min-width: 0; }
.history-item .q { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .t { font-size: 0.75rem; color: var(--text-mute); }

/* Toast */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: grid; gap: 10px; }
.toast {
  padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 0.88rem; min-width: 220px; animation: rise 0.25s ease both;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }

/* Features section */
.section { padding: 46px 0; }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.02em; text-align: center; }
.section .sub { text-align: center; color: var(--text-dim); margin: 10px auto 30px; max-width: 560px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: transform 0.16s, border-color 0.16s;
}
.feature:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.feature .fico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); margin-bottom: 14px;
}
.feature h3 { font-size: 1rem; margin-bottom: 6px; }
.feature p { font-size: 0.88rem; color: var(--text-dim); }

/* Footer */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 34px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start; }
.footer .brand { font-size: 1rem; }
.footer-tag { color: var(--text-mute); font-size: 0.85rem; margin-top: 8px; max-width: 280px; }
.footer-cols { display: flex; gap: 46px; flex-wrap: wrap; }
.footer-col h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); margin-bottom: 10px; }
.footer-col a { display: block; color: var(--text-dim); font-size: 0.88rem; padding: 4px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text-mute); font-size: 0.82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Animations */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes indeterminate { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Responsive */
@media (max-width: 820px) {
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 12px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-toggle { display: inline-grid; }
  .datarow { flex-direction: column; gap: 3px; }
  .datarow .k { flex-basis: auto; }
  .footer-inner { flex-direction: column; }
}
