* { box-sizing: border-box; }

:root {
  --primary: #5b5bf0;
  --primary-dark: #4d4dd8;
  --primary-soft: #ececff;
  --text: #202124;
  --muted: #68707a;
  --border: #dedfe3;
  --background: #f7f7f8;
  --soft: #f0f0f2;
  --success: #18794e;
  --success-soft: #e8f5ef;
  --danger: #c62839;
  --danger-soft: #fbeaec;
  --warning: #a05a00;
  --warning-soft: #fdf1e0;
  --white: #ffffff;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }
code { background: var(--soft); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

.site-header { text-align: center; padding: 34px 20px 28px; }
.site-header h1 { margin: 0 0 7px; font-size: clamp(29px, 4vw, 38px); line-height: 1.2; }
.site-header p { margin: 0; color: var(--muted); font-size: 16px; }

.container { width: min(900px, calc(100% - 32px)); margin: 0 auto 52px; }
.container-wide { width: min(1100px, calc(100% - 32px)); }

.tool-card { background: #fff; border-radius: 9px; padding: 24px; box-shadow: 0 1px 5px rgba(0, 0, 0, .04); }
.tool-card + .tool-card { margin-top: 20px; }

.tool-intro { margin-bottom: 20px; }
.tool-intro h2 { margin: 0 0 5px; font-size: 21px; }
.tool-intro p { margin: 0; color: var(--muted); }

/* ---------------- Crawl form ---------------- */

.crawl-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.field-action { display: flex; gap: 8px; }
.field-action .primary-btn { flex: 1; white-space: nowrap; }
.field-action .secondary-btn { white-space: nowrap; }

.field label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 13.5px; }

.field input[type="text"], .field input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
}

.primary-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn:hover { background: var(--primary-dark); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; }

.secondary-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 15px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}

.secondary-btn:hover { background: var(--soft); }

.text-btn {
  border: 0;
  background: none;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.form-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------------- Progress ---------------- */

.crawl-progress { margin-top: 20px; }

.progress-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 4%;
  background: var(--primary);
  transition: width .25s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- Results table ---------------- */

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.table-filter {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  background: var(--white);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

.results-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.results-table th, .results-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.results-table th { background: var(--soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.results-table td.wrap { white-space: normal; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover { background: #fafafe; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.pagination #pageInfo { font-size: 13px; color: var(--muted); font-weight: 600; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.results-table a { color: var(--primary-dark); text-decoration: none; }
.results-table a:hover { text-decoration: underline; }

.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.status-pill.ok { background: var(--success-soft); color: var(--success); }
.status-pill.warn { background: var(--warning-soft); color: var(--warning); }
.status-pill.bad { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Sitemap canvas ---------------- */

.sitemap-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.sitemap-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.figma-note { margin: -8px 0 16px; font-size: 12.5px; color: var(--muted); background: var(--soft); padding: 10px 13px; border-radius: 8px; }

.sitemap-canvas-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  height: 520px;
  overflow: hidden;
  position: relative;
  cursor: grab;
}

.sitemap-canvas-wrap.dragging { cursor: grabbing; }

#sitemapSvg { width: 100%; height: 100%; display: block; }

/* ---------------- Content / FAQ ---------------- */

.content-section { margin-top: 32px; padding: 0 4px; }
.content-section h2 { margin: 0 0 10px; font-size: 25px; }
.content-section h3 { margin: 26px 0 7px; font-size: 19px; }
.content-section p, .content-section li { color: #454a51; }
.content-section ol { padding-left: 23px; }

.site-footer { margin-top: auto; padding: 18px; text-align: center; background: #ededee; color: #30343a; }
.site-footer p { margin: 0; }

@media (max-width: 760px) {
  .tool-card { padding: 17px; }
  .crawl-form { grid-template-columns: 1fr 1fr; }
  .field-url { grid-column: 1 / -1; }
  .field-action { grid-column: 1 / -1; }
  .field-action .primary-btn, .field-action .secondary-btn { flex: 1; }
  .sitemap-canvas-wrap { height: 380px; }
}
