/* ═══════════════════════════════════════════
   LyraMaker — /convert/ araclari (.cvx-*)
   viewer.css'in (.mvx-stage, .mvx-btn, .mvx-field...) ustune kurulur.
═══════════════════════════════════════════ */

.cvx {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
  margin: 0 0 1.5rem;
}

/* ── Sol: ayarlar ── */
.cvx-side {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.cvx-sec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.cvx-sec[hidden], .cvx-field[hidden], .cvx-check[hidden] { display: none; }
.cvx-sec h3 {
  margin: 0;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.cvx-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 0;
}
.cvx-field textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.45;
}
.cvx .cvx-help {
  margin: .35rem 0 0;
  font-size: .75rem;
  line-height: 1.5;
  color: var(--muted2);
}
.cvx-file-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cvx-filename {
  font-size: .8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.cvx-filename:empty { display: none; }
.cvx-pick { width: 100%; }

/* Renk basina yukseklik (SVG) */
.cvx-color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px auto;
  align-items: center;
  gap: .45rem;
}
.cvx-color-row .cvx-check { align-items: center; font-size: .8rem; font-family: ui-monospace, monospace; }
.cvx-color-row .cvx-check input { margin-top: 0; }
.cvx-color-row input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: .82rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem .45rem;
}
.cvx-swatch {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex: none;
}
.cvx-unit { font-size: .75rem; color: var(--muted2); }

/* ── Sag: onizleme ── */
.cvx-main { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }

.cvx[data-state="empty"] .mvx-drop,
.cvx[data-state="busy"] .mvx-busy,
.cvx[data-state="error"] .mvx-error { display: flex; }
.cvx[data-state="ready"] .mvx-tools { display: flex; }
.cvx.is-dragging .mvx-stage {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(130, 46, 245, .18);
}
/* Ayar degisince model yeniden uretilirken ince bir gosterge */
.cvx .mvx-stage::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 3px; width: 0;
  background: var(--accent);
  transition: width .25s ease, opacity .25s ease;
  opacity: 0;
}
.cvx.is-working[data-state="ready"] .mvx-stage::after { width: 70%; opacity: 1; transition: width 1.2s ease; }

