/* =============================================================
   Strapi Message URL Builder — styles
   Light + dark mode via prefers-color-scheme.
   Modelled on the fatsecret Cache Admin internal-tool aesthetic.
   ============================================================= */

/* ----- Theme tokens ----- */

:root {
  color-scheme: light dark;

  /* Warm off-white background, white cards, near-black text */
  --bg:               #fbfaf6;
  --surface:          #ffffff;
  --surface-alt:      #f4f2eb;
  --surface-raised:   #ffffff;

  --text:             #1a1f26;
  --text-strong:      #0d1117;
  --text-muted:       #6b7382;

  --border:           #e7e3d8;
  --border-strong:    #d6d1c2;

  --accent:           #1a7f5a;      /* forest green */
  --accent-hover:     #156747;
  --accent-soft-bg:   #ebf5f0;

  --warn:             #c2510c;
  --warn-bg:          #fef3e7;
  --warn-border:      #f3d3a6;

  --error:            #c93838;
  --idle:             #a4a89d;

  --pill-bg:          #f1efe7;
  --pill-text:        #5d6573;

  --radius-lg:        12px;
  --radius-md:        8px;
  --radius-sm:        4px;

  --shadow-sm:        0 1px 2px rgba(20, 25, 35, 0.04);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable",
               "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:               #0d1117;
    --surface:          #161b22;
    --surface-alt:      #1c222b;
    --surface-raised:   #1a2029;

    --text:             #e6edf3;
    --text-strong:      #f0f6fc;
    --text-muted:       #8b949e;

    --border:           #2d343d;
    --border-strong:    #3d4450;

    --accent:           #3fbe8c;
    --accent-hover:     #56d1a0;
    --accent-soft-bg:   #14342a;

    --warn:             #ee9c5a;
    --warn-bg:          #2c2014;
    --warn-border:      #5a3d1e;

    --error:            #e16868;
    --idle:             #6a727e;

    --pill-bg:          #21262d;
    --pill-text:        #b1bac4;

    --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* ----- Reset / base ----- */

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

html, body {
  background: var(--bg);
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

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

.page-header { margin-bottom: 1.5rem; }

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.page-desc {
  margin: 0;
  color: var(--text-muted);
  max-width: 70ch;
}

/* ----- Status banner ----- */

.status-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  line-height: 1.45;
}

.status-banner .dot { margin-top: 0.45rem; }
.status-banner strong { color: var(--text-strong); white-space: nowrap; }
.status-banner code,
.muted code,
p code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--pill-bg);
  color: var(--pill-text);
  padding: 0.05em 0.35em;
  border-radius: var(--radius-sm);
}

/* ----- Card ----- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-strong);
}

.card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 75ch;
}

.card-desc code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--pill-bg);
  color: var(--pill-text);
  padding: 0.05em 0.35em;
  border-radius: var(--radius-sm);
}

/* ----- Step block (numbered section inside a card) ----- */

.step-block { padding: 1.1rem 1.5rem; }
.step-block + .step-block { border-top: 1px solid var(--border); }

.step-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent-soft-bg);
  color: var(--accent);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
}

.step-body > * + * { margin-top: 0.6rem; }

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

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-bg);
}

select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background-clip: padding-box;
}

option { padding: 0.25rem 0.5rem; }

textarea {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  resize: vertical;
  line-height: 1.5;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

/* Field labels (above an input) */

.field-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
}

/* Radio row */

.radio-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.radio:has(input:checked) {
  background: var(--accent-soft-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ----- Buttons ----- */

button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
  background: var(--accent-soft-bg);
  border-color: var(--accent);
}

button:active { transform: translateY(1px); }

button:disabled,
button:disabled:hover {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

/* Default style fallback for any button without a class */
button:not(.btn-primary):not(.btn-ghost) {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
button:not(.btn-primary):not(.btn-ghost):hover { background: var(--surface-alt); }

.actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.convert-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0 1.5rem 0;
  margin: -0.25rem 0 0;
  flex-wrap: wrap;
}

/* ----- Pills / dots ----- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  background: var(--pill-bg);
  color: var(--pill-text);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.pill.muted-pill {
  background: transparent;
  border-color: var(--border);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
  flex-shrink: 0;
}
.dot-accent { background: var(--accent); }
.dot-warn   { background: var(--warn); }
.dot-error  { background: var(--error); }
.dot-idle   { background: var(--idle); }

.muted { color: var(--text-muted); font-size: 0.85rem; }

/* ----- Attribute checklist ----- */

#attrs-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  background: var(--surface-alt);
}

.attr-group { margin-bottom: 0.75rem; }
.attr-group:last-child { margin-bottom: 0; }

.attr-group h3 {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.attr-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.25rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}
.attr-row:hover { background: var(--surface); }

.attr-row label {
  flex: 1;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--text);
}
.attr-row code {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.encode-tag,
.array-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.05em 0.45em;
  border-radius: var(--radius-sm);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.encode-tag { background: var(--pill-bg); color: var(--pill-text); }
.array-tag  { background: var(--accent-soft-bg); color: var(--accent); }
