/* Barcode Generator — content styles.
   Prefix: --bar-  /  .bar-
   Styles the content area inside <main> only.
   Theme accent is provided by --tf-accent (#1f4e5f in light, #5fa8bf in dark).
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bar-surface: #ffffff;   /* cards and panels */
  --bar-panel:   #f8fafc;   /* recessed areas */
  --bar-line:    #e2e8f0;   /* hairline borders */
  --bar-text:    #0f172a;   /* primary text */
  --bar-muted:   #64748b;   /* labels and captions */
}

.bar-main {
  padding-block: 0.5rem 2.5rem;
}

.bar-wrap {
  width: 100%;
  max-width: 56rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Presets Row ─────────────────────────────────────────────────────────── */

.bar-presets-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.bar-preset-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bar-muted);
  margin-right: 0.25rem;
}

.bar-option,
.bar-preset-btn {
  background: var(--bar-surface);
  color: var(--bar-muted);
  border: 1px solid var(--bar-line);
  border-radius: 2px;
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.bar-option:hover,
.bar-preset-btn:hover {
  border-color: var(--tf-accent);
  color: var(--bar-text);
}

.bar-option[aria-selected="true"],
.bar-option.active,
.bar-preset-btn[aria-selected="true"],
.bar-preset-btn.active {
  background: var(--tf-accent-wash);
  border-color: var(--tf-accent);
  color: var(--tf-accent);
  font-weight: 700;
}

/* ── Layout Grid ─────────────────────────────────────────────────────────── */

.bar-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 48rem) {
  .bar-grid {
    grid-template-columns: 1fr;
  }
}

.bar-panel {
  background: var(--bar-surface);
  border: 1px solid var(--bar-line);
  border-radius: 2px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.bar-panel-heading {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bar-muted);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--bar-line);
}

/* ── Form Controls ───────────────────────────────────────────────────────── */

.bar-field {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.35rem;
}

.bar-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bar-muted);
}

.bar-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--tf-accent);
}

.bar-select,
.bar-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--bar-text);
  background: var(--bar-surface);
  border: 1px solid var(--bar-line);
  border-radius: 2px;
  box-sizing: border-box;
}

.bar-select:focus-visible,
.bar-input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 1px;
  border-color: var(--tf-accent);
}

.bar-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--bar-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.bar-row {
  display: flex;
  gap: 0.75rem;
}

.bar-half {
  flex: 1;
}

.bar-range {
  width: 100%;
  accent-color: var(--tf-accent);
  cursor: pointer;
}

.bar-checkbox-wrap {
  margin-block: 0.25rem 1rem;
}

.bar-chk-lbl {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--bar-text);
  cursor: pointer;
}

.bar-chk {
  accent-color: var(--tf-accent);
}

/* ── Primary Action Button ───────────────────────────────────────────────── */

.bar-btn,
.bar-btn-primary {
  width: 100%;
  padding: 0.6875rem 1.25rem;
  background: var(--tf-accent);
  color: var(--tf-accent-ink);
  border: 1px solid var(--tf-accent);
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
  margin-top: auto;
}

.bar-btn:hover,
.bar-btn-primary:hover {
  background: var(--tf-accent-hover);
  border-color: var(--tf-accent-hover);
}

.bar-btn:active,
.bar-btn-primary:active {
  background: var(--tf-accent-active);
  border-color: var(--tf-accent-active);
}

.bar-btn:focus-visible,
.bar-btn-primary:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ── Barcode Preview Stage ───────────────────────────────────────────────── */

.bar-preview-panel {
  display: flex;
  flex-direction: column;
}

.bar-stage {
  background: #ffffff;
  border: 1px solid var(--bar-line);
  border-radius: 2px;
  padding: 1.5rem;
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.bar-svg-element {
  max-width: 100%;
  height: auto;
  display: block;
}

.bar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.bar-btn-secondary {
  flex: 1;
  min-width: 7.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--bar-surface);
  color: var(--bar-text);
  border: 1px solid var(--bar-line);
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.bar-btn-secondary:hover {
  border-color: var(--tf-accent);
  background: var(--tf-accent-wash);
  color: var(--tf-accent);
}

.bar-btn-secondary:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 1px;
}

/* ── Ad Slots (Reserved height, zero CLS) ─────────────────────────────────── */

.bar-ad {
  margin-block: 2rem;
  min-height: 280px;
  border: 1px dashed var(--bar-line);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --bar-surface: var(--tf-surface);
  --bar-panel: var(--tf-surface);
  --bar-line: var(--tf-surface);
  --bar-text: var(--tf-ink);
  --bar-muted: var(--tf-ink-faint);
}
