/* SavorIP 4.4.0 — persistent creative result gallery */
.creative-gallery-section {
  margin-top: 42px;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid rgba(177, 135, 48, .32);
  border-radius: 28px;
  background: linear-gradient(145deg, #fffdf8 0%, #f7f2e7 100%);
  box-shadow: 0 22px 55px rgba(6, 39, 31, .09);
  scroll-margin-top: 110px;
}
.creative-gallery-section[hidden] { display: none !important; }
.creative-gallery-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.creative-gallery-head h2 { margin: 6px 0 8px; font-size: clamp(28px, 3.4vw, 48px); line-height: 1.16; color: #082f25; }
.creative-gallery-head p { margin: 0; color: #56675f; line-height: 1.7; }
.creative-gallery-head > strong {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(0, 83, 60, .22);
  border-radius: 999px;
  background: #eef7f2;
  color: #075e44;
  font-size: 14px;
}
.creative-gallery-head > strong::before { content: "✓"; margin-right: 8px; font-weight: 900; }
.creative-gallery-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid #d7d7cf;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.creative-gallery-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid #deded5;
  background: transparent;
  color: #375048;
  font-weight: 800;
  cursor: pointer;
}
.creative-gallery-tabs button:last-child { border-right: 0; }
.creative-gallery-tabs button.is-active { background: #06392c; color: #fff; }
.creative-gallery-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .75fr); gap: 24px; }
.creative-gallery-stage {
  position: relative;
  min-height: min(62vw, 610px);
  overflow: hidden;
  border-radius: 24px;
  background: #e9e5dc;
  border: 1px solid rgba(5, 60, 44, .16);
}
.creative-gallery-stage > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(62vw, 610px);
  object-fit: contain;
  background: #f8f5ee;
}
.creative-gallery-stage > img[hidden] { display: none !important; }
.creative-gallery-label {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 18px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(3, 38, 29, .90);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.creative-gallery-loading,
.creative-gallery-error {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  background: linear-gradient(145deg, #f7f2e8, #ede6d7);
  color: #14382e;
}
.creative-gallery-loading[hidden], .creative-gallery-error[hidden] { display: none !important; }
.creative-gallery-loading span {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(9, 76, 56, .18);
  border-top-color: #0a5942;
  border-radius: 50%;
  animation: creative-spin .8s linear infinite;
}
@keyframes creative-spin { to { transform: rotate(360deg); } }
.creative-gallery-error strong { font-size: 22px; }
.creative-gallery-error p { margin: 0; color: #6b6e68; }
.creative-gallery-error button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: #06392c; color: #fff; font-weight: 800; cursor: pointer; }
.creative-gallery-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.creative-gallery-actions button { min-height: 52px; padding: 10px 14px; border-radius: 999px; font-weight: 850; line-height: 1.25; }
.creative-gallery-actions button:disabled { opacity: .42; cursor: not-allowed; }
.creative-gallery-summary {
  align-self: start;
  padding: 22px;
  border: 1px solid rgba(177, 135, 48, .24);
  border-radius: 22px;
  background: rgba(255, 255, 255, .74);
}
.creative-gallery-summary h3 { margin: 0 0 16px; color: #0b392d; font-size: 22px; }
.creative-gallery-summary dl { margin: 0; display: grid; gap: 8px; }
.creative-gallery-summary dl div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 12px; border-radius: 12px; background: #f8f5ee; }
.creative-gallery-summary dt { color: #4a6159; font-weight: 700; }
.creative-gallery-summary dd { margin: 0; text-align: right; color: #18382f; font-weight: 800; }
.creative-gallery-summary h4 { margin: 24px 0 12px; color: #0b392d; }
.creative-gallery-compare { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 8px; }
.creative-gallery-compare button { min-width: 0; padding: 8px; border: 1px solid #dedbd2; border-radius: 14px; background: #fff; cursor: pointer; }
.creative-gallery-compare button.is-active { border: 2px solid #0b4c39; box-shadow: 0 0 0 3px rgba(11, 76, 57, .10); }
.creative-gallery-compare img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 9px; background: #f4f1e9; }
.creative-gallery-compare span { display: block; margin-top: 7px; font-size: 11px; font-weight: 800; color: #28463c; }
.creative-gallery-compare i { color: #8d7543; font-size: 22px; font-style: normal; }
.creative-gallery-disclosure { margin: 18px 0 0; padding: 14px; border-radius: 14px; background: #eef5f0; color: #425b52; font-size: 12px; line-height: 1.65; }
.creative-gallery-summary .is-success { color: #087250; }
.creative-gallery-section.is-error .creative-gallery-head > strong { background: #fff0ed; color: #a13c2c; }

/* Dialog uses the same reliable loading state */
.creative-result-image-wrap { position: relative; min-height: 360px; background: #f4f1e9; }
.creative-result-image-wrap img { width: 100%; max-height: 620px; object-fit: contain; background: #f7f3ea; }
.creative-result-image-wrap img[hidden] { display: none !important; }
.creative-dialog-loading,
.creative-dialog-error { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; background: #f7f3ea; color: #173b30; z-index: 2; }
.creative-dialog-loading[hidden], .creative-dialog-error[hidden] { display: none !important; }

@media (max-width: 980px) {
  .creative-gallery-grid { grid-template-columns: 1fr; }
  .creative-gallery-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .creative-gallery-head { flex-direction: column; }
}
@media (max-width: 640px) {
  .creative-gallery-section { margin: 24px 12px 0; padding: 18px 14px 22px; border-radius: 22px; }
  .creative-gallery-tabs { grid-template-columns: repeat(2, 1fr); border-radius: 18px; }
  .creative-gallery-tabs button { border-bottom: 1px solid #deded5; }
  .creative-gallery-stage, .creative-gallery-stage > img { min-height: 390px; }
  .creative-gallery-actions { grid-template-columns: 1fr; }
  .creative-gallery-summary { padding: 16px; }
  .creative-gallery-compare { gap: 5px; }
  .creative-gallery-compare span { font-size: 9px; }
}
