/*
  sitemapmaker — visual identity

  Palette:
    --ink:        #0b0d0c   (near-black base, slight green cast — old terminal glass)
    --ink-raised: #12160f
    --line:       #21281d
    --paper:      #dfe6d4   (phosphor off-white)
    --paper-dim:  #8fa085
    --signal:     #7ef2a3   (crawl signal green — nodes lighting up)
    --alert:      #f2905a   (warm amber for warnings, not red — nothing here is a crisis)
    --wire:       #35422f

  Type:
    Display/mono: 'JetBrains Mono' — the whole UI is monospace, like a crawl log.
    No separate body face; this is a tool, not a magazine.

  Signature element:
    The live node-graph map — every crawled page appears as a lit node,
    connected by a wire to the page that linked it. The sitemap draws itself
    in real time as the literal artifact of what the tool does.
*/

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

:root {
  --ink: #0b0d0c;
  --ink-raised: #12160f;
  --line: #21281d;
  --paper: #dfe6d4;
  --paper-dim: #8fa085;
  --signal: #7ef2a3;
  --signal-dim: #3f6b4e;
  --alert: #f2905a;
  --wire: #35422f;
  --radius: 3px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--signal-dim);
  color: var(--paper);
}

/* Subtle CRT scanline texture — ambient, not distracting */
.scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.06) 3px
  );
  opacity: 0.5;
  mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Topbar ---------- */

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--ink-raised);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  letter-spacing: 0.02em;
}

.brand-mark {
  color: var(--signal);
  font-size: 14px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--paper-dim);
  text-transform: lowercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper-dim);
  display: inline-block;
}

.status-dot.running {
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-dot.done {
  background: var(--signal);
}

.status-dot.error {
  background: var(--alert);
  box-shadow: 0 0 8px var(--alert);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 60px;
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  grid-template-areas:
    "control map"
    "log     map"
    "output  output";
}

.panel-control { grid-area: control; }
.panel-map { grid-area: map; }
.panel-log { grid-area: log; }
.panel-output { grid-area: output; }

.panel {
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.panel-title-sm {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  text-transform: lowercase;
  color: var(--paper-dim);
  letter-spacing: 0.02em;
}

.panel-sub {
  font-size: 12.5px;
  color: var(--paper-dim);
  line-height: 1.5;
  margin: 0 0 20px;
}

.cursor {
  color: var(--signal);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- Form ---------- */

.crawl-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 10.5px;
  text-transform: lowercase;
  letter-spacing: 0.06em;
  color: var(--paper-dim);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="url"],
input[type="number"],
select {
  background: var(--ink);
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  color: var(--paper);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

input[type="url"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--signal);
}

input::placeholder {
  color: #4a5744;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--paper-dim);
  cursor: pointer;
}

.field-check input {
  accent-color: var(--signal);
  width: 14px;
  height: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
}

.btn-primary {
  background: var(--signal);
  color: #06210f;
  flex: 1;
}

.btn-primary:hover:not(:disabled) {
  background: #93f7b5;
}

.btn-primary:disabled {
  background: var(--signal-dim);
  color: #12281a;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: var(--wire);
  color: var(--paper-dim);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--paper-dim);
  color: var(--paper);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11.5px;
}

.form-error {
  color: var(--alert);
  font-size: 12px;
  margin: 0;
}

/* ---------- Map panel ---------- */

.panel-map {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.panel-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.counters {
  display: flex;
  gap: 18px;
}

.counter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.counter-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--signal);
  font-variant-numeric: tabular-nums;
}

.counter-label {
  font-size: 10px;
  color: var(--paper-dim);
  text-transform: lowercase;
}

.map-canvas {
  flex: 1;
  width: 100%;
  min-height: 340px;
  background:
    radial-gradient(circle at 1px 1px, var(--wire) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- Log panel ---------- */

.panel-log {
  display: flex;
  flex-direction: column;
  max-height: 420px;
}

.panel-log-header {
  margin-bottom: 10px;
}

.log-stream {
  flex: 1;
  overflow-y: auto;
  font-size: 11.5px;
  line-height: 1.7;
  display: flex;
  flex-direction: column-reverse;
}

.log-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--paper-dim);
}

.log-line .log-tag {
  color: var(--signal);
  margin-right: 6px;
}

.log-line.log-skip .log-tag {
  color: var(--alert);
}

.log-line.log-error .log-tag {
  color: var(--alert);
}

.log-stream::-webkit-scrollbar {
  width: 6px;
}

.log-stream::-webkit-scrollbar-thumb {
  background: var(--wire);
  border-radius: 3px;
}

/* ---------- Output panel ---------- */

.panel-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.xml-preview {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 12px;
  line-height: 1.6;
  max-height: 320px;
  overflow: auto;
  color: var(--paper-dim);
  margin: 0;
}

.xml-preview .xml-tag {
  color: var(--signal);
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 18px;
  font-size: 11px;
  color: var(--paper-dim);
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "control"
      "map"
      "log"
      "output";
  }

  .panel-map {
    min-height: 320px;
  }
}
