@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg:         #050709;
  --bg2:        #080c11;
  --surface:    #0c1118;
  --surface2:   #111a24;
  --surface3:   #172030;
  --border:     #1c2a3a;
  --border2:    #243447;
  --border3:    #2e4057;
  --text:       #ddeeff;
  --text2:      #8aaac4;
  --text3:      #4a6680;
  --text4:      #243447;
  --cyan:       #00e5ff;
  --cyan2:      #00b8d9;
  --cyan-dim:   rgba(0, 229, 255, 0.12);
  --cyan-glow:  rgba(0, 229, 255, 0.25);
  --green:      #00ff88;
  --green-dim:  rgba(0, 255, 136, 0.1);
  --red:        #ff4466;
  --red-dim:    rgba(255, 68, 102, 0.1);
  --orange:     #ffaa00;
  --orange-dim: rgba(255, 170, 0, 0.1);
  --purple:     #9d6eff;
  --font-mono:  'Space Mono', monospace;
  --font-ui:    'Outfit', sans-serif;
  --radius:     8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
  animation: gridShift 20s linear infinite;
}
@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}
body::after {
  content: '';
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, rgba(0,229,255,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan2); }

.wrapper {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 0 20px 60px;
}

header {
  position: relative; z-index: 1;
  padding: 40px 20px 0; text-align: center;
}

.header-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cyan-dim); border: 1px solid rgba(0,229,255,0.2);
  color: var(--cyan); font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 3px; text-transform: uppercase;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 20px;
  animation: fadeDown 0.6s ease;
}
.header-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

h1 {
  font-family: var(--font-ui); font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800; letter-spacing: -1px; line-height: 1.1;
  margin-bottom: 10px; animation: fadeDown 0.6s 0.1s ease both;
}
h1 .accent { color: var(--cyan); text-shadow: 0 0 30px var(--cyan-glow); }

.subtitle {
  color: var(--text2); font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  font-weight: 400; margin-bottom: 36px; animation: fadeDown 0.6s 0.2s ease both;
}

/* Search card */
.search-card {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); padding: clamp(20px, 4vw, 32px);
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
  animation: fadeUp 0.6s 0.3s ease both;
}
.input-row { display: flex; gap: 10px; align-items: stretch; }
.input-wrap { flex: 1; position: relative; }
.input-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 16px; pointer-events: none; transition: color 0.2s;
}
#domain-input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 14px 16px 14px 44px;
  font-family: var(--font-mono); font-size: 14px; color: var(--text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
#domain-input::placeholder { color: var(--text3); }
#domain-input:focus {
  border-color: var(--cyan2); box-shadow: 0 0 0 3px var(--cyan-dim);
}
.input-wrap:focus-within .input-icon { color: var(--cyan); }

.btn-scan {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 28px; background: var(--cyan); color: var(--bg);
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  border: none; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(0,229,255,0.25);
}
.btn-scan:hover { background: #33ecff; transform: translateY(-1px); box-shadow: 0 4px 24px rgba(0,229,255,0.4); }
.btn-scan:active { transform: translateY(0); }
.btn-scan:disabled { background: var(--surface3); color: var(--text3); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-scan svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-scan.scanning .scan-icon { display: none; }
.btn-scan:not(.scanning) .stop-icon { display: none; }

.options-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 14px; align-items: center;
}
.option-group { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); font-family: var(--font-mono); }
.option-group label { white-space: nowrap; color: var(--text3); }
.option-select, .option-input {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text); outline: none; transition: border-color 0.2s;
}
.option-select:focus, .option-input:focus { border-color: var(--cyan2); }
.option-input { width: 200px; }

/* Stats */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 20px; animation: fadeUp 0.6s 0.4s ease both;
}
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; text-align: center;
  transition: border-color 0.2s, transform 0.2s;
  position: relative; overflow: hidden;
}
.stat-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--border2); transition: background 0.3s;
}
.stat-box.s-found::before  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.stat-box.s-scanned::before { background: var(--cyan); }
.stat-box.s-progress::before { background: var(--orange); }
.stat-box.s-time::before   { background: var(--purple); }
.stat-box:hover { border-color: var(--border3); transform: translateY(-2px); }
.stat-num {
  font-family: var(--font-mono); font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700; line-height: 1; margin-bottom: 4px;
}
.s-found  .stat-num { color: var(--green); }
.s-scanned .stat-num { color: var(--cyan); }
.s-progress .stat-num { color: var(--orange); }
.s-time   .stat-num { color: var(--purple); }
.stat-lbl {
  font-size: 10px; font-family: var(--font-mono);
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3);
}

/* Progress */
.progress-track {
  height: 3px; background: var(--surface2); border-radius: 2px;
  margin-bottom: 20px; overflow: hidden; display: none;
}
.progress-track.active { display: block; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: 2px; width: 0%; transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--cyan);
}

/* Main grid */
.main-grid {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 16px; animation: fadeUp 0.6s 0.5s ease both;
}

/* Results panel */
.results-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  min-height: 400px; display: flex; flex-direction: column;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface2); flex-wrap: wrap; gap: 8px;
}
.panel-title {
  font-size: 11px; font-family: var(--font-mono);
  letter-spacing: 2px; text-transform: uppercase; color: var(--text2);
  display: flex; align-items: center; gap: 8px;
}
.panel-title .live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  animation: blink 1.2s infinite; display: none;
}
.panel-title .live-dot.active { display: block; }
.panel-actions { display: flex; gap: 6px; }
.btn-sm {
  padding: 5px 12px; border-radius: 5px; font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer; border: 1px solid var(--border2); background: transparent;
  color: var(--text2); transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
}
.btn-sm:hover { border-color: var(--cyan2); color: var(--cyan); }
.btn-sm:disabled { opacity: 0.3; cursor: not-allowed; }

