/* v9 - dark mode, [Engineer Anything] branding */

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

:root {
  --bg: #FCFCFC;
  --surface: rgba(22,163,74,0.03);
  --surface-solid: #F5F5F5;
  --card: rgba(255,255,255,0.85);
  --card-border: rgba(22,163,74,0.12);
  --card-hover: rgba(22,163,74,0.06);
  --text: #166534;
  --t2: #3F7A52;
  --t3: #86A893;
  --border: rgba(22,163,74,0.1);
  --border-hover: rgba(22,163,74,0.2);
  --blue: #15803D;
  --purple: #16A34A;
  --green: #22C55E;
  --orange: #4ADE80;
  --pink: #86EFAC;
  --teal: #34D399;
  --red: #DC2626;
  --yellow: #A16207;
  --r: 14px;
  --r-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* --- Floaters (darker, moodier) --- */
.floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floater {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  will-change: transform;
}

.f1 { width: 500px; height: 500px; background: #22C55E; top: -12%; left: -8%; animation: d1 22s ease-in-out infinite; }
.f2 { width: 450px; height: 450px; background: #4ADE80; top: 8%; right: -10%; animation: d2 26s ease-in-out infinite; }
.f3 { width: 350px; height: 350px; background: #86EFAC; bottom: 15%; left: 10%; animation: d3 20s ease-in-out infinite; }
.f4 { width: 300px; height: 300px; background: #16A34A; top: 55%; right: 8%; animation: d4 24s ease-in-out infinite; }
.f5 { width: 250px; height: 250px; background: #34D399; bottom: 0%; right: 25%; animation: d5 18s ease-in-out infinite; }
.f6 { width: 350px; height: 350px; background: #15803D; top: 25%; left: -12%; animation: d6 28s ease-in-out infinite; }

@keyframes d1 { 0%,100%{transform:translate(0,0) scale(1)} 25%{transform:translate(60px,40px) scale(1.05)} 50%{transform:translate(30px,80px) scale(.95)} 75%{transform:translate(-20px,30px) scale(1.02)} }
@keyframes d2 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(-50px,60px) scale(1.08)} 66%{transform:translate(-80px,20px) scale(.94)} }
@keyframes d3 { 0%,100%{transform:translate(0,0) scale(1)} 25%{transform:translate(40px,-30px) scale(1.06)} 50%{transform:translate(80px,20px) scale(.96)} 75%{transform:translate(20px,-50px) scale(1.03)} }
@keyframes d4 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-60px,-40px) scale(1.1)} }
@keyframes d5 { 0%,100%{transform:translate(0,0) scale(1)} 40%{transform:translate(-30px,-50px) scale(1.15)} 80%{transform:translate(40px,-20px) scale(.9)} }
@keyframes d6 { 0%,100%{transform:translate(0,0) scale(1)} 30%{transform:translate(50px,30px) scale(.92)} 70%{transform:translate(20px,-40px) scale(1.08)} }

/* --- Layout --- */
.app {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-wide { /* same width now */ }

/* --- Nav --- */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  flex-shrink: 0;
}

.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0;
  transition: opacity 0.15s;
}
.nav-logo:hover { opacity: 0.8; }

.brand-mark {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--t3);
  transition: color 0.2s;
}

.nav-logo:hover .brand-mark { color: var(--green); }

.brand-name {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  padding: 0 2px;
}

.nav-links { display: flex; gap: 18px; }
.nav-links a {
  color: var(--t3);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* --- Home: centered --- */
.center-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 20px 0 40px;
}

.hero { text-align: center; max-width: 600px; }

