/* qr.css — estilos del generador de QR, acotados a .qrtool para no chocar con el resto del sitio. */

.shell.qrtool {
  padding: 0;
  overflow: visible; /* con overflow:hidden la vista previa no podría quedarse fija */
}
.qrtool .qr-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}
.qrtool .panel-left {
  padding: clamp(18px, 3.5vw, 36px);
  border-right: 1px solid var(--line);
  min-width: 0;
  border-radius: var(--radius) 0 0 0;
}
.qrtool .panel-right {
  padding: clamp(18px, 3.5vw, 36px);
  background: var(--paper-dim);
  min-width: 0;
  border-radius: 0 var(--radius) 0 0;
}
/* La vista previa se queda a la vista mientras se baja por los controles */
.qrtool .qr-sticky {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* pestañas */
.qrtool .qr-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 26px;
  background: var(--paper-dim);
  padding: 3px;
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.qrtool .qr-tab {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  border: none;
  background: transparent;
  white-space: nowrap;
  min-height: 38px;
}
.qrtool .qr-tab.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px var(--shadow);
}
.qrtool .qr-panel {
  display: none;
  flex-direction: column;
}
.qrtool .qr-panel.active {
  display: flex;
}

/* campos */
.qrtool .qr-field {
  margin-bottom: 20px;
}
.qrtool .qr-field:last-child {
  margin-bottom: 0;
}
.qrtool label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.qrtool .qr-hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.qrtool .qr-error {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--warn);
  line-height: 1.5;
  display: none;
}
.qrtool .qr-error.show {
  display: block;
}
.qrtool input[type="text"],
.qrtool input[type="url"],
.qrtool input[type="tel"],
.qrtool input[type="email"],
.qrtool input[type="password"],
.qrtool textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  min-height: 44px;
}
.qrtool input:focus,
.qrtool textarea:focus,
.qrtool select:focus {
  outline: none;
  border-color: var(--cobalt);
}
.qrtool textarea {
  resize: vertical;
  min-height: 90px;
}
.qrtool ::placeholder {
  color: var(--muted);
  opacity: 0.75;
}
.qrtool .qr-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.qrtool .pass-row {
  position: relative;
}
.qrtool .pass-row input {
  padding-right: 48px;
}
.qrtool .pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qrtool .pass-toggle:hover {
  color: var(--ink);
  background: var(--paper-dim);
}
.qrtool .qr-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.qrtool .qr-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cobalt);
  cursor: pointer;
}
.qrtool .qr-check label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.qrtool .qr-select {
  position: relative;
}
.qrtool .qr-select select {
  width: 100%;
  padding: 12px 34px 12px 14px;
}
.qrtool .qr-divider {
  height: 1px;
  background: var(--line);
  margin: 28px 0;
}
.qrtool .qr-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.qrtool .qr-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 14px;
}
.qrtool .qr-notice.warn {
  background: var(--warn-dim);
  color: var(--warn);
}
.qrtool .qr-notice.info {
  background: var(--cobalt-dim);
  color: var(--cobalt);
}
.qrtool .qr-notice b {
  font-weight: 700;
}

/* colores */
.qrtool .swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.qrtool .swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  padding: 0;
  background: var(--line);
}
.qrtool .swatch.selected {
  border-color: var(--ink);
}
.qrtool .swatch.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: inherit;
}
.qrtool .swatch-light {
  border-color: var(--line);
}
.qrtool .swatch-light.selected {
  border-color: var(--ink);
}
.qrtool .swatch.transparent {
  background-image: linear-gradient(45deg, #c7cad1 25%, transparent 25%), linear-gradient(-45deg, #c7cad1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c7cad1 75%), linear-gradient(-45deg, transparent 75%, #c7cad1 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-color: #fff;
}
.qrtool .swatch-custom {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  background: var(--paper);
  display: block;
}
.qrtool .swatch-custom input[type="color"] {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  min-height: 0;
}
.qrtool .swatch-custom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.qrtool .swatch-custom input[type="color"]::-webkit-color-swatch {
  border: none;
}
.qrtool .swatch-custom input[type="color"]::-moz-color-swatch {
  border: none;
}
.qrtool .hex-input {
  width: 100px !important;
  font-family: var(--mono) !important;
  font-size: 13px !important;
  text-transform: uppercase;
  padding: 8px 10px !important;
}
.qrtool .color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* forma de los módulos */
.qrtool .style-picker {
  display: flex;
  gap: 10px;
}
.qrtool .style-btn {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qrtool .style-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.qrtool .style-btn.active {
  border-color: var(--cobalt);
  color: var(--cobalt);
  background: var(--cobalt-dim);
}
.qrtool .style-btn svg {
  width: 24px;
  height: 24px;
}

/* logo */
.qrtool .logo-drop {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.qrtool .logo-drop:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-dim);
}
.qrtool .logo-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  min-height: 0;
}
.qrtool .logo-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}
.qrtool .logo-drop-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.qrtool .logo-drop-text {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qrtool .logo-drop-text strong {
  color: var(--ink);
  font-weight: 600;
}
.qrtool .logo-remove {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--warn);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* vista previa y descargas */
.qrtool .qr-live {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}
.qrtool .qr-live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  animation: qr-pulse 2.4s ease-in-out infinite;
}
@keyframes qr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .qrtool .qr-live__dot { animation: none; }
}
.qrtool .qr-frame {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  width: min(100%, 320px);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px var(--shadow);
}
/* Fondo transparente: se muestra un damero para que se vea el código aunque el tema sea oscuro */
.qrtool .qr-frame.is-transparent {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d5d8de 25%, transparent 25%),
    linear-gradient(-45deg, #d5d8de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d5d8de 75%),
    linear-gradient(-45deg, transparent 75%, #d5d8de 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.qrtool #qrPreview {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}
.qrtool #qrPreview[hidden] {
  display: none;
}
.qrtool .qr-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
  margin-bottom: 14px;
}
.qrtool .qr-zoom {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.qrtool .placeholder-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1 / 1;
}
.qrtool .placeholder-grid div {
  background: var(--line);
  border-radius: 1px;
}
.qrtool .placeholder-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.qrtool .download-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.qrtool .download-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}
.qrtool .copy-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.qrtool .link-btn {
  background: none;
  border: none;
  color: var(--cobalt);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  font-family: var(--sans);
}
.qrtool .link-btn:hover:not(:disabled) {
  text-decoration: underline;
}
.qrtool .link-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.qrtool .status-msg {
  font-size: 12.5px;
  color: var(--good);
  text-align: center;
  margin-top: 8px;
  min-height: 18px;
}

