/*
 * mosaic-builder.css
 * Styles for the Photo Mosaic Maker (frontend_mosaicbuilder.php).
 * Follows the collage-editor.css conventions: plain CSS, Bootstrap 5.3 grid
 * from ks.min.css does the layout, these rules skin the builder itself.
 */

/* ── Page scaffolding ────────────────────────────────────────────────────── */
.mosaic-header-spacer {
  height: 160px;
}

.mosaic-hero {
  padding: 26px 0 18px;
  text-align: center;
}

.mosaic-hero-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 6px;
}

.mosaic-hero-sub {
  color: #666;
  max-width: 640px;
  margin: 0 auto 14px;
}

.mosaic-steps {
  display: flex;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
}

.mosaic-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #444;
}

.mosaic-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1d1d1d;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.mosaic-shell {
  max-width: 1500px;
  padding-bottom: 60px;
}

/* ── Stage (left column) ─────────────────────────────────────────────────── */
.mosaic-stage {
  position: sticky;
  top: 130px;
}

.mosaic-canvas-wrap {
  position: relative;
  background: #f4f4f6;
  border: 1px solid #e3e3e8;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.mosaic-canvas {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.mosaic-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #9a9aa2;
  text-align: center;
}

.mosaic-empty .fa {
  font-size: 42px;
}

.mosaic-orientation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.mosaic-orientation-label {
  color: #666;
  font-size: 13px;
}

.mosaic-orient-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.mosaic-orient-btn.is-active {
  border-color: #1d1d1d;
  background: #1d1d1d;
  color: #fff;
}

/* ── Step panel (right column) ───────────────────────────────────────────── */
.mosaic-panel {
  background: #fff;
  border: 1px solid #e3e3e8;
  border-radius: 10px;
  padding: 18px;
}

.mosaic-step-block {
  padding: 6px 0 18px;
  border-bottom: 1px solid #eee;
  margin-bottom: 18px;
  transition: opacity 0.2s ease;
}

.mosaic-step-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Locked steps stay visible but inert, so the flow reads as a checklist. */
.mosaic-step-block.is-locked {
  opacity: 0.45;
  pointer-events: none;
}

.mosaic-panel-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mosaic-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1d1d1d;
  color: #fff;
  font-size: 12px;
  flex: none;
}

.mosaic-step-help {
  color: #777;
  font-size: 13px;
  margin: 0 0 12px;
}

/* ── Step 1: main photo ──────────────────────────────────────────────────── */
.mosaic-main-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #c9c9d2;
  border-radius: 8px;
  padding: 26px 14px;
  color: #666;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mosaic-main-drop:hover {
  border-color: #1d1d1d;
  background: #fafafa;
}

.mosaic-main-drop .fa {
  font-size: 26px;
}

.mosaic-main-drop input[type="file"] {
  display: none;
}

.mosaic-main-status {
  margin-top: 10px;
  font-size: 13px;
  color: #555;
}

.mosaic-main-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e3e3e8;
  border-radius: 8px;
  padding: 10px;
}

.mosaic-main-card img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
  flex: none;
}

.mosaic-main-meta {
  min-width: 0;
  flex: 1;
}

.mosaic-main-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mosaic-main-dims {
  color: #888;
  font-size: 12px;
}

.mosaic-main-verdict {
  font-size: 12px;
  margin-top: 3px;
}

.mosaic-main-verdict.is-good {
  color: #1d7a3d;
}

.mosaic-main-verdict.is-warn {
  color: #b25b00;
}

.mosaic-main-change {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  flex: none;
}

.mosaic-main-change:hover {
  border-color: #1d1d1d;
}

/* ── Step 2: tiles ───────────────────────────────────────────────────────── */
.mosaic-upload-status {
  font-size: 12px;
  color: #777;
  min-height: 18px;
  margin-top: 6px;
}

.mosaic-meter {
  border: 1px solid #e3e3e8;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
}

.mosaic-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
}

.mosaic-meter-zone {
  font-weight: 700;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
}

.mosaic-meter-zone.is-red    { background: #fdecec; color: #b02a2a; }
.mosaic-meter-zone.is-orange { background: #fff3e2; color: #b25b00; }
.mosaic-meter-zone.is-green  { background: #e7f6ec; color: #1d7a3d; }

.mosaic-meter-bar {
  height: 8px;
  border-radius: 4px;
  background: #eee;
  overflow: hidden;
}

.mosaic-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.25s ease;
}

.mosaic-meter-fill.is-red    { background: #d9534f; }
.mosaic-meter-fill.is-orange { background: #f0ad4e; }
.mosaic-meter-fill.is-green  { background: #3abf6e; }

.mosaic-meter-hint {
  font-size: 12px;
  color: #777;
  margin-top: 7px;
}

.mosaic-tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.mosaic-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f3;
}

.mosaic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mosaic-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Step 3: generate ────────────────────────────────────────────────────── */
.mosaic-control-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 4px;
}

/* Mosaic style selector (Classic / Soft light / Color blend / True mosaic). */
.mosaic-modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mosaic-mode-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  padding: 8px 4px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mosaic-mode-btn.is-active {
  border-color: #1d1d1d;
  background: #1d1d1d;
  color: #fff;
}

.mosaic-mode-hint {
  font-size: 12px;
  color: #777;
  margin: 8px 0 0;
  min-height: 30px;
}

.mosaic-density {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.mosaic-density-btn {
  flex: 1;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  padding: 7px 0;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mosaic-density-btn.is-active {
  border-color: #1d1d1d;
  background: #1d1d1d;
  color: #fff;
}

.btn-mosaic-primary {
  width: 100%;
  background: #1d1d1d;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 11px 0;
  font-weight: 600;
  margin-top: 4px;
}

.btn-mosaic-primary:hover:not(:disabled) {
  background: #000;
  color: #fff;
}

.btn-mosaic-primary:disabled {
  opacity: 0.5;
}

.btn-mosaic-cta {
  width: 100%;
  background: #3abf6e;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 0;
  font-weight: 700;
  margin-top: 6px;
}

.btn-mosaic-cta:hover:not(:disabled) {
  background: #2ea55c;
  color: #fff;
}

.btn-mosaic-cta:disabled {
  opacity: 0.5;
}

.mosaic-print-note {
  font-size: 12px;
  color: #777;
  margin: 14px 0 4px;
}

/* Render progress note (revealed while the server composites the print). */
.mosaic-render-status {
  display: none;
  font-size: 12px;
  color: #555;
  margin-top: 8px;
}

.mosaic-render-status.is-visible {
  display: block;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .mosaic-header-spacer {
    height: 60px;
  }

  .mosaic-stage {
    position: static;
  }

  .mosaic-canvas {
    max-height: 56vh;
  }
}

@media (max-width: 575px) {
  .mosaic-hero-title {
    font-size: 24px;
  }

  .mosaic-steps {
    gap: 12px;
  }

  .mosaic-panel {
    padding: 14px;
  }
}