.hero-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(36px, 7vw, 58px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero-p {
  margin-top: 16px;
  font-size: 17px;
  color: var(--t2);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

/* --- Input Card --- */
.input-card {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.url-row { display: flex; gap: 8px; }

.url-row input {
  flex: 1;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.url-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }
.url-row input::placeholder { color: var(--t3); }

.run-btn {
  padding: 13px 32px;
  background: #16A34A;
  color: white;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.12s;
  white-space: nowrap;
}
.run-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(22,163,74,0.25); }
.run-btn:active { transform: translateY(0); }
.run-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.options-row { display: flex; gap: 10px; }
.option { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.option label { font-size: 11px; font-weight: 500; color: var(--t3); text-transform: uppercase; letter-spacing: 0.04em; }
.option select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235A5A66' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color 0.15s;
}
.option select:focus { border-color: var(--green); }
.option select option { background: var(--surface-solid); color: var(--text); }

/* --- Pills --- */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pill {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 100px;
  transition: transform 0.2s;
  cursor: default;
  animation: pf 0.5s ease-out both;
}
.pill:hover { transform: translateY(-2px) scale(1.04); }
.pill:nth-child(1){animation-delay:.05s}.pill:nth-child(2){animation-delay:.1s}.pill:nth-child(3){animation-delay:.15s}.pill:nth-child(4){animation-delay:.2s}.pill:nth-child(5){animation-delay:.25s}.pill:nth-child(6){animation-delay:.3s}
@keyframes pf { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.pill-blue { background: rgba(21,128,61,0.08); color: #15803D; }
.pill-purple { background: rgba(22,163,74,0.08); color: #16A34A; }
.pill-green { background: rgba(34,197,94,0.1); color: #16A34A; }
.pill-orange { background: rgba(74,222,128,0.12); color: #15803D; }
.pill-pink { background: rgba(134,239,172,0.15); color: #166534; }
.pill-teal { background: rgba(52,211,153,0.1); color: #065F46; }

/* --- Output Card --- */
.output-card {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  animation: ci 0.35s ease-out;
}
@keyframes ci { from{opacity:0;transform:translateY(16px) scale(.98)} to{opacity:1;transform:translateY(0) scale(1)} }

.output-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.output-info { display: flex; align-items: center; gap: 10px; }

.output-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(74,222,128,0.12);
  color: var(--green);
}
.output-status.running { background: rgba(250,204,21,0.12); color: var(--yellow); animation: blink 1.4s ease-in-out infinite; }
.output-status.error { background: rgba(248,113,113,0.12); color: var(--red); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.5} }

.output-target { font-size: 14px; color: var(--t2); font-weight: 500; }
.output-time { font-size: 13px; color: var(--t3); font-variant-numeric: tabular-nums; }
.output-actions { display: flex; gap: 6px; }

.btn-sm {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--t2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-sm:hover { background: var(--card-hover); border-color: var(--border-hover); color: var(--text); }

.output-stats {
  display: flex;
  gap: 20px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.output-stats:empty { display: none; }
.stat { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--t2); }
.stat-value { font-weight: 600; color: #16A34A; font-variant-numeric: tabular-nums; }

.output-body {
  padding: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--t2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
  background: rgba(22,163,74,0.02);
}
.output-body::-webkit-scrollbar { width: 4px; }
.output-body::-webkit-scrollbar-track { background: transparent; }
.output-body::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }

/* ============================
   RUNS PAGE
   ============================ */

.runs-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 32px 0 40px;
}

.runs-page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.runs-page-header p { font-size: 15px; color: var(--t2); }

.runs-table-wrap {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.runs-table { width: 100%; border-collapse: collapse; }

.runs-table thead {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.runs-table th {
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.th-status { width: 28px; }
.th-scope { width: 100px; }
.th-stats { width: 220px; }
.th-time { width: 80px; text-align: right; }

.run-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  cursor: pointer;
}
.run-row:last-child { border-bottom: none; }
.run-row:hover { background: rgba(34,197,94,0.05); }

.runs-table td {
  padding: 14px 18px;
  font-size: 14px;
}

.td-domain { font-weight: 500; color: var(--text); }
.td-stats { color: var(--t3); font-size: 13px; font-variant-numeric: tabular-nums; }
.td-time { text-align: right; color: var(--t3); font-size: 13px; font-variant-numeric: tabular-nums; }

.status-pip {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-pip.complete { background: var(--green); }
.status-pip.running { background: var(--yellow); }
.status-pip.error { background: var(--red); }

.scope-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--t2);
  text-transform: capitalize;
}

.runs-loading, .runs-empty-page {
  padding: 48px 18px;
  text-align: center;
  color: var(--t3);
  font-size: 14px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.page-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { background: var(--card-hover); border-color: var(--border-hover); }
.page-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.page-info {
  font-size: 13px;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: center;
}

/* Detail modal */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s ease-out;
}
@keyframes fade-in { from{opacity:0} to{opacity:1} }

.detail-card {
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  background: #FFFFFF;
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  animation: modal-in 0.25s ease-out;
}
@keyframes modal-in { from{opacity:0;transform:translateY(20px) scale(.97)} to{opacity:1;transform:translateY(0) scale(1)} }

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.detail-info { display: flex; align-items: center; gap: 10px; }
.detail-domain { font-size: 15px; font-weight: 600; color: var(--text); }
.detail-time { font-size: 13px; color: var(--t3); font-variant-numeric: tabular-nums; }
.detail-actions { display: flex; gap: 6px; }
.btn-close { font-size: 14px; padding: 5px 10px; color: var(--t3); }
.btn-close:hover { color: var(--text); }
.detail-body { flex: 1; overflow-y: auto; max-height: none; }

/* --- Footer --- */
footer {
  padding: 20px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--t3);
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
footer a { color: var(--t2); text-decoration: none; transition: color 0.15s; }
footer a:hover { color: var(--text); }
.dot { opacity: 0.3; }

/* --- Mobile --- */
@media (max-width: 640px) {
  .app { padding: 0 16px 40px; }
  .hero h1 { font-size: 32px; }
  .brand-name { font-size: 15px; }
  .url-row { flex-direction: column; }
  .run-btn { width: 100%; }
  .options-row { flex-direction: column; }
  .pills { gap: 8px; }
  .output-top, .detail-top { flex-direction: column; align-items: flex-start; }
  footer { flex-wrap: wrap; }
  .floater { opacity: 0.08; }
  .runs-table th:nth-child(4), .runs-table td:nth-child(4) { display: none; }
  .detail-card { max-height: 90vh; }
  .detail-overlay { padding: 12px; }
  .runs-page-header h1 { font-size: 22px; }
}

::selection { background: rgba(34,197,94,0.2); }
