/*
 * Desktop Design Studio Host.
 * Visual source: 4.7/dongjie/poddisp-studio-v6
 * The center frame stays a 720px designer iframe.
 */

:root {
  --page: 1160px;
  --purple: #5432ff;
  --ink: #11184c;
  --muted: #7d87b1;
  --line: #e4e8f4;
  --bg: #f7f8ff;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #fbfbff 0%, #f7f8ff 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body { min-width: 1180px; }

a { text-decoration: none; color: inherit; }

.studio-shell {
  width: var(--page);
  margin: 0 auto;
  padding: 10px 0 28px;
}

.studio-header {
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.back,
.help,
.exit {
  color: var(--purple);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.back { justify-self: start; }

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 24px;
}

.exit {
  border: 1.5px solid var(--purple);
  border-radius: 15px;
  padding: 11px 17px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
}

.brand strong {
  font-size: 26px;
  color: var(--purple);
  letter-spacing: -0.5px;
}

.brand span {
  height: 30px;
  width: 1px;
  background: #aeb4d2;
}

.brand b {
  font-size: 24px;
  letter-spacing: -0.4px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 200px 720px 200px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 230, 244, 0.95);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: 0 14px 42px rgba(64, 54, 174, 0.055);
}

.panel h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.08;
  margin: 0 0 14px;
  color: #28325f;
}

.left-panel h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.18;
  margin: 12px 0 8px;
  color: #26305b;
}

.product-thumb {
  width: 154px;
  height: 154px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.price {
  font-size: 18px;
  font-weight: 800;
  color: var(--purple);
  margin-top: 2px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0 14px;
}

.tips-title { margin-bottom: 8px !important; }

.tip {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
}

.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0edff;
  color: var(--purple);
  font-weight: 800;
  font-size: 16px;
}

.tip strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.12;
}

.tip p {
  font-size: 11.5px;
  line-height: 1.28;
  color: var(--muted);
  margin: 3px 0 0;
}

.designer-panel {
  width: 720px;
  height: calc(100vh - 102px);
  min-height: 820px;
  border-radius: 26px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 0 0 8px rgba(114, 93, 255, 0.10),
    0 22px 58px rgba(77, 59, 215, 0.14);
}

.designer-panel iframe {
  display: block;
  width: 720px;
  height: 100%;
  border: 0;
  background: #e5e6fc;
}

/* Right column holds two stacked panels: the first-run AI Styles card and
   "Your preview". The AI card is [hidden] by default, so it contributes no
   box and no flex gap until the frame asks for it. */
.right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-panel {
  padding-left: 22px;
  padding-right: 22px;
}

/* ── First-run AI Styles card ───────────────────────────────────── */

.ai-panel {
  padding-left: 22px;
  padding-right: 22px;
}

#dk-host-ai[hidden] { display: none; }

.ai-panel h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
}

.ai-spark {
  color: var(--purple);
  font-size: 15px;
  line-height: 1;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ai-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f6f5fb;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.ai-thumb:hover { border-color: #c7bcff; }
.ai-thumb:active { transform: scale(0.97); }

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

.ai-cta {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  color: var(--purple);
  cursor: pointer;
}

.ai-cta:hover { text-decoration: underline; }

/* While the AI card is up, the preview list drops from 5 to 3 so the column
   keeps its height. The extra two are only hidden, never rebuilt, so removing
   the class restores them instantly and exactly. */
.right-col.has-ai-card .preview:nth-child(n+4) {
  display: none;
}

.preview-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preview {
  width: 154px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}

.preview img {
  display: block;
  width: 100%;
  height: 104px;
  object-fit: contain;
  background: #f6f5fb;
}

.preview-note {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  align-items: start;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 13px;
}

.preview-note > span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0edff;
  color: var(--purple);
  font-size: 14px;
}

.preview-note p {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  margin: 1px 0 0;
}

.preview-note strong {
  color: #58639a;
  font-size: 12px;
}

@media (max-width: 1240px) {
  body { min-width: 1080px; }
  .studio-shell { width: calc(100vw - 56px); }
  .studio-grid {
    grid-template-columns: 190px minmax(640px, 720px) 190px;
    gap: 14px;
  }
  .designer-panel,
  .designer-panel iframe { width: 100%; }
  .panel { padding-left: 14px; padding-right: 14px; }
  .right-col { gap: 14px; }
  .product-thumb,
  .preview { width: 148px; }
}
