/* Intentik — Dark Security UI */
:root {
  --bg: #0a0e17;
  --bg2: #111827;
  --bg3: #1a2233;
  --surface: #1e293b;
  --border: #2d3a4f;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --green: #22c55e;
  --green-dim: #16a34a;
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #eab308;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

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

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

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ── Header ────────────────────────────── */
header {
  padding: 40px 0 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.logo {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green) 0%, var(--cyan) 50%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.logo .logo-icon {
  -webkit-text-fill-color: initial;
  font-size: 2rem;
}

.tagline {
  color: var(--text2);
  font-size: 0.95rem;
  margin-top: 6px;
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.slogan {
  color: var(--accent);
  font-size: 0.7rem;
  margin-top: 4px;
  font-family: var(--mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.8;
}

.stats-counter {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
}

.stat-value {
  color: var(--green);
  font-weight: 700;
  font-size: 1.1rem;
}

.stat-value.threats {
  color: var(--red);
}

.status-bar {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 12px;
  font-size: 0.8rem;
  font-family: var(--mono);
}

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.off { background: var(--text2); }

/* ── Scan Form ─────────────────────────── */
.scan-section { margin-bottom: 30px; }

.scan-form {
  display: flex;
  gap: 10px;
}

.scan-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.scan-input:focus { border-color: var(--green); }
.scan-input::placeholder { color: var(--text2); opacity: 0.6; }

.scan-btn {
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--green-dim), var(--green));
  color: #000;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.scan-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3); }
.scan-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text2);
}

.upload-label {
  cursor: pointer;
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-label:hover { color: var(--green); }
#file-upload { display: none; }
#upload-name { font-family: var(--mono); font-size: 0.8rem; }

/* ── Tabs ──────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Result Panel ──────────────────────── */
#result-panel { display: none; }

.result-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
}

.hash-info {
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text2);
  display: none;
}

.hash-info .hash-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.hash-info .hash-row:last-child { margin-bottom: 0; }

.hash-label {
  color: var(--cyan);
  font-weight: 600;
  min-width: 55px;
}

.hash-value {
  word-break: break-all;
  color: var(--text2);
  cursor: pointer;
}

.hash-value:hover { color: var(--text); }

.score-badge {
  width: 70px; height: 70px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--mono);
  flex-shrink: 0;
}

.score-A { background: rgba(34,197,94,0.15); color: var(--green); border: 2px solid var(--green); }
.score-B { background: rgba(6,182,212,0.15); color: var(--cyan); border: 2px solid var(--cyan); }
.score-C { background: rgba(234,179,8,0.15); color: var(--yellow); border: 2px solid var(--yellow); }
.score-D { background: rgba(249,115,22,0.15); color: var(--orange); border: 2px solid var(--orange); }
.score-F { background: rgba(239,68,68,0.15); color: var(--red); border: 2px solid var(--red); }

.result-meta { flex: 1; }
.result-meta h2 { font-size: 1.1rem; margin-bottom: 4px; }
.result-meta .meta-line { font-size: 0.85rem; color: var(--text2); font-family: var(--mono); }

.severity-pills {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
}

.pill-critical { background: rgba(239,68,68,0.2); color: var(--red); }
.pill-high { background: rgba(249,115,22,0.2); color: var(--orange); }
.pill-medium { background: rgba(234,179,8,0.2); color: var(--yellow); }
.pill-low { background: rgba(6,182,212,0.2); color: var(--cyan); }
.pill-info { background: rgba(148,163,184,0.2); color: var(--text2); }

/* ── Findings List ─────────────────────── */
.findings-list { display: flex; flex-direction: column; gap: 8px; }

.finding-card {
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 3px solid var(--text2);
  transition: border-color 0.2s;
}

.finding-card:hover { border-color: var(--border); background: var(--bg3); }

.finding-card.sev-critical { border-left-color: var(--red); }
.finding-card.sev-high { border-left-color: var(--orange); }
.finding-card.sev-medium { border-left-color: var(--yellow); }
.finding-card.sev-low { border-left-color: var(--cyan); }
.finding-card.sev-info { border-left-color: var(--text2); }

.finding-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.finding-name { font-weight: 600; font-size: 0.9rem; }

.sev-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.sev-tag.critical { color: var(--red); }
.sev-tag.high { color: var(--orange); }
.sev-tag.medium { color: var(--yellow); }
.sev-tag.low { color: var(--cyan); }
.sev-tag.info { color: var(--text2); }

.finding-desc { font-size: 0.83rem; color: var(--text2); margin-bottom: 6px; }

.finding-location {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text2);
  opacity: 0.8;
}

.finding-context {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--purple);
  overflow-x: auto;
  white-space: pre;
}

/* ── LLM Results ───────────────────────── */
.llm-section { margin-top: 20px; }

.llm-card {
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
}

.llm-card.malicious { border-left: 3px solid var(--red); }
.llm-card.safe { border-left: 3px solid var(--green); }

