/* Design Studio layout */
.studio-seo { background: var(--bg); }
.studio-seo .faq details { margin-bottom: .6rem; }
.designer-body .chatbot { bottom: 4.5rem; }
.studio { display: flex; flex-direction: column; height: calc(100vh - 72px); min-height: 640px; background: var(--bg-3); }
.studio-top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.studio-title { display: flex; align-items: center; gap: .6rem; min-width: 220px; }
.studio-title input { font-weight: 600; min-height: 40px; max-width: 200px; }
.save-state { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.studio-sides, .studio-methods { display: flex; gap: .2rem; background: var(--bg-3); padding: .2rem; border-radius: 999px; }
.side-btn, .method-btn { border: 0; background: transparent; padding: .5rem .9rem; border-radius: 999px; font: 600 .85rem var(--font-body); color: var(--text); cursor: pointer; min-height: 36px; }
.side-btn[aria-pressed="true"] { background: #16191c; color: #fff; }
.method-btn[aria-pressed="true"] { background: var(--grad); color: #fff; }
.studio-actions { margin-left: auto; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

.studio-body { display: grid; grid-template-columns: 76px 300px 1fr 280px; flex: 1; min-height: 0; }
.studio-tabs { display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); }
.stab { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .8rem .2rem; border: 0; background: transparent; color: var(--text-2); font: 600 .7rem var(--font-body); cursor: pointer; border-left: 3px solid transparent; min-height: 64px; }
.stab[aria-pressed="true"] { color: var(--ink); border-left-color: var(--ink); background: var(--ink-soft); }
.stab:hover { color: var(--ink); }
.studio-panel { background: var(--bg-2); border-right: 1px solid var(--line); overflow-y: auto; }
.spanel { padding: 1rem; }
.spanel h2 { font-size: 1.6rem; margin-bottom: .8rem; }
.spanel h3 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 700; margin: 1.2rem 0 .5rem; }
.spanel .hint { font-size: .8rem; color: var(--muted); }
.garments { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.garment-btn { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: .6rem; cursor: pointer; font: 500 .85rem var(--font-body); color: var(--text); min-height: 40px; }
.garment-btn[aria-checked="true"] { border-color: var(--ink); background: var(--ink-soft); color: var(--ink); font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: none; }
.font-list { display: grid; gap: .3rem; max-height: 55vh; overflow-y: auto; }
.font-list button { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: .5rem .8rem; font-size: 1.35rem; cursor: pointer; color: var(--text); min-height: 44px; }
.font-list button[aria-selected="true"] { border-color: var(--ink); background: var(--ink-soft); }
.art-cats { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; }
.art-cats button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .25rem .7rem; font: 500 .78rem var(--font-body); cursor: pointer; color: var(--text); }
.art-cats button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.art-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.art-grid button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: .5rem; cursor: pointer; display: grid; place-items: center; position: relative; }
.art-grid button:hover { border-color: var(--ink); }
.art-grid img { width: 100%; height: 100%; object-fit: contain; }
.art-grid .del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; line-height: 20px; border: 0; cursor: pointer; }
.dropzone { display: flex; flex-direction: column; gap: .3rem; align-items: center; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.5rem 1rem; cursor: pointer; font-weight: 400; }
.dropzone span { font-size: .8rem; color: var(--muted); }
.dropzone.over, .dropzone:focus-within { border-color: var(--ink); background: var(--ink-soft); }
.shape-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.shape-grid button { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); padding: .8rem; cursor: pointer; font: 500 .85rem var(--font-body); color: var(--text); }
.layer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.layer-list li { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem .6rem; background: var(--bg); font-size: .85rem; }
.layer-list li.active { border-color: var(--ink); background: var(--ink-soft); }
.layer-list .lname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: none; border: 0; text-align: left; font: inherit; color: inherit; padding: .2rem 0; }
.layer-list .icon-btn { width: 28px; height: 28px; }

.studio-canvas-wrap { display: flex; flex-direction: column; min-width: 0; }
.canvas-stage { flex: 1; display: grid; place-items: center; overflow: auto; padding: 1rem; background:
  radial-gradient(circle, var(--line) 1px, transparent 1px) 0 0/22px 22px; }
.canvas-container { box-shadow: var(--shadow); border-radius: 6px; background: #f4f4f1; transition: opacity .18s ease; }
/* Shown only while a product photo is still downloading (preloaded products switch instantly) */
.canvas-stage { position: relative; }
.canvas-stage.is-loading .canvas-container { opacity: .45; pointer-events: none; }
.canvas-stage.is-loading::after { content: ""; position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 3px solid rgba(14, 134, 192, .2); border-top-color: #0e86c0; animation: pg-spin .7s linear infinite; z-index: 2; pointer-events: none; }
@keyframes pg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .canvas-stage.is-loading::after { animation-duration: 2s; } }
.canvas-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--bg-2); border-top: 1px solid var(--line); font-size: .85rem; flex-wrap: wrap; }
.method-info { color: var(--text-2); }
.method-info .warn { color: var(--ink); font-weight: 600; }
.zoom { display: flex; align-items: center; gap: .3rem; }
.zoom .icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); }

.studio-props { background: var(--bg-2); border-left: 1px solid var(--line); overflow-y: auto; padding: 1rem; }
.props-empty { color: var(--muted); font-size: .9rem; }
.props-group { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.props-group > label { margin-bottom: .4rem; }
.props-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0; }
.props-row.toggles { grid-template-columns: repeat(6, 1fr); }
.props-row.toggles button { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); min-height: 36px; cursor: pointer; font-size: 1rem; color: var(--text); }
.props-row.toggles button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.props-row input[type=number], .props-row select { min-height: 36px; padding: .3rem .5rem; }
#p-fill, #p-stroke, #garment-custom { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 2px; }
input[type=range] { width: 100%; accent-color: var(--ink); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 500; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-card { background: var(--bg-2); border-radius: var(--radius); padding: 2rem; max-width: 460px; width: 100%; box-shadow: var(--shadow); }
.modal-card h2 { font-size: 2rem; }

@media (max-width: 1100px) {
  .studio { height: auto; }
  .studio-body { grid-template-columns: 76px 1fr; grid-template-rows: auto auto auto; }
  .studio-panel { grid-column: 2; grid-row: 1; max-height: 320px; }
  .studio-tabs { grid-row: 1 / span 3; flex-direction: column; }
  .studio-canvas-wrap { grid-column: 2; grid-row: 2; min-height: 520px; }
  .studio-props { grid-column: 2; grid-row: 3; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .studio-body { grid-template-columns: 1fr; }
  .studio-tabs { grid-row: auto; grid-column: 1; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .stab { flex: 1; min-width: 64px; border-left: 0; border-bottom: 3px solid transparent; }
  .stab[aria-pressed="true"] { border-bottom-color: var(--ink); }
  .studio-panel, .studio-canvas-wrap, .studio-props { grid-column: 1; }
  .studio-canvas-wrap { min-height: 420px; }
  .studio-actions { margin-left: 0; width: 100%; }
}
