/* ============================================================
   Pretvfx-Tools — QR Code Generator
   ============================================================ */

.pfx-qr-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tabs jenis konten */
.pfx-qr-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 19, 32, 0.72);
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.pfx-qr-tab {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #9ca3af;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.pfx-qr-tab:active { transform: scale(.96); }
.pfx-qr-tab.active {
  background: linear-gradient(135deg, rgba(99,102,241,.42), rgba(168,85,247,.35));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.25);
}

/* Field */
.pfx-qr-fields { display: flex; flex-direction: column; gap: 12px; }
.pfx-qr-field { display: flex; flex-direction: column; gap: 6px; }
.pfx-qr-label {
  font-size: .74rem;
  font-weight: 700;
  color: #c7d2fe;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.pfx-qr-input,
.pfx-qr-textarea,
.pfx-qr-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(15, 19, 32, 0.9);
  color: #f3f4f6;
  font-size: .9rem;
  outline: none;
  font-family: inherit;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.pfx-qr-textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.pfx-qr-input:focus,
.pfx-qr-textarea:focus,
.pfx-qr-select:focus {
  border-color: rgba(168, 85, 247, 0.55);
  background: rgba(20, 24, 40, 0.95);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.pfx-qr-input::placeholder,
.pfx-qr-textarea::placeholder { color: #5b6478; }

/* Opsi grid 2 kolom */
.pfx-qr-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pfx-qr-opt { display: flex; flex-direction: column; gap: 6px; }

.pfx-qr-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(15, 19, 32, 0.9);
}
.pfx-qr-color-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.pfx-qr-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.pfx-qr-color-row input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255,255,255,.15); border-radius: 6px; }
.pfx-qr-color-hex {
  flex: 1;
  min-width: 0;
  font-size: .78rem;
  color: #9ca3af;
  font-family: ui-monospace, 'SF Mono', monospace;
  text-transform: uppercase;
  letter-spacing: .02em;
}

/* Preview */
.pfx-qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(99,102,241,.14) 0%, transparent 55%),
    linear-gradient(165deg, rgba(18,22,36,.96), rgba(10,13,23,.96));
  border: 1px solid rgba(99, 102, 241, 0.22);
}
.pfx-qr-canvas-wrap {
  position: relative;
  padding: 14px;
  border-radius: 16px;

  /* Default = tema gelap (bukan putih) */
  background: rgba(15, 19, 32, 0.55);
  border: 1.5px dashed rgba(99, 102, 241, 0.28);
  box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.06);

  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  min-width: 200px;
  min-height: 240px;
  box-sizing: border-box;
  overflow: hidden;
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

/* Saat QR sudah dirender → baru terang */
.pfx-qr-canvas-wrap.has-qr {
  background: #fff;
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 12px 34px rgba(0,0,0,.5), 0 0 0 1px rgba(99,102,241,.18);
}

/* BUGFIX: <img> sebagai flex item defaultnya punya min-width:auto (= lebar
   aslinya), jadi pilihan ukuran 480px/640px overflow dari wrap lalu ke-clip
   habis oleh .tools-overlay{overflow:hidden} — kelihatan seperti "generate
   gagal" padahal gambarnya sebenarnya termuat. min-width:0 + max-width:100%
   memaksa <img> ikut menyusut ke lebar wrap. */
#pfxQrImg {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  min-width: 0;
  flex-shrink: 1;
  border-radius: 6px;
}

.pfx-qr-empty {
  text-align: center;
  color: #6b7280;
  font-size: .82rem;
  padding: 40px 20px;
  line-height: 1.5;
}
.pfx-qr-empty i {
  display: block;
  font-size: 2rem;
  color: #4c5468;
  margin-bottom: 10px;
}

/* Buttons */
.pfx-qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.pfx-qr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 13px;
  border: none;
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease, background .18s ease, opacity .18s ease;
}
.pfx-qr-btn:active:not([disabled]) { transform: scale(.97); }
.pfx-qr-btn.primary {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  box-shadow: 0 8px 22px rgba(99,102,241,.35);
}
.pfx-qr-btn.primary:hover:not([disabled]) { filter: brightness(1.08); }
.pfx-qr-btn.ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(99,102,241,.28);
  color: #c7d2fe;
}
.pfx-qr-btn.ghost:hover:not([disabled]) { background: rgba(99,102,241,.14); }
.pfx-qr-btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
  filter: grayscale(.5);
}

/* Toast feedback */
.pfx-qr-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(20,24,40,.97);
  border: 1px solid rgba(99,102,241,.35);
  color: #c7d2fe;
  font-size: .82rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 100400;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.pfx-qr-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 480px) {
  .pfx-qr-opts { grid-template-columns: 1fr; }
  .pfx-qr-tab { font-size: .72rem; padding: 8px 4px; }
  .pfx-qr-canvas-wrap { min-width: 200px; min-height: 200px; padding: 10px; }
}