/* ============================================================
   Utility Tools — shared stylesheet
   Plain CSS, no build step. Mobile breakpoint: 768px.
   ============================================================ */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2733;
  --ink-soft: #5b6b7b;
  --accent: #0d9488;
  --accent-dark: #0b7c72;
  --accent-soft: #e6f5f3;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --ok: #1e7e34;
  --ok-soft: #e8f5ec;
  --border: #d8dee5;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --maxw: 960px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- Header / nav ---------- */

.site-header {
  background: var(--code-bg);
  color: var(--code-ink);
  border-bottom: 3px solid var(--accent);
}

.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.site-logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.site-logo .prompt { color: var(--accent); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  color: #b8c4d0;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover { color: #fff; }

.site-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--accent);
}

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

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.7rem;
  line-height: 1.25;
  margin: 0.5rem 0 0.25rem;
}

.tagline, .tool-intro {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  max-width: 42rem;
}

/* ---------- Ad slots (empty until AdSense approval) ---------- */

.ad-slot { min-height: 0; margin: 1rem 0; }
.ad-slot:empty { display: none; }

/* ---------- Landing page tool cards ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.12);
}

.tool-card h2 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-family: var(--mono);
  color: var(--accent-dark);
}

.tool-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------- Tool page building blocks ---------- */

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 0.35rem;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}

.btn:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn-small {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
  align-items: center;
}

/* Two-column tool layout (stacks on mobile) */
.tool-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Code-style output block */
.output-block {
  position: relative;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  min-height: 3rem;
}

.output-block.wrap { white-space: pre-wrap; word-break: break-all; }

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  font-family: var(--sans);
  background: rgba(255, 255, 255, 0.12);
  color: var(--code-ink);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.copy-btn:hover { background: rgba(255, 255, 255, 0.22); }
.copy-btn.copied { background: var(--accent); border-color: var(--accent); color: #fff; }

.output-wrap { position: relative; }

/* JSON syntax highlighting */
.json-key { color: #7dd3fc; }
.json-string { color: #bef264; }
.json-number { color: #fbbf24; }
.json-bool { color: #f472b6; }
.json-null { color: #94a3b8; }

/* Status / error messages */
.msg {
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  margin: 0.75rem 0;
}

.msg-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f0b9b1;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid #bcdfc6;
}

.msg[hidden] { display: none; }

/* Preset chips (regex presets, cron presets) */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.preset-chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #b8e0db;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.preset-chip:hover { background: #d3ede9; border-color: var(--accent); }

/* Regex tester specifics */
.regex-flags {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.regex-flags label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }

.highlight-view {
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 3rem;
}

mark.match {
  background: #fde68a;
  color: inherit;
  border-radius: 2px;
  padding: 0;
}

mark.match:nth-of-type(even) { background: #a7f3d0; }

.match-list { list-style: none; padding: 0; margin: 0.5rem 0; }

.match-list li {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: #fbfcfd;
  overflow-wrap: break-word;
}

.match-list .group { color: var(--ink-soft); display: block; padding-left: 1rem; }

/* UUID generator specifics */
.uuid-list { list-style: none; padding: 0; margin: 0.75rem 0; }

.uuid-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.uuid-list input[type="text"] { flex: 1; }

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}

.toggle-row label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }

.toggle-row select { width: auto; }

/* Cron parser specifics */
.cron-readable {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin: 0.75rem 0;
}

.run-list { list-style: none; padding: 0; margin: 0.5rem 0; }

.run-list li {
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.run-list li:last-child { border-bottom: none; }

.run-list .relative { color: var(--ink-soft); font-family: var(--sans); font-size: 0.82rem; }

/* SEO copy sections under tools */
.tool-about {
  margin-top: 2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 44rem;
}

.tool-about h2 { font-size: 1.1rem; color: var(--ink); }

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

.site-footer {
  background: var(--code-bg);
  color: #8b98a5;
  font-size: 0.82rem;
  margin-top: 2rem;
}

.site-footer .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-footer a { color: #b8c4d0; text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
  h1 { font-size: 1.35rem; }

  .site-header .inner { flex-direction: column; align-items: flex-start; }

  .tool-columns { grid-template-columns: 1fr; }

  .tool-panel { padding: 0.9rem; }

  textarea { min-height: 140px; }

  .btn-row .btn { flex: 1 1 auto; text-align: center; }
}
