/* ============================================================
   QR Generator — tool-specific styles.
   Loads on top of lrf-theme.css (shared brand chrome).
   ============================================================ */

/* ---------- Layout ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }

.card { background: var(--lrf-white); border: 1px solid var(--lrf-line); border-radius: var(--r); padding: 1.8rem; }
.card-cream { background: var(--lrf-cream); }

.subhead {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  color: var(--lrf-pink); margin: 0.5rem 0 1.1rem; display: flex; align-items: center; gap: 0.5rem;
}
.subhead::after { content: ""; flex: 1; height: 1px; background: var(--lrf-line); }

/* ---------- Fields ---------- */
.field { margin-bottom: 1.4rem; }
.field label {
  display: flex; align-items: center; gap: 0.4rem; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600; color: var(--lrf-muted); margin-bottom: 0.5rem;
}
.row { display: flex; gap: 1rem; }
.row .field { flex: 1; }

/* ---------- Colour swatches ---------- */
.swatches { display: flex; gap: 0.5rem; }
.swatch {
  width: 38px; height: 38px; border-radius: var(--r); cursor: pointer;
  border: 1.5px solid var(--lrf-line); position: relative; transition: all 0.15s;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.active { border-color: var(--lrf-pink); box-shadow: 0 0 0 3px var(--lrf-pink-light); }
.swatch.active::after {
  content: ""; position: absolute; inset: 0; border-radius: 2px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5l4 4 8-8' stroke='%23ffffff' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; mix-blend-mode: difference;
}

/* ---------- Range slider ---------- */
input[type=range] { width: 100%; accent-color: var(--lrf-pink); }
.rangeval { color: var(--lrf-pink); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Toggle switch ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 0.2rem 0; }
.toggle-row .lbl { font-size: 14px; font-weight: 600; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--lrf-line); border-radius: var(--r); transition: 0.15s; cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 4px; top: 4px; background: var(--lrf-white); border-radius: 2px; transition: 0.15s; }
.switch input:checked + .slider { background: var(--lrf-pink); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Help tooltip ---------- */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: 1.2px solid var(--lrf-muted);
  color: var(--lrf-muted); font-size: 10px; font-weight: 700; cursor: help;
  position: relative; line-height: 1; flex-shrink: 0;
}
.help:hover { border-color: var(--lrf-pink); color: var(--lrf-pink); }
.help .tip {
  visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 230px; background: var(--lrf-ink); color: var(--lrf-white);
  padding: 0.7rem 0.85rem; border-radius: var(--r); font-size: 12px; font-weight: 400;
  line-height: 1.45; letter-spacing: 0; text-transform: none; z-index: 10;
  box-shadow: var(--shadow-lg); transition: opacity 0.15s; pointer-events: none;
}
.help .tip::after { content: ""; position: absolute; top: 100%; left: 7px; border: 6px solid transparent; border-top-color: var(--lrf-ink); }
.help .tip b { color: var(--lrf-pink-light); font-weight: 700; }
.help .tip code { background: rgba(255,255,255,0.14); padding: 0 3px; border-radius: 2px; font-size: 11px; }
.help:hover .tip { visibility: visible; opacity: 1; }

/* ---------- Encoded URL readout ---------- */
.urlout {
  font-size: 12px; word-break: break-all; background: var(--lrf-white); border: 1px dashed var(--lrf-line);
  border-radius: var(--r); padding: 0.7rem 0.85rem; color: var(--lrf-ink-soft); line-height: 1.5;
}
.urlout .q { color: var(--lrf-pink); font-weight: 700; }

/* ---------- Preview ---------- */
.preview-wrap { display: flex; flex-direction: column; align-items: center; position: sticky; top: 1.5rem; }
.qrstage { background: var(--lrf-white); padding: 24px; border: 1px solid var(--lrf-line); border-radius: var(--r); min-height: 300px; display: flex; align-items: center; justify-content: center; }
.qrstage canvas { display: block; }
.empty { color: var(--lrf-muted); font-size: 14px; text-align: center; }

.note { margin-top: 1.25rem; width: 100%; font-size: 13px; line-height: 1.5; padding: 0.85rem 1rem; border-radius: var(--r); border: 1px solid var(--lrf-line); }
.note.ok { background: var(--lrf-cream); color: var(--lrf-ink-soft); }
.note.warn { background: var(--lrf-pink-light); border-color: var(--lrf-pink); color: var(--lrf-ink); }
.note strong { font-weight: 700; }

.actions { display: flex; gap: 0.8rem; margin-top: 1.5rem; width: 100%; }
.actions .btn { flex: 1; }
.dl-caption { margin-top: 0.9rem; font-size: 12px; line-height: 1.45; color: var(--lrf-muted); text-align: center; max-width: 320px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
}
@media (max-width: 640px) {
  .help .tip { width: 180px; }
}