.filter-tabs {
  display: flex; gap: 4px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.filter-tab {
  padding: 4px 12px; border-radius: 20px; font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  color: var(--text3); transition: all 0.15s; letter-spacing: 0.5px;
}
.filter-tab:hover { color: var(--text2); }
.filter-tab.active {
  background: var(--cyan-dim); border-color: rgba(0,229,255,0.3); color: var(--cyan);
}

.results-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 300px; color: var(--text3);
  font-family: var(--font-mono); font-size: 12px; gap: 12px;
}
.empty-icon { font-size: 36px; opacity: 0.3; }

.result-item {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 12px; padding: 11px 18px;
  border-bottom: 1px solid rgba(28,42,58,0.5);
  cursor: pointer; transition: background 0.12s;
  animation: slideRight 0.3s ease;
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.result-item:hover { background: var(--surface2); }
.result-item:last-child { border-bottom: none; }
.result-main { min-width: 0; }
.result-sub {
  font-family: var(--font-mono); font-size: 13px; color: var(--cyan);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.result-ips { display: flex; flex-wrap: wrap; gap: 4px; }
.ip-tag {
  display: inline-block; padding: 1px 7px;
  background: var(--green-dim); border: 1px solid rgba(0,255,136,0.2);
  border-radius: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--green);
}
.result-meta { text-align: right; flex-shrink: 0; }
.result-latency { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.result-latency.fast { color: var(--green); }
.result-latency.slow { color: var(--orange); }
.result-time { font-size: 10px; color: var(--text4); font-family: var(--font-mono); }

/* Sidebar */
.sidebar-right { display: flex; flex-direction: column; gap: 14px; }
.status-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.status-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3);
  display: flex; align-items: center; gap: 7px;
}
.status-body { padding: 14px 16px; }
.status-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 9px; font-size: 12px;
}
.status-row:last-child { margin-bottom: 0; }
.status-key { color: var(--text3); font-family: var(--font-mono); font-size: 11px; }
.status-val { color: var(--text); font-family: var(--font-mono); font-size: 11px; }
.status-val.ok  { color: var(--green); }
.status-val.err { color: var(--red); }
.status-val.run { color: var(--cyan); }

.log-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; flex: 1; }
.log-body {
  padding: 12px; font-family: var(--font-mono); font-size: 10px;
  line-height: 1.8; max-height: 260px; overflow-y: auto; color: var(--text3);
}
.log-entry { display: flex; gap: 8px; padding: 1px 0; }
.log-ts { color: var(--text4); flex-shrink: 0; }
.log-msg.c-cyan   { color: var(--cyan); }
.log-msg.c-green  { color: var(--green); }
.log-msg.c-orange { color: var(--orange); }
.log-msg.c-red    { color: var(--red); }
.log-msg.c-dim    { color: var(--text3); }

.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.chart-body { padding: 14px 16px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.mini-bar {
  flex: 1; border-radius: 2px 2px 0 0; background: var(--surface3);
  transition: height 0.4s ease, background 0.3s; min-height: 4px;
}
.mini-bar.has-data { background: linear-gradient(to top, var(--cyan2), var(--cyan)); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); width: 100%; max-width: 520px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); flex: 1; word-break: break-all; }
.modal-close {
  background: none; border: 1px solid var(--border2); color: var(--text2);
  padding: 4px 10px; border-radius: 5px; cursor: pointer;
  font-size: 12px; font-family: var(--font-mono); transition: all 0.15s; flex-shrink: 0;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-body { padding: 18px 20px; }
.modal-row { display: flex; gap: 14px; margin-bottom: 12px; font-size: 12px; }
.modal-key { color: var(--text3); font-family: var(--font-mono); width: 100px; flex-shrink: 0; font-size: 11px; padding-top: 1px; }
.modal-val { color: var(--text); font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.modal-val.accent { color: var(--cyan); }
.modal-val.green  { color: var(--green); }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--surface2); border: 1px solid var(--border2);
  border-left: 3px solid var(--cyan); border-radius: var(--radius);
  padding: 12px 16px; font-size: 12px; font-family: var(--font-mono);
  min-width: 240px; max-width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease; color: var(--text);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(12px);  } to { opacity: 1; transform: translateY(0); } }
@keyframes spinDot  { to { transform: rotate(360deg); } }
.spin { animation: spinDot 1s linear infinite; display: inline-block; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
  .sidebar-right { display: grid; grid-template-columns: 1fr 1fr; }
  .log-card { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  header { padding: 28px 16px 0; }
  .wrapper { padding: 0 12px 40px; }
  .input-row { flex-direction: column; }
  .btn-scan { width: 100%; justify-content: center; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .options-row { flex-direction: column; align-items: flex-start; }
  .option-input { width: 100%; }
  .sidebar-right { grid-template-columns: 1fr; }
  .result-item { grid-template-columns: 1fr; }
  .result-meta { text-align: left; display: flex; gap: 10px; align-items: center; }
  .result-time { display: none; }
  .panel-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 400px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 6px; }
  h1 { font-size: 2rem; }
}