/**
 * Edit page (Step 3 of 3).
 * Two-column layout: preview canvas on the left, editor side panel on the right.
 */

.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-6);
  align-items: start;
}

/* Preview column */
.edit-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.edit-preview__label {
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 26px;
  color: var(--color-text-muted);
  text-align: center;
}

.edit-preview__frame {
  position: relative;
  background: #0c1020;
  border-radius: 8px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.edit-preview__canvas {
  display: none;
  max-width: 100%;
  max-height: 70vh;
  cursor: grab;
  border-radius: 8px;
}

.edit-preview__canvas:active {
  cursor: grabbing;
}

.edit-preview__canvas.is-loaded {
  display: block;
}

.edit-preview__status {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 23px;
  color: var(--color-text-muted);
  padding: var(--space-5);
  text-align: center;
}

.edit-preview__frame.is-error .edit-preview__status {
  color: var(--color-error);
}

.edit-preview__frame.is-error #lottie-loading {
  display: none;
}

.edit-preview__hint {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 18px;
  color: var(--color-text-muted);
  text-align: center;
}

/* Editor side panel */
.edit-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.edit-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.edit-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.edit-input-group__label {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 20px;
  color: var(--color-text-muted);
}

.edit-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 20px;
  color: #e2e8f0;
  background: #0c1020;
  border: 1px solid #151b2e;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease;
}

.edit-input::placeholder {
  color: var(--color-text-muted);
}

.edit-input:focus {
  border-color: #e2e8f0;
}

.edit-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.edit-actions .btn {
  text-align: center;
  justify-content: center;
}

.edit-swap-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 18px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
}

.edit-swap-status--error {
  color: var(--color-error);
}

.edit-swap-status--error #lottie-swap {
  display: none;
}

.swap-progress {
  width: 100%;
  height: 6px;
  background: #1a2035;
  border-radius: 3px;
  overflow: hidden;
}

.swap-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 3px;
  transition: width 0.4s ease-out;
}

/* Collapse to a single column at narrower widths so the page is usable
   on smaller laptops even before the mobile issue lands. */
@media (max-width: 900px) {
  .edit-layout {
    grid-template-columns: 1fr;
  }
}

/* Phone tightening: smaller preview, larger touch targets, no iOS zoom on inputs */
@media (max-width: 640px) {
  .edit-layout {
    gap: var(--space-5);
  }

  .edit-preview__label {
    font-size: 16px;
    line-height: 22px;
  }

  .edit-preview__frame {
    min-height: 280px;
  }

  .edit-preview__canvas {
    max-height: 55vh;
  }

  .edit-preview__hint {
    font-size: 13px;
  }

  .edit-panel {
    gap: var(--space-4);
  }

  .edit-input-group__label {
    font-size: 14px;
  }

  .edit-input {
    padding: 12px 14px;
    font-size: 16px; /* keep at 16px+ so iOS doesn't auto-zoom on focus */
    min-height: 44px;
  }

  .edit-actions {
    gap: var(--space-3);
    margin-top: var(--space-3);
  }

  .edit-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}
