/* ============ QR Maker — estilos ============ */
:root {
  --bg: #0b0f14;
  --bg-soft: #0f141b;
  --panel: #121924;
  --panel-2: #161f2c;
  --border: #223046;
  --border-soft: #1a2536;
  --text: #e8edf4;
  --muted: #93a2b8;
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --accent-3: #ec4899;
  --ok: #22c55e;
  --radius: 16px;
  --radius-s: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, .14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(6, 182, 212, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
h1, h2 { margin: 0; }
.hidden { display: none !important; }

.app {
  display: grid;
  grid-template-columns: minmax(370px, 470px) 1fr;
  gap: 22px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px clamp(12px, 3vw, 28px) 40px;
  align-items: start;
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .preview-pane { order: -1; }
}

/* ---------- brand ---------- */
.brand h1 {
  font-size: 30px;
  letter-spacing: -0.5px;
  background: linear-gradient(100deg, var(--accent-2), var(--accent) 55%, var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
.brand p { color: var(--muted); margin: 6px 0 0; font-size: 13.5px; }
.brand { padding: 2px 4px 6px; }

/* ---------- cards ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -18px rgba(0,0,0,.9);
}
.card h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 12px;
}
.card hr { border: 0; border-top: 1px solid var(--border-soft); margin: 14px 0 12px; }

/* ---------- presets ---------- */
.presets { display: flex; flex-direction: column; gap: 8px; }
.presets-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.97); }
.chip.dice { border-style: dashed; color: var(--muted); }

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin: 9px 0; font-size: 13.5px; }
.field > span { color: var(--muted); font-size: 12.5px; }
.field .val { color: var(--accent-2); font-weight: 600; }
.row { display: flex; gap: 12px; align-items: end; }
.row .field { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } }

input[type="text"], input[type="url"], input[type="email"], input[type="tel"],
textarea, select {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
textarea { resize: vertical; min-height: 40px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] {
  width: 34px; height: 30px; padding: 2px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); cursor: pointer;
}
input.hex { width: 88px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-field { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.color-field > span:first-child { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; margin: 9px 0; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.color-stops { display: flex; flex-direction: column; }

/* segmented (centro) */
.segmented { display: flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 7px 4px; font-size: 13px;
  border-radius: 9px; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.segmented input:checked + span { background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(6,182,212,.25)); color: var(--text); border: 1px solid rgba(139,92,246,.45); }
.segmented label span { border: 1px solid transparent; }

.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-row .grow { flex: 1; }
#logo-preview {
  width: 74px; height: 74px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 6px;
}

/* disabled groups */
.disabled { opacity: .38; pointer-events: none; filter: saturate(.6); }

/* ---------- preview ---------- */
.preview-pane { position: sticky; top: 22px; }
.preview-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
}
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.preview-title { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.badge {
  font-size: 12px; color: var(--accent-2); border: 1px solid rgba(6,182,212,.4);
  background: rgba(6,182,212,.08); border-radius: 999px; padding: 3px 10px;
}
.preview-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
  border-radius: 14px;
  padding: clamp(14px, 4vw, 42px);
  background:
    conic-gradient(from 90deg at 50% 50%, #151d2a 0 25%, #101722 0 50%, #151d2a 0 75%, #101722 0) 0 0 / 28px 28px;
  border: 1px dashed var(--border);
}
#preview { display: flex; align-items: center; justify-content: center; max-width: 100%; }
#preview svg { max-width: 100%; height: auto; width: min(560px, 100%); filter: drop-shadow(0 12px 30px rgba(0,0,0,.35)); }
.preview-note { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; min-height: 18px; }
.preview-note.warn { color: #fbbf24; }

.export-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 8px; }
.field.inline { flex-direction: column; margin: 0; min-width: 130px; }
.btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 16px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .1s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff;
  box-shadow: 0 8px 22px -10px rgba(139,92,246,.8);
}
.btn[disabled] { opacity: .5; cursor: wait; }

.hint { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; }
.hint strong { color: var(--accent-2); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #0d1520; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 18px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  box-shadow: 0 14px 40px -12px rgba(0,0,0,.9);
  max-width: min(90vw, 460px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: #ef4444; }

/* ============ Preview colapsable (móvil) ============ */
#preview-mini, #btn-preview-toggle, #btn-download-mini, #btn-opciones { display: none; }
.export-opts { display: contents; }
.ph-left, .ph-right { display: flex; align-items: center; gap: 8px; }
.btn.mini { padding: 5px 10px; font-size: 15px; line-height: 1.1; border-radius: 10px; }

@media (max-width: 980px) {
  .preview-pane { position: sticky; top: 8px; z-index: 40; }
  body:not(.preview-collapsed) .preview-pane { position: static; }
  .preview-card { padding: 8px 12px; }
  .preview-head { margin-bottom: 0; }

  #preview-mini {
    display: block; width: 40px; height: 40px; object-fit: contain;
    background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 2px;
  }
  #btn-download-mini, #btn-preview-toggle, #btn-opciones { display: inline-flex; align-items: center; justify-content: center; }
  body:not(.preview-collapsed) #btn-download-mini { display: none; }

  /* colapsado: solo la tira */
  body.preview-collapsed .preview-body { display: none; }

  /* expandido: compacto */
  .preview-wrap { min-height: 170px; padding: 12px; margin-top: 10px; }
  #preview svg { width: min(100%, 210px); }
  .preview-note { margin: 8px 2px 0; }

  .export-bar { gap: 8px; }
  .export-bar .btn { padding: 8px 12px; font-size: 13px; }
  .export-opts { display: none; }
  .export-opts.open { display: flex; gap: 8px; width: 100%; order: 10; }
  .export-opts .field.inline { min-width: 0; flex: 1; }
}
