/* Extracted from root index.html */

:root {
  --bg: #0b0d12;
  --panel: #111520;
  --panel-2: #151a27;
  --card: #171d2b;
  --line: rgba(255,255,255,.1);
  --text: #eef2ff;
  --muted: #99a3b8;
  --brand: #4f7cff;
  --brand-2: #6ee7ff;
  --danger: #ff5c7a;
  --ok: #3ee58f;
  --radius: 18px;
  --shadow: 0 20px 70px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(79,124,255,.18), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(110,231,255,.1), transparent 35%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,13,18,.72);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), #8a5cff);
  box-shadow: 0 12px 32px rgba(79,124,255,.35);
  font-weight: 900;
  letter-spacing: .5px;
}

.brand-title { line-height: 1.1; }
.brand-title strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-title span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .18s ease;
  user-select: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
.btn.primary { background: linear-gradient(135deg, var(--brand), #7d5cff); border-color: transparent; box-shadow: 0 14px 36px rgba(79,124,255,.28); }
.btn.success { background: linear-gradient(135deg, #25c978, #1cbfbc); border-color: transparent; color: #03120b; font-weight: 800; }
.btn.danger { background: rgba(255,92,122,.13); border-color: rgba(255,92,122,.36); color: #ffd4dc; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.layout {
  display: grid;
  grid-template-columns: 330px minmax(420px, 1fr) 360px;
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 72px);
}

.panel {
  background: rgba(17,21,32,.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
}

.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.025);
}

.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.panel-body { padding: 16px; }
.stack { display: grid; gap: 14px; }

.upload {
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 16px;
  padding: 15px;
  background: rgba(255,255,255,.025);
  transition: .18s ease;
}
.upload:hover { border-color: rgba(79,124,255,.7); background: rgba(79,124,255,.06); }
.upload label { display: grid; gap: 7px; cursor: pointer; }
.upload strong { font-size: 13px; }
.upload span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.upload input { display: none; }

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.stat span { display: block; color: var(--muted); font-size: 11px; }
.stat strong { display: block; margin-top: 6px; font-size: 20px; }

.file-list {
  max-height: 215px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.025);
  cursor: pointer;
  transition: .15s ease;
}
.file-item:hover { border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.file-item.active { border-color: rgba(79,124,255,.75); box-shadow: 0 0 0 3px rgba(79,124,255,.12); }
.file-item img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 10px;
  background: #fff;
}
.file-item div { min-width: 0; }
.file-item strong {
  display: block;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-item span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

.stage-wrap {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-width: 0;
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  color: var(--muted);
  font-size: 12px;
}
.pill b { color: var(--text); }

.stage-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.025) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
}

/* Sabit önizleme: orta sütun çok geniş olsa da kenar max 640px; dar sütun / kısa ekranda min(640,100%,78vh) ile kare kalır. */
.canvas-shell {
  position: relative;
  --stage-canvas: 640px;
  width: min(var(--stage-canvas), 100%, 78vh);
  aspect-ratio: 1 / 1;
  height: auto;
  flex-shrink: 0;
  margin: 0 auto;
  background: rgba(255,255,255,.03);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

canvas { width: 100%; height: 100%; display: block; }

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34px;
  pointer-events: none;
}
.empty-state div {
  max-width: 380px;
  padding: 22px;
  border-radius: 20px;
  background: rgba(11,13,18,.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.empty-state h3 { margin: 0; font-size: 18px; }
.empty-state p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; font-size: 13px; }

.controls-grid { display: grid; gap: 13px; }
.field { display: grid; gap: 8px; }
.field label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.field label b { color: var(--text); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--brand); }

.number-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.input {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
.input:focus { border-color: rgba(79,124,255,.75); box-shadow: 0 0 0 4px rgba(79,124,255,.12); }

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
}
.preview-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: rgba(255,255,255,.04);
  display: block;
}
.preview-card span {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-note { color: var(--muted); font-size: 12px; line-height: 1.5; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  background: rgba(17,21,32,.94);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 13px 15px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 80;
  font-size: 13px;
  line-height: 1.45;
}
.toast.show { transform: translateY(0); opacity: 1; }

.progress-stack {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 140;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 28px));
  pointer-events: none;
}
.progress-card {
  pointer-events: auto;
  background: rgba(17,21,32,.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.progress-title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}
.progress-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}
.progress-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  display: grid;
  place-items: center;
}
.icon-btn:hover { border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, var(--brand), #7d5cff);
  border-radius: 999px;
  transition: width .15s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.progress-card.done .progress-bar > div { background: linear-gradient(135deg, #25c978, #1cbfbc); }
.progress-card.error { border-color: rgba(255,92,122,.5); }
.progress-card.error .progress-bar > div { background: rgba(255,92,122,.85); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
  display: none;
  z-index: 120;
  padding: 18px;
}
.modal.show { display: grid; }
.modal-card {
  width: min(1200px, 100%);
  height: min(92vh, 980px);
  margin: auto;
  background: rgba(17,21,32,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.modal-head h3 { margin: 0; font-size: 14px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; gap: 10px; align-items: center; }

.modal-body {
  padding: 14px;
  overflow: auto;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.gallery-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: .15s ease;
}
.gallery-item:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: rgba(255,255,255,.04);
  display: block;
}
.gallery-item span {
  display: block;
  padding: 8px 9px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  height: 100%;
}
.detail-stage {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
}
.detail-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.detail-side {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.detail-side .k { color: var(--muted); font-size: 12px; }
.detail-side .v { color: var(--text); font-size: 12px; font-weight: 700; word-break: break-word; }

@media (max-width: 1180px) {
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { padding: 10px; }
  .modal-card { height: 94vh; }
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: 300px 1fr; }
  .right-panel { grid-column: 1 / -1; }
  .preview-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .topbar { height: auto; padding: 14px; align-items: flex-start; flex-direction: column; }
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .stage-card { min-height: 420px; }
  .preview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .brand { min-width: 0; }
}