.llm-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.llm-file { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.llm-confidence { font-family: var(--mono); font-size: 0.8rem; color: var(--text2); }
.llm-summary { font-size: 0.85rem; color: var(--text2); line-height: 1.5; }

/* ── Comments ──────────────────────────── */
.comments-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.comments-section h3 {
  margin-bottom: 16px;
  font-size: 1rem;
  color: var(--text);
}

.comment-card {
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.comment-author {
  font-weight: 600;
  color: var(--cyan);
}

.comment-type {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.comment-type.info { background: rgba(59,130,246,0.2); color: var(--blue); }
.comment-type.false-positive { background: rgba(34,197,94,0.2); color: var(--green); }
.comment-type.false-negative { background: rgba(249,115,22,0.2); color: var(--orange); }

.comment-date {
  color: var(--text2);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.comment-body {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.comment-form input,
.comment-form select,
.comment-form textarea {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.comment-form input:focus,
.comment-form select:focus,
.comment-form textarea:focus {
  border-color: var(--cyan);
}

.comment-form select {
  cursor: pointer;
}

.comment-form textarea {
  resize: vertical;
  min-height: 60px;
}

.comment-submit {
  align-self: flex-end;
  padding: 8px 20px;
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.comment-submit:hover { opacity: 0.9; transform: translateY(-1px); }

.no-comments {
  color: var(--text2);
  font-size: 0.85rem;
  text-align: center;
  padding: 16px;
}

/* ── Timeline ──────────────────────────── */
.timeline-container {
  padding: 20px;
}

.timeline-url {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--cyan);
  margin-bottom: 20px;
  word-break: break-all;
}

.timeline-entry {
  position: relative;
  padding: 16px 20px 16px 40px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 24px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
}

.timeline-entry.changed::before {
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.timeline-score {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 0.9rem;
}

.timeline-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text2);
}

.timeline-hash {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text2);
  word-break: break-all;
}

.timeline-change {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--orange);
  font-weight: 600;
}

.timeline-empty {
  text-align: center;
  padding: 40px;
  color: var(--text2);
}

.timeline-search {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.timeline-search input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
}

.timeline-search input:focus { border-color: var(--cyan); }

.timeline-search button {
  padding: 10px 20px;
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ── History ───────────────────────────── */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.history-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text2);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.history-table tr { cursor: pointer; transition: background 0.15s; }
.history-table tbody tr:hover { background: var(--bg2); }

.target-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hash-cell {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text2);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-score {
  display: inline-block;
  width: 28px; height: 28px;
  border-radius: 6px;
  text-align: center;
  line-height: 28px;
  font-weight: 800;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ── Loading ───────────────────────────── */
.spinner {
  display: inline-block;
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-panel {
  text-align: center;
  padding: 60px 20px;
}

.loading-panel p {
  margin-top: 16px;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ── Empty State ───────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Responsive ────────────────────────── */
@media (max-width: 640px) {
  .scan-form { flex-direction: column; }
  .result-header { flex-direction: column; text-align: center; }
  .severity-pills { justify-content: center; }
  .logo { font-size: 1.8rem; }
  .stats-counter { flex-direction: column; gap: 8px; }
  .timeline-search { flex-direction: column; }
}

/* ── Bots Panel ────────────────────────── */
.bots-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.bots-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
}

.bots-stat-value {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 4px;
  word-break: break-all;
}

.bots-stat-label {
  font-size: 0.78rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bots-table .bot-id-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--cyan);
  font-weight: 600;
}

.bot-name {
  color: var(--purple);
  font-weight: 600;
}

.bot-anon {
  color: var(--text2);
  font-style: italic;
}

.ip-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text2);
}

.endpoint-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text2);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-req-count {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--green);
}

/* Bot Detail */
.bot-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.bot-back-btn:hover {
  border-color: var(--green);
  color: var(--text);
}

.bot-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.bot-detail-icon {
  font-size: 2.5rem;
}

.bot-detail-info h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.bot-detail-id {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--cyan);
}

.bot-ua {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  word-break: break-all;
}

.bot-ua-label {
  color: var(--text2);
  margin-right: 8px;
}

.bot-ua-value {
  font-family: var(--mono);
  color: var(--text);
}

.method-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.method-GET { background: rgba(34,197,94,0.2); color: var(--green); }
.method-POST { background: rgba(59,130,246,0.2); color: var(--blue); }
.method-PUT { background: rgba(234,179,8,0.2); color: var(--yellow); }
.method-DELETE { background: rgba(239,68,68,0.2); color: var(--red); }

/* Detection Section */
.detection-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.detection-section h2 {
  font-size: 1.5rem;
  color: var(--green);
  margin-bottom: 0.3rem;
}
.detection-subtitle {
  color: var(--dim);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.detection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.detection-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  transition: border-color 0.2s;
}
.detection-card:hover {
  border-color: var(--green);
}
.detection-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.detection-card h3 {
  font-size: 0.95rem;
  color: #e2e8f0;
  margin-bottom: 0.4rem;
}
.detection-card p {
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.4;
}
.detection-card a {
  color: var(--green);
  text-decoration: none;
}
.detection-card a:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--dim);
  font-size: 0.85rem;
}
.site-footer a {
  color: var(--green);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* AI & API Section */
.ai-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.ai-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.ai-subtitle {
  color: var(--text2);
  margin-bottom: 1.5rem;
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.ai-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.ai-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}
.ai-card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
.ai-card h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--green);
  margin-bottom: 0.4rem;
}
.ai-card p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.4;
}
.ai-quickstart {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.ai-quickstart p {
  color: var(--text2);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.ai-quickstart code {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--green);
  word-break: break-all;
  line-height: 1.5;
}
