/* Editor de plantillas: vista previa a la izquierda y textos a la derecha */

.editor-pagina {
  background: var(--nube-100);
}

.editor-cabecera {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--grafito-200);
  background: rgb(246 244 239 / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.editor-cabecera .marca img {
  height: 30px;
}

.editor-titulo {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 24px;
  border-left: 1px solid var(--grafito-200);
}

.editor-volver {
  color: var(--grafito-500);
  font-size: 0.8rem;
  text-decoration: none;
}

.editor-volver:hover {
  color: var(--tinta);
}

.editor-titulo h1 {
  font-size: 1.6rem;
  line-height: 1.1;
  white-space: nowrap;
}

.editor-titulo h1 em {
  color: var(--grafito-500);
}

.editor-disenos {
  display: flex;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--nube-200);
}

.editor-disenos a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--grafito-700);
  font-family: var(--titulo);
  font-size: 1.1rem;
  text-decoration: none;
}

.editor-disenos a[aria-current="page"] {
  background: var(--blanco);
  color: var(--tinta);
  box-shadow: 0 1px 3px rgb(15 15 13 / 0.08);
}

.editor-descargar span,
.editor-descargar i {
  min-height: 42px;
}

.boton-flecha:disabled {
  opacity: 0.6;
  cursor: progress;
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  min-height: calc(100vh - 72px);
}

/* Vista previa: las hojas como papel sobre la mesa */
.editor-vista {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 48px 32px 96px;
  background:
    radial-gradient(70% 50% at 50% 0%, rgb(255 255 255 / 0.7), transparent 70%),
    #ebe5da;
}

.hoja-envoltorio {
  width: min(100%, 620px, calc(82vh * var(--proporcion-envoltorio, 0.75)));
  margin: 0;
}

.hoja {
  position: relative;
  width: 100%;
  background: var(--blanco);
  box-shadow:
    0 1px 2px rgb(60 40 10 / 0.1),
    0 18px 40px rgb(60 40 10 / 0.16);
  user-select: none;
}

.hoja img,
.hoja svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hoja svg text {
  white-space: pre;
  cursor: text;
}

.hoja svg text:hover {
  opacity: 0.7;
}

.hoja .resalte {
  fill: rgb(184 242 62 / 0.18);
  stroke: var(--fosforo-300);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.hoja-envoltorio figcaption {
  margin-top: 10px;
  color: var(--grafito-500);
  font-size: 0.8rem;
  text-align: center;
}

/* Panel de textos */
.editor-panel {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  padding: 24px 24px 0;
  border-left: 1px solid var(--grafito-200);
  background: var(--blanco);
  overflow-y: auto;
}

.editor-panel-cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.editor-panel-cabecera h2 {
  font-size: 2rem;
}

.editor-enlace {
  padding: 0;
  border: 0;
  background: none;
  color: var(--grafito-500);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.editor-enlace:hover {
  color: var(--tinta);
}

.editor-ayuda {
  margin: 8px 0 20px;
  color: var(--grafito-500);
  font-size: 0.88rem;
}

.grupo {
  padding: 18px 0;
  border-top: 1px solid var(--grafito-100);
}

.grupo > h3,
.grupo > summary,
.grupo-cabecera h3 {
  margin-bottom: 12px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grafito-500);
}

.grupo > summary {
  margin-bottom: 0;
  list-style: none;
  cursor: pointer;
}

.grupo > summary::-webkit-details-marker {
  display: none;
}

.grupo > summary::after {
  content: "+";
  float: right;
  font-size: 1.1rem;
  line-height: 1;
}

.grupo[open] > summary {
  margin-bottom: 12px;
}

.grupo[open] > summary::after {
  content: "−";
}

.grupo-cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.campo {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.campo label {
  color: var(--grafito-700);
  font-size: 0.82rem;
  font-weight: 600;
}

.campo input,
.campo textarea,
.mesa-numero {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grafito-200);
  border-radius: 12px;
  background: var(--nube-50);
  color: var(--tinta);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  resize: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo input:focus,
.campo textarea:focus,
.mesa-numero:focus {
  border-color: var(--tinta);
  outline: none;
  box-shadow: 0 0 0 3px rgb(184 242 62 / 0.45);
  background: var(--blanco);
}

.campo small,
.editor-contador {
  color: var(--grafito-500);
  font-size: 0.78rem;
}

.mesa {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--grafito-100);
  border-radius: 16px;
  background: var(--nube-50);
}

.mesa-cabecera {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mesa-cabecera span {
  font-family: var(--titulo);
  font-size: 1.35rem;
}

.mesa-numero {
  width: 64px;
  padding: 6px 10px;
  font-weight: 600;
  text-align: center;
}

.mesa-quitar {
  width: 30px;
  height: 30px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--grafito-500);
  cursor: pointer;
}

.mesa-quitar:hover {
  background: var(--nube-200);
  color: var(--tinta);
}

.editor-anadir {
  width: 100%;
  margin-top: 4px;
  border-style: dashed;
}

.editor-panel-pie {
  position: sticky;
  bottom: 0;
  margin: auto -24px 0;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--grafito-100);
  background: var(--blanco);
}