.cvx-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
}
.cvx-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .3rem .7rem;
  margin: 0;
  font-size: .83rem;
}
.cvx-info dt { color: var(--muted2); white-space: nowrap; }
.cvx-info dd { margin: 0; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.cvx-info dd.is-ok { color: #22c55e; }
.cvx-info dd.is-bad { color: #f59e0b; }
/* onarim sayfasi: cizgi renk anahtari */
.cvx-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 .25rem 0 0; }
.cvx-key + .cvx-key, .cvx-help .cvx-key:not(:first-child) { margin-left: .6rem; }
.cvx-key-red { background: #ff3b3b; }
.cvx-key-orange { background: #ffa62b; }
.cvx-info:empty::after {
  content: "The model appears here as soon as there is something to build.";
  grid-column: 1 / -1;
  font-size: .83rem;
  color: var(--muted2);
}
.cvx-dl {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.cvx-dl select {
  font-family: inherit;
  font-size: .85rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem .6rem;
}
.cvx .cvx-notes {
  margin: -.2rem 0 0;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--muted);
  padding: 0 .2rem;
}

/* ── Hub kartlari ── */
.cvx-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 2.4rem;
}
.cvx-hub-card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.25rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}
.cvx-hub-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cvx-hub-flow {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.cvx-hub-card h2 { margin: 0; font-size: 1.12rem; }
.cvx-hub-card p { margin: 0; font-size: .87rem; line-height: 1.55; color: var(--muted); }
.cvx-hub-card span.go { margin-top: auto; font-size: .82rem; font-weight: 700; color: var(--accent); }

/* Araclar arasi rozetler */
.cvx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1.4rem;
}

@media (max-width: 960px) {
  .cvx { grid-template-columns: minmax(0, 1fr); }
  .cvx-main { order: -1; }
  .cvx .mvx-stage { aspect-ratio: 1 / 1; min-height: 300px; }
}
@media (max-width: 560px) {
  .cvx-bar { grid-template-columns: minmax(0, 1fr); }
  .cvx-info { grid-template-columns: auto minmax(0, 1fr); }
  .cvx-dl select { flex: 1 1 auto; min-width: 0; }
}

/* Lithophane isik onizlemesi */
.cvx-extra {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
}
.cvx-extra[hidden] { display: none; }
.cvx-extra-img {
  display: block;
  height: 200px;
  width: auto;
  max-width: 60%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 0 28px rgba(255, 220, 160, .18);
  flex: none;
}
.cvx-extra figcaption {
  font-size: .82rem;
  line-height: 1.55;
  color: var(--muted);
}
@media (max-width: 560px) {
  .cvx-extra { flex-direction: column; align-items: flex-start; }
  .cvx-extra-img { width: 100%; height: auto; max-width: 100%; }
}

/* ═══════════════════════════════════════════
   2B donusturuculer (.c2d) — js/convert-2d.js
═══════════════════════════════════════════ */
.c2d-stage {
  position: relative;
  min-height: 340px;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(130, 46, 245, .10), transparent 65%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
}
.c2d.is-dragging .c2d-stage {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(130, 46, 245, .18);
}
.c2d-drop {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
}
.c2d-drop svg { color: var(--accent); opacity: .85; margin-bottom: .9rem; }
.c2d-drop .mvx-drop-inner { max-width: 380px; }
.c2d-preview {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: .6rem;
  padding: 1rem;
  min-width: 0;
}
.c2d[data-state="ready"] .c2d-drop { display: none; }
.c2d[data-state="ready"] .c2d-preview { display: flex; }
.c2d-view {
  flex: 1;
  min-height: 300px;
  max-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  /* saydamligi gosteren dama deseni */
  background-color: #f4f4f8;
  background-image:
    linear-gradient(45deg, #dcdce6 25%, transparent 25%), linear-gradient(-45deg, #dcdce6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dcdce6 75%), linear-gradient(-45deg, transparent 75%, #dcdce6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.c2d-view > img, .c2d-view > canvas {
  display: block;
  max-width: 100%;
  max-height: 540px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.c2d-view > .is-paper { box-shadow: 0 2px 18px rgba(0, 0, 0, .25); background: #fff; max-height: 520px; }
.c2d-view:has(.is-paper) { background: #6d6d7a; padding: 10px; }
.c2d-cap { margin: 0; font-size: .8rem; color: var(--muted); text-align: center; min-height: 1.2em; }
.c2d-icons { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 1rem; padding: 1rem; }
.c2d-icons figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.c2d-icons canvas { image-rendering: pixelated; display: block; }
.c2d-icons figcaption { font-size: .72rem; color: #555; font-family: ui-monospace, monospace; }

.c2d-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.c2d-list:empty { display: none; }
.c2d-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .5rem .65rem;
  cursor: pointer;
  margin: 0;
}
.c2d-item.is-selected { border-color: var(--accent); }
.c2d-item.is-error .c2d-sub { color: #e5484d; }
.c2d-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-size: .62rem; font-weight: 800; color: var(--muted);
}
.c2d-thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.c2d-meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.c2d-name { font-size: .86rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c2d-sub { font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; }
.c2d-acts { display: flex; align-items: center; gap: .3rem; }
.c2d-acts .mvx-btn { padding: .4rem .7rem; font-size: .78rem; }
.c2d-ic {
  font: inherit; font-size: .85rem; line-height: 1;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
}
.c2d-ic:hover { color: var(--text); border-color: var(--accent); }
.c2d-up, .c2d-down { display: none; }
.c2d.is-merge .c2d-up, .c2d.is-merge .c2d-down { display: inline-block; }
.c2d.is-merge .c2d-get { display: none; }

.c2d .cvx-dl { flex-wrap: wrap; justify-content: flex-end; }
.c2d .cvx-info:empty::after { content: none; }
.c2d.is-working .c2d-stage::after {
  content: "";
  position: absolute; left: 0; top: 0; height: 3px; width: 70%;
  background: var(--accent);
  animation: c2d-bar 1.2s ease infinite alternate;
}
@keyframes c2d-bar { from { width: 10%; } to { width: 85%; } }

/* Coklu secim (ICO boyutlari) */
.cvx-multi { display: flex; flex-wrap: wrap; gap: .35rem .8rem; }
.cvx-multi label { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text); cursor: pointer; }
.cvx-field input[type="color"] {
  width: 72px; height: 34px; padding: 2px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); cursor: pointer;
}

/* Hub: bolum basliklari ve donusum listesi */
.cvx-hub-sec { margin: 0 0 2.2rem; }
.cvx-hub-sec > h2 { font-size: 1.25rem; margin: 0 0 .35rem; }
.cvx-hub-sec > p { margin: 0 0 .9rem; font-size: .9rem; color: var(--muted); max-width: 760px; }
.cvx-hub-sec .cvx-tabs { margin-bottom: 0; }

@media (max-width: 960px) {
  .c2d .cvx-main { order: -1; }
  .c2d-view { min-height: 240px; }
}
@media (max-width: 560px) {
  .c2d-item { grid-template-columns: 40px minmax(0, 1fr); }
  .c2d-thumb { width: 40px; height: 40px; }
  .c2d-acts { grid-column: 1 / -1; justify-content: flex-end; }
}

/* 2B sayfalarda ust sekmeler mobilde tek satir, yana kaydirilir */
@media (max-width: 700px) {
  .cvx-tabs.is-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: -16px; margin-right: -16px;
    padding: 0 16px 2px;
  }
  .cvx-tabs.is-scroll::-webkit-scrollbar { display: none; }
  .cvx-tabs.is-scroll .mvx-badge { flex: none; }
}

/* duzenleme sayfasi (olcekle / dondur / kes) */
.cvx [hidden] { display: none !important; }
.cvx-xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
.cvx-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.cvx-btns .mvx-btn { flex: 1 1 auto; padding: .45rem .6rem; font-size: .8rem; }

/* 3D -> resim sayfasi: onizleme indirilecek resmin kendisi */
.cvx-render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.cmx[data-render] .mvx-canvas { position: absolute; inset: 0; }
.cmx[data-render].is-transparent .mvx-canvas {
  background-color: #fff;
  background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.cmx[data-render][data-state="empty"] .cvx-render { display: none; }
.cvx-nav { position: absolute; left: .6rem; bottom: .6rem; display: flex; gap: .4rem; z-index: 3; }
.cvx-nav .mvx-btn { padding: .3rem .8rem; font-size: 1.1rem; line-height: 1; }
.cvx-clear { margin-top: .5rem; }
