/* Selector de tema: solo visible con ?editar_tema=1 en la URL — carga junto a css/style.css */

.theme-editor {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 99990;
  font-family: 'Inter', 'Be Vietnam Pro', system-ui, sans-serif;
  pointer-events: none;
}

.theme-editor > * {
  pointer-events: auto;
}

.theme-editor__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  border: 1px solid rgb(var(--color-ink) / 0.12);
  background: rgb(var(--color-base));
  color: rgb(var(--color-ink));
  box-shadow: 0 4px 24px rgb(0 0 0 / 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.theme-editor__toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgb(0 0 0 / 0.16);
}

.theme-editor__toggle:focus-visible {
  outline: 2px solid rgb(var(--color-cta-bg));
  outline-offset: 3px;
}

.theme-editor__toggle-icon {
  display: block;
}

.theme-editor__panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.75rem);
  width: min(18.5rem, calc(100vw - 2rem));
  max-height: min(70vh, 24rem);
  overflow: auto;
  padding: 1rem 1rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(var(--color-ink) / 0.1);
  background: rgb(var(--color-base));
  color: rgb(var(--color-copy));
  box-shadow: 0 8px 40px rgb(0 0 0 / 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.theme-editor.is-open .theme-editor__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-editor__title {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgb(var(--color-body));
}

.theme-editor__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.theme-editor__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: rgb(var(--color-surface) / 0.45);
  color: rgb(var(--color-copy));
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-editor__option:hover {
  background: rgb(var(--color-pearl) / 0.85);
}

.theme-editor__option.is-active {
  border-color: rgb(var(--color-cta-bg) / 0.45);
  background: rgb(var(--color-pearl) / 0.95);
}

.theme-editor__option:focus-visible {
  outline: 2px solid rgb(var(--color-cta-bg));
  outline-offset: 2px;
}

.theme-editor__option-label {
  flex: 1;
  min-width: 0;
}

.theme-editor__swatches {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.theme-editor__swatch {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 2px;
  border: 1px solid rgb(var(--color-ink) / 0.12);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25);
}

.theme-editor__footer {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgb(var(--color-ink) / 0.08);
}

.theme-editor__exit {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: rgb(var(--color-body));
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.theme-editor__exit:hover {
  color: rgb(var(--color-ink));
}

.theme-editor__exit:focus-visible {
  outline: 2px solid rgb(var(--color-cta-bg));
  outline-offset: 2px;
}

@media print {
  .theme-editor {
    display: none !important;
  }
}
