/* Coloring Page Generator — new UI only. Shared journey/camera/print-sheet chrome
   comes from project_journey.css, project_workflow.css, supply_snap_page.css,
   and the generic pixel-craft-* utility classes in pixel_craft_poc.css. */

.coloring-page-generator {
  --cp-sticky: 7.5rem;
}

.coloring-page-generator #design.gs-journey-stage {
  scroll-margin-top: calc(var(--cp-sticky) + 0.5rem);
}

.coloring-page-workspace {
  border: 4px dashed var(--gs-light-purple, #e5dcf4);
  border-radius: 24px;
  padding: 1.5rem 1.25rem;
  background: #fff;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .coloring-page-workspace {
    grid-template-columns: minmax(16rem, 19rem) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    height: calc(100dvh - var(--cp-sticky));
    min-height: 30rem;
  }

  .coloring-page-chrome {
    grid-column: 1 / -1;
  }

  /* When a sheet is ready, reserve a full-width bottom row for the legal notice
     so it can sit under both the controls and preview columns. */
  .coloring-page-workspace:has(#coloringResult:not(.d-none)) {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
}

/* Top bar: source + title on the left, export actions on the right. */
.coloring-page-chrome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.coloring-page-chrome__identity {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 14rem;
}

.coloring-page-chrome__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.coloring-page-chrome__sheet {
  display: none;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.coloring-page-workspace:has(#coloringResult:not(.d-none)) .coloring-page-chrome__sheet {
  display: flex;
}

.coloring-page-rename-btn {
  flex: 0 0 auto;
  padding: 0.2rem 0.35rem;
  line-height: 1;
  color: var(--gs-purple, #6a0dad);
  text-decoration: none;
}

.coloring-page-rename-btn:hover,
.coloring-page-rename-btn:focus-visible {
  color: var(--gs-dark-purple, #3c0777);
}

.coloring-page-chrome__actions {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  margin-left: auto;
}

.coloring-page-workspace:has(#coloringResult:not(.d-none)) .coloring-page-chrome__actions {
  display: flex;
}

.coloring-page-chrome__actions .btn {
  min-height: 2.6rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Left: narrow control panel (style, detail level, generate). */
.coloring-page-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.85rem 0.75rem;
  background: #f9f7fc;
  border: 2px solid var(--gs-light-purple, #e5dcf4);
  border-radius: 18px;
}

@media (min-width: 768px) {
  .coloring-page-panel {
    overflow-y: auto;
    padding-right: 0.75rem;
    min-height: 0;
  }
}

.coloring-page-panel .pixel-craft-size {
  display: flex;
  width: 100%;
}

.coloring-page-panel .pixel-craft-size-btn {
  flex: 1 1 0;
  min-width: 0;
}

.coloring-page-source__thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid var(--gs-light-purple, #e5dcf4);
  background: #f3f0f8;
  flex: 0 0 auto;
}

.coloring-page-controls legend {
  margin-bottom: 0.4rem;
}

/* Style picker: 2-column grid of standalone toggle buttons
   (rather than the single-row pixel-craft-size pill bar) fits the narrow panel. */
.coloring-page-style-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.coloring-page-style-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.4rem 0.5rem;
  border: 2px solid var(--gs-light-purple, #e5dcf4);
  border-radius: 14px;
  background: #fff;
  color: var(--gs-dark-purple, #3c0777);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 3px 0 0 transparent;
}

.coloring-page-style-btn:hover,
.coloring-page-style-btn:focus-visible {
  border-color: var(--gs-dark-purple, #3c0777);
  background: var(--gs-light-yellow, #f9e3ab);
}

.btn-check:checked + .coloring-page-style-btn {
  background: var(--gs-yellow, #ffd24d);
  border-color: transparent;
  color: var(--gs-dark-purple, #3c0777);
  box-shadow: 0 3px 0 0 var(--gs-btn-shadow-yellow, #e0a800);
}

.btn-check:checked + .coloring-page-style-btn:hover,
.btn-check:checked + .coloring-page-style-btn:focus-visible {
  background: #ffc42e;
  border-color: transparent;
}

.btn-check:disabled + .coloring-page-style-btn {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Detail level: match secondary (yellow) selected state used by style buttons. */
.coloring-page-panel .pixel-craft-size .btn-check:checked + .pixel-craft-size-btn {
  background: var(--gs-yellow, #ffd24d);
  color: var(--gs-dark-purple, #3c0777);
}

.coloring-page-panel .pixel-craft-size .btn-check:checked + .pixel-craft-size-btn .pixel-craft-size-btn__meta {
  color: var(--gs-dark-purple, #3c0777);
}

.coloring-page-panel .pixel-craft-size-btn:hover,
.coloring-page-panel .pixel-craft-size-btn:focus-visible {
  background: var(--gs-light-yellow, #f9e3ab);
}

.coloring-page-panel .pixel-craft-size .btn-check:checked + .pixel-craft-size-btn:hover,
.coloring-page-panel .pixel-craft-size .btn-check:checked + .pixel-craft-size-btn:focus-visible {
  background: #ffc42e;
}

.coloring-page-generate-row {
  display: flex;
  justify-content: stretch;
}

.coloring-page-generate-row .btn {
  width: 100%;
}

/* Right: the generated coloring page. */
.coloring-page-preview-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 22rem;
}

.coloring-page-result {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.75rem;
}

.coloring-page-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  min-width: 0;
}

.coloring-page-title {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
  font-family: var(--bs-header-font-family, "Jua", sans-serif);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--gs-dark-purple, #3c0777);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coloring-page-preview-toolbar {
  /* Class kept for tests / markup hooks; layout lives on .coloring-page-chrome__actions. */
}

.coloring-page-preview-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  background: #f3f0f8;
  border-radius: 16px;
  padding: 1rem;
  overflow: auto;
}

.coloring-page-enlarge-btn {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(60, 7, 119, 0.18);
}

.coloring-page-preview {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(60, 7, 119, 0.18);
  background: #fff;
}

.coloring-page-preview-placeholder {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #f3f0f8;
  border-radius: 16px;
  padding: 2rem 1rem;
  color: #7a6f91;
  text-align: center;
}

.coloring-page-preview-placeholder i {
  font-size: 2.5rem;
  color: var(--gs-light-purple, #cbb8e6);
}

.coloring-page-preview-placeholder.is-error {
  color: var(--gs-dark-purple, #3c0777);
}

.coloring-page-preview-placeholder.is-error p {
  font-size: 1.15rem;
  font-weight: 700;
  max-width: 22rem;
  line-height: 1.35;
}

#coloringResult.d-none ~ .coloring-page-preview-placeholder {
  display: flex;
}

.coloring-page-legal {
  display: none;
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: #5b5b5b;
  background: #f9f7fc;
  border: 1px solid var(--gs-light-purple, #e5dcf4);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0;
}

.coloring-page-workspace:has(#coloringResult:not(.d-none)) .coloring-page-legal {
  display: block;
}

/* Shown instead of #coloringGenerateControls when a selected buddy already
   has a ready-made sheet (see coloring_page_generator.js selectBuddy()). */
.coloring-page-official-note,
.coloring-page-saved-reload-note {
  font-size: 0.9rem;
  color: #6a3fb5;
  background: #f3edfb;
  border: 1px solid var(--gs-light-purple, #e5dcf4);
  border-radius: 12px;
  padding: 0.65rem 1rem;
}

.coloring-page-official-note i,
.coloring-page-saved-reload-note i {
  margin-right: 0.35rem;
}

.coloring-page-saved-reload-note {
  color: #7a4a00;
  background: #fff6e8;
  border-color: #f0d7a8;
}