/* recientes */
.qrtool .qr-recent-strip {
  border-top: 1px solid var(--line);
  padding: 18px clamp(18px, 3.5vw, 36px) 22px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.qrtool .recent-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.qrtool .recent-head span:first-child {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.qrtool .recent-clear {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.qrtool .recent-clear:hover {
  color: var(--warn);
}
.qrtool .recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qrtool .recent-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 20px;
  padding: 5px 10px 5px 5px;
  cursor: pointer;
  max-width: 100%;
  color: var(--ink);
}
.qrtool .recent-chip:hover {
  border-color: var(--cobalt);
}
.qrtool .recent-chip img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
}
.qrtool .recent-chip span {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.qrtool .recent-empty {
  font-size: 12.5px;
  color: var(--muted);
}

/* QR dinámico (solo si está activado) */
.qrtool .upsell {
  margin-top: 24px;
  padding: 16px;
  background: #0e1116;
  border-radius: 10px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.qrtool .upsell-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.qrtool .upsell p {
  font-size: 13px;
  color: #c9ccd3;
  line-height: 1.5;
  margin: 0;
}
.qrtool .upsell strong {
  color: #fff;
}
.qrtool .beta-badge {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--cobalt);
  background: var(--cobalt-dim);
  padding: 2px 6px;
  border-radius: 20px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.qrtool .dyn-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.qrtool .dyn-secret {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-all;
  margin: 8px 0;
}
.qrtool .dyn-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.qrtool .dyn-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qrtool .dyn-list-item button {
  flex-shrink: 0;
}

/* plantillas: galería en vivo (las miniaturas son el QR real del usuario) */
.qrtool .tpl-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.qrtool .tpl-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.qrtool .tpl-card:hover {
  border-color: var(--cobalt);
  transform: translateY(-1px);
}
.qrtool .tpl-card.is-active {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-dim);
}
.qrtool .tpl-thumb {
  width: 100%;
  aspect-ratio: 1 / 1.1;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-dim);
}
.qrtool .tpl-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}
.qrtool .tpl-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.qrtool .range-value {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--cobalt);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.qrtool input[type="range"] {
  width: 100%;
  accent-color: var(--cobalt);
}

@media (max-width: 820px) {
  .qrtool .qr-grid {
    grid-template-columns: 1fr;
  }
  .qrtool .panel-left {
    border-right: none;
    border-radius: 0;
  }
  /* En móvil la vista previa va arriba, fija y compacta, para verla mientras se edita */
  .qrtool .panel-right {
    order: -1;
    position: sticky;
    top: 64px;
    z-index: 6;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .qrtool .qr-sticky {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "frame dl" "frame copy" "frame status";
    column-gap: 14px;
    align-items: center;
  }
  .qrtool .qr-live,
  .qrtool .qr-meta,
  .qrtool .download-hint {
    display: none;
  }
  .qrtool .qr-frame {
    grid-area: frame;
    width: 112px;
    min-height: 0;
    padding: 8px;
    margin: 0;
  }
  .qrtool .qr-zoom {
    display: inline-flex;
  }
  .qrtool .download-row { grid-area: dl; flex-wrap: wrap; min-width: 0; }
  .qrtool .download-row .btn { flex: 1 1 auto; min-width: 0; }
  .qrtool .copy-row { grid-area: copy; justify-content: flex-start; margin-top: 2px; }
  .qrtool .status-msg { grid-area: status; text-align: left; min-height: 0; margin-top: 0; }
  .qrtool .panel-right.is-big .qr-sticky {
    display: flex;
    flex-direction: column;
  }
  .qrtool .panel-right.is-big .qr-frame {
    width: min(100%, 320px);
    padding: 18px;
    margin-bottom: 10px;
  }
  .qrtool .panel-right.is-big .qr-meta {
    display: block;
    margin-bottom: 10px;
  }
  .qrtool .panel-right.is-big .copy-row { justify-content: center; }
}
@media (max-width: 480px) {
  .qrtool .qr-row2 {
    grid-template-columns: 1fr;
  }
  .qrtool .tpl-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
}
@media (max-width: 380px) {
  .qrtool .qr-frame { width: 92px; padding: 6px; }
  .qrtool .qr-sticky { column-gap: 10px; }
  .qrtool .panel-right { padding: 8px 12px; }
}
@media (max-width: 820px) {
  .qrtool .placeholder-grid { gap: 2px; }
}