.editor-panel-pie .boton-flecha {
  width: 100%;
}

.editor-panel-pie .boton-flecha span {
  flex: 1;
}

.editor-nota {
  margin-top: 8px;
  color: var(--grafito-500);
  font-size: 0.78rem;
  text-align: center;
}

.editor-aviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--tinta);
  color: var(--blanco);
  font-size: 0.9rem;
  transform: translateX(-50%);
  box-shadow: var(--sombra-alta);
}

.editor-error {
  margin-top: 20vh;
  font-family: var(--titulo);
  font-size: 2rem;
}

@media (max-width: 980px) {
  .editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-panel {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--grafito-200);
  }

  .editor-descargar {
    display: none;
  }

  .editor-vista {
    padding: 28px 16px 48px;
    gap: 28px;
  }
}

@media (max-width: 640px) {
  .editor-cabecera {
    flex-wrap: wrap;
    height: auto;
    gap: 10px 16px;
    padding: 12px 16px;
  }

  .editor-titulo {
    padding-left: 16px;
  }

  .editor-titulo h1 {
    font-size: 1.3rem;
  }

  .editor-disenos {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .editor-panel {
    padding: 20px 16px 0;
  }

  .editor-panel-pie {
    margin: auto -16px 0;
    padding: 14px 16px 18px;
  }
}

/* ---------- Editor de la web de boda ---------- */

.editor-vista--web {
  gap: 18px;
  padding-top: 24px;
  padding-bottom: 32px;
}

.dispositivos {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.6);
}

.dispositivos button {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--grafito-700);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.dispositivos button.activo {
  background: var(--tinta);
  color: var(--blanco);
}

.marco-web {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  height: calc(100vh - 72px - 110px);
  min-height: 520px;
  border-radius: 16px;
  background: var(--blanco);
  box-shadow: 0 1px 2px rgb(60 40 10 / 0.1), 0 24px 60px rgb(60 40 10 / 0.18);
  overflow: hidden;
  transition: max-width 0.35s ease, border-radius 0.35s ease;
}

.marco-web--movil {
  max-width: 390px;
  border: 10px solid #161513;
  border-radius: 44px;
}

.marco-barra {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-bottom: 1px solid var(--grafito-100);
  background: var(--nube-50);
}

.marco-barra i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grafito-200);
}

.marco-barra span {
  margin: 0 auto;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--nube-200);
  color: var(--grafito-500);
  font-size: 0.75rem;
}

.marco-web--movil .marco-barra i {
  display: none;
}

.marco-web iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: var(--blanco);
}

.campo-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.campo-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--tinta);
}

.lista-fila {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.lista-fila input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--grafito-200);
  border-radius: 10px;
  background: var(--nube-50);
  font: inherit;
  font-size: 0.9rem;
}

.lista-fila input:focus {
  border-color: var(--tinta);
  outline: none;
  box-shadow: 0 0 0 3px rgb(184 242 62 / 0.45);
}

.lista-fila .mesa-quitar {
  margin: 0;
}

.fotos-rejilla {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.foto {
  position: relative;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.foto img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  transition: opacity 0.15s ease;
}

.foto:hover img {
  opacity: 0.8;
}

.foto:focus-within img {
  outline: 3px solid var(--fosforo-300);
  outline-offset: 2px;
}

.foto span {
  color: var(--grafito-700);
  font-size: 0.75rem;
  font-weight: 600;
}

.foto-quitar {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.92);
  color: var(--tinta);
  font-size: 0.9rem;
  cursor: pointer;
}

@media (max-width: 980px) {
  .marco-web {
    height: 76vh;
  }
}

@media (max-width: 560px) {
  .marco-web--movil {
    border-width: 6px;
    border-radius: 30px;
  }
}

/* ---------- Imágenes propias (logo, ilustración, foto) ---------- */

.hoja svg .imagen-propia {
  cursor: grab;
  touch-action: none;
}

.hoja svg .imagen-propia.arrastrando {
  cursor: grabbing;
}

.imagen-miniatura {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--nube-200);
}

.imagen-tarjeta .mesa-cabecera span {
  font-size: 1.1rem;
}

.imagen-tarjeta .editor-enlace {
  margin-left: auto;
}

.imagen-tarjeta .mesa-quitar {
  margin-left: 0;
}

.imagen-tarjeta input[type="range"] {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  accent-color: var(--tinta);
}

.imagen-tarjeta select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--grafito-200);
  border-radius: 12px;
  background: var(--nube-50);
  font: inherit;
  font-size: 0.9rem;
}
