/* 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);
    align-items: stretch;
    height: calc(100dvh - var(--cp-sticky));
    min-height: 30rem;
  }
}

/* Left: narrow control panel (upload, style, detail level). */
.coloring-page-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.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 {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

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

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

/* Style picker: 6 options, so a 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;
}

.coloring-page-style-btn:hover,
.coloring-page-style-btn:focus-visible {
  border-color: var(--gs-purple, #6a0dad);
}

.btn-check:checked + .coloring-page-style-btn {
  background: var(--gs-purple, #6a0dad);
  border-color: var(--gs-purple, #6a0dad);
  color: #fff;
}

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

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

/* 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.75rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.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);
}

.coloring-page-title-row .btn:not(.btn-link) {
  flex: 0 0 auto;
  min-height: 2.6rem;
  font-weight: 700;
  white-space: nowrap;
}

.coloring-page-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

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

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

.coloring-page-preview-toolbar__export {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.coloring-page-saved-dd {
  position: relative;
  flex: 0 0 auto;
  margin-right: auto;
}

.coloring-page-saved-dd__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.coloring-page-saved-dd__menu {
  min-width: min(22rem, 80vw);
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.4rem 0;
}

.coloring-page-saved-dd__empty {
  padding: 0.65rem 1rem;
  color: #7a6f91;
  font-size: 0.9rem;
}

.coloring-page-saved-dd__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.85rem;
  color: var(--gs-dark-purple, #3c0777);
  font-weight: 700;
}

.coloring-page-saved-dd__item:hover,
.coloring-page-saved-dd__item:focus-visible {
  background: #f3edfb;
}

.coloring-page-saved-dd__thumb {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--gs-light-purple, #e5dcf4);
  flex: 0 0 auto;
}

.coloring-page-preview-frame {
  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-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 {
  flex: 0 0 auto;
  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;
}

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

.pixel-craft-library-card {
  position: relative;
}

.coloring-page-library-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  background: #6a3fb5;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  pointer-events: none;
}
