/* ============================================
   Pixia - Barcode Generator tool page
   (loaded only on barcode.html)
   ============================================ */

/* Two-column layout: live preview on the left, content + design panels on the right. */
#bcTool {
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
}

/* Keep the live preview in view while scrolling the options. */
.bc-side {
  position: sticky;
  inset-block-start: 84px;
  align-self: start;
}

@media (max-width: 1080px) {
  #bcTool {
    grid-template-columns: 1fr;
  }

  .bc-side {
    position: static;
  }
}

.at-barcode .at-kicker {
  background: linear-gradient(135deg, #10b981, #0891b2);
}

.at-barcode .at-drop-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, .18), rgba(8, 145, 178, .18));
  color: #0d9488;
}

.at-barcode .at-step-num {
  background: color-mix(in srgb, #10b981 18%, transparent);
}

/* ---------- Fields ---------- */
.bc-legend {
  display: flex;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-secondary);
  margin-block-end: 9px;
}

.bc-field {
  display: block;
}

.bc-field + .bc-field,
.bc-row + .bc-row,
.bc-row {
  margin-block-start: 14px;
}

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

.bc-cell {
  display: grid;
  gap: 7px;
}

.bc-input,
.bc-field input[type="text"],
.bc-field select,
.bc-field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--at-radius-md, 12px);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: 0;
  color-scheme: light dark;
}

.bc-field select option {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.bc-input:focus,
.bc-field input:focus,
.bc-field select:focus {
  border-color: #10b981;
}

.bc-value {
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
  letter-spacing: .02em;
}

.bc-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.bc-check input {
  accent-color: #10b981;
  width: 16px;
  height: 16px;
}

.bc-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.bc-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bc-switch i {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--glass-border);
  transition: background .18s;
}

.bc-switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .18s;
}

.bc-switch input:checked + i { background: #10b981; }
.bc-switch input:checked + i::after { transform: translateX(16px); }
[dir="rtl"] .bc-switch input:checked + i::after { transform: translateX(-16px); }
.bc-switch input:focus-visible + i { outline: 2px solid #10b981; outline-offset: 2px; }
.bc-switch input:disabled + i { opacity: .45; }
.bc-switch input:disabled ~ span { opacity: .6; }
.ce-cp-wrap { display:inline-flex; align-items:center; gap:8px; }
.ce-cp-swatch:disabled { opacity:.5; cursor:default; }
.ce-cp-native { position:absolute; opacity:0; pointer-events:none; width:1px; height:1px; border:0; padding:0; margin:0; }

/* ---------- Design section ---------- */
.bc-design {
  margin-block-start: 22px;
  padding-block-start: 18px;
  border-block-start: 1px solid var(--glass-border);
}

.bc-design h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.06rem;
  letter-spacing: -.015em;
}

.bc-opt {
  margin-block-start: 14px;
}

.bc-opt > .bc-legend {
  margin-block-end: 8px;
}

.bc-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bc-color-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--at-radius-md, 12px);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

.bc-color-cell span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bc-color-cell input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.bc-range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bc-range-row input[type="range"] {
  flex: 1;
  accent-color: #10b981;
}

.bc-range-row output {
  min-width: 42px;
  text-align: end;
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.bc-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

.bc-hint strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Preview ---------- */
.bc-preview {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 26px;
  border-radius: var(--at-radius-lg, 18px);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  overflow: auto;
}

.bc-svg {
  width: 100%;
  max-width: 440px;
  height: auto;
  display: block;
}

.bc-empty {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.7;
  max-width: 32ch;
}

.bc-empty svg {
  width: 44px;
  height: 44px;
  color: var(--text-muted);
}

.bc-empty.is-error {
  color: #ef4444;
}

.bc-empty.is-error svg {
  color: #ef4444;
}

.bc-actions {
  margin-block-start: 18px;
  display: grid;
  gap: 9px;
}

.bc-actions .at-btn {
  width: 100%;
}

@media (max-width: 560px) {
  .bc-row,
  .bc-colors {
    grid-template-columns: 1fr;
  }
}
