:root {
  --primary-color: #3e4072;
  --accent-color: #ff6b6b;
  --bg-color: #fffaf3;
  --border-color: #ddd;
  --highlight-color: #ddd4f2;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--primary-color);
  font-family: sans-serif;
  padding: 2rem;
}

header {
  text-align: center;
}

h1 {
  font-size: 6rem;
  font-family: "Arial Black", Impact, sans-serif;
  font-weight: 900;
  line-height: 6rem;
  letter-spacing: -0.6rem;
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 1em;
  font-weight: 300;
  color: var(--primary-color);
}

#dropArea {
  border: 3px dashed var(--primary-color);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  background-color: white;
  transition: background-color 0.3s;
  margin-bottom: 3rem;
  margin-inline: auto;
}

#dropArea.dragover {
  background-color: var(--highlight-color);
}

#dropArea.disabled {
  opacity: 0.5;
}

#uploadBtn {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: none;
  background-color: var(--accent-color);
  color: white;
  border-radius: 0.5rem;
  transition: background-color 0.3s ease;
}

#uploadBtn:hover {
  background-color: #e32f2f;
}

#uploadBtn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background-color: #d12b2b;
}
#uploadBtn.disabled {
  opacity: 0.5;
}

.operationArea {
  display: flex;
  flex-direction: column;
  max-width: 95%;
  margin-inline: auto;
}

@media (max-width: 800px) {
  .operationArea {
    flex-direction: row;
    align-items: flex-start;
    margin-inline: 0;
  }
  body {
    padding: 0.7rem;
  }
}
.controls {
  display: flex;

  flex-direction: row;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 800px) {
  .controls {
    flex-direction: column;
    justify-content: flex-start;
    top: 30svh;
    position: sticky;
  }
}

.controls button::first-letter {
  text-decoration: underline;
}

.controls button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border: 2px solid var(--primary-color);
  border-radius: 0.5rem;
  background-color: white;
  color: var(--primary-color);
  transition: all 0.3s;
}

.controls button:hover {
  background-color: var(--highlight-color);
}

.controls button.active {
  background-color: var(--primary-color);
  color: white;
}

#pagesContainer {
  flex-grow: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 1.5rem;
  justify-items: center;
  margin-bottom: 3rem;
}

.slot {
  display: flex;
  flex-direction: row;
  width: 210px;
  height: 297px;
  background-color: white;
  border: 1px dashed var(--primary-color);
  border-radius: 0.5rem 0 0.5rem 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.slot[data-tool="reorder"]:hover {
  cursor: url("assets/grab.png"), grab;
}
.slot[data-tool="rotate"]:hover {
  cursor: url("assets/rotate.png"), move;
}
.slot[data-tool="move"]:hover {
  cursor: url("assets/move.png"), move;
}

.slot[data-tool="scale"]:hover {
  cursor: url("assets/scale.png"), ne-resize;
}
.slot:hover {
  transform: scale(1.02);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.container {
  display: flex;
  width: 100%;
}

.tools-container {
  margin-left: 1px;
  height: fit-content;
  display: flex;
  flex-direction: column;
}

.tools-container button {
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 0 5px 5px 0;
  border: 1px solid var(--border-color);
  border-left: none;
  padding: 8px;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.tools-container button:hover {
  background-color: var(--highlight-color);
}
.tools-container button:active {
  transform: scale(1.1);
}
.tools-container button img {
  width: 16px;
  height: 16px;
  display: block;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.render-container {
  display: flex;
  justify-content: center;
}
#renderBtn {
  position: relative; /* clave para el spinner */
  margin: 0 auto;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 1rem;
  transition: background-color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem; /* espacio entre texto y spinner */
}

#renderBtn:hover {
  background-color: #2d2f5a;
}

#renderBtn:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  background-color: #23254a;
}

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.checkmark {
  color: #32cd32; /* verde lima, podés ajustar */
  font-size: 1.2em;
  animation: fadeIn 0.3s ease-in-out;
  margin-left: 0.5rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

footer {
  font-size: 0.9rem;
  color: #555;
  margin-top: 4rem;
  text-align: center;
  line-height: 1.4;
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.sortable-ghost {
  opacity: 0;
}
