html,
body,
button,
textarea,
div,
section,
main {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 28px;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: #000;
  background: #dff3ff;
}

/* INTERFAZ PRINCIPAL */

#app {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
}

.titulo {
  margin: 0 0 28px;
  font-size: clamp(32px, 4vw, 58px);
  font-weight: 800;
  font-style: italic;
}

.contenedor {
  display: grid;
  grid-template-columns: minmax(400px, 1fr) minmax(500px, 1fr);
  gap: 30px;
  align-items: stretch;
}

.columna {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.texto {
  min-height: 90px;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.2;
  font-weight: 600;
  font-style: italic;
}

.vista-previa-titulo {
  min-height: 90px;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(36px, 4vw, 62px);
  font-style: italic;
}

.panel {
  flex: 1;
  min-height: 650px;
  padding: 28px;
  background: #fff;
  border: 1px solid #999;
  border-radius: 28px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

.panel-entrada {
  display: flex;
  flex-direction: column;
  align-items: center;
}

textarea {
  width: 100%;
  height: 260px;
  padding: 28px;
  resize: none;
  border: 1px solid #999;
  border-radius: 42px;
  outline: none;
  background: #dff3ff;
  color: #000;
  font-family: Arial, sans-serif;
  font-size: clamp(20px, 2vw, 31px);
  font-weight: 600;
  font-style: italic;
}

textarea::placeholder {
  color: #8b9aa3;
  opacity: 1;
}

.boton {
  min-width: 310px;
  padding: 17px 35px;
  border: 1px solid #333;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.boton:hover {
  background: #eef8ff;
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.12);
}

.boton:active {
  transform: scale(0.98);
}

.btn-generar {
  margin-top: 38px;
}

.panel-preview {
  display: flex;
  flex-direction: column;
}

#preview {
  flex: 1;
  width: 100%;
  min-height: 500px;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
}

.btn-imprimir {
  margin: 24px auto 0;
  display: block;
}

/* HOJA Y ETIQUETAS */

.sheet {
  width: 21cm;
  min-height: 27cm;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  color: #000;
  background: #fff;
  padding: 10px;
  transform-origin: top left;
}

.label {
  width: 10cm;
  height: 5cm;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid #000;
  box-sizing: border-box;
  background: #fff;
}

.label.error {
  border-color: red;
}

.sku {
  margin-bottom: 12px;
  font-size: 38px;
  font-weight: normal;
  text-decoration: underline;
}

.desc {
  flex-grow: 1;
  margin-top: 4px;
  font-size: 15px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.boxes {
  display: flex;
  margin-top: 10px;
}

.box {
  width: 20%;
  height: 35px;
  border: 2px solid #000;
}

/* LOADER */

#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  transition: opacity 0.4s ease;
}

.spinner {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  border: 5px solid rgba(0, 0, 0, 0.2);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* PANTALLAS PEQUEÑAS */

@media (max-width: 1100px) {
  .contenedor {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  #preview {
    height: 650px;
  }
}

/* IMPRESIÓN */

@page {
  size: 21cm 27cm;
  margin: 0;
}

@media print {
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  #etiquetas,
  #etiquetas * {
    visibility: visible;
  }

  #etiquetas {
    position: absolute;
    top: 0;
    left: 0;
    width: 21cm;
    min-height: 27cm;
    padding: 0;
    transform: none;
  }

  #loader {
    display: none !important;
  }

  .boton-contenedor,
  .boton-animado,
  .aviso-impresion {
    display: none !important;
  }
}

/* BOTONES ANIMADOS */

.boton-contenedor {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.boton-animado {
  outline: none;
  width: 230px;
  height: 54px;
  border: 2px solid #1ecd97;
  border-radius: 40px;
  background: #fff;
  color: #1ecd97;
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    width 0.25s ease,
    color 0.25s ease,
    background-color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.boton-animado:hover {
  color: #fff;
  background: #1ecd97;
}

.boton-animado:active {
  letter-spacing: 2px;
}

.boton-animado.cargando {
  width: 54px;
  border-width: 3px;
  border-color: #bbb;
  border-left-color: #1ecd97;
  background: #fff;
  color: transparent;
  font-size: 0;
  pointer-events: none;
  animation: girar 0.8s linear infinite;
}

.boton-animado.validado {
  width: 54px;
  border-color: #1ecd97;
  background: #1ecd97;
  color: #fff;
  font-size: 0;
  pointer-events: none;
  animation: none;
}

.boton-animado.validado::after {
  content: "✓";
  font-size: 25px;
  font-weight: bold;
}

@keyframes girar {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.aviso-impresion {
  text-align: center;
  font-size: 14px;
  color: #666;
}