/* ==========================================================================
   CAROUSEEDIT — Core shell
   ========================================================================== */
:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --line: #2a3038;
  --text: #e7eaee;
  --muted: #8b95a3;
  --accent: #ff5b2e;
  --accent-2: #ffd24a;
  --radius: 12px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #101215;
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.scroll { overflow-y: auto; flex: 1; min-height: 0; }
.scroll::-webkit-scrollbar { width: 9px; }
.scroll::-webkit-scrollbar-thumb { background: #2c333c; border-radius: 9px; }

.section { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px;
  color: var(--muted); font-weight: 700; margin-bottom: 11px;
}

/* Tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tab {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-weight: 700;
  transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Template picker */
.tpl-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tpl-btn {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, transform .12s;
  padding: 0;
}
.tpl-btn:hover { transform: translateY(-2px); }
.tpl-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,91,46,.2); }
.tpl-btn .mini { width: 100%; height: 100%; display: block; }
.tpl-btn .num {
  position: absolute; top: 4px; left: 5px;
  font-size: 9px; font-weight: 800; color: #fff;
  background: rgba(0,0,0,.55); border-radius: 4px; padding: 1px 4px;
}

/* Fields */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 11.5px; color: var(--muted);
  margin-bottom: 5px; font-weight: 600;
}
.field input[type=text], .field textarea, .field select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.field input[type=text]:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 74px; line-height: 1.45; }

/* Upload slots */
.slot {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}
.slot-thumb {
  width: 42px; height: 42px; border-radius: 6px;
  background: #0e1116; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-size: 16px; color: var(--muted);
}
.slot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slot-meta { flex: 1; min-width: 0; }
.slot-name { font-size: 11.5px; font-weight: 600; margin-bottom: 3px; }
.slot-actions { display: flex; gap: 5px; }
.btn-mini {
  font-size: 10.5px; padding: 4px 8px; border-radius: 5px;
  border: 1px solid var(--line); background: #0e1116;
  cursor: pointer; color: var(--muted);
}
.btn-mini:hover { color: var(--text); border-color: #3b434e; }

/* Bottom actions */
.actions {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel);
}
.btn {
  border: none; border-radius: 9px; cursor: pointer;
  padding: 11px 14px; font-size: 13px; font-weight: 700;
  transition: filter .15s, transform .1s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: #3b434e; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ---------- Stage area ---------- */
.viewer {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background:
    radial-gradient(ellipse at 50% 0%, #171b22 0%, #0b0d10 62%);
}
.viewer-bar {
  height: 52px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.viewer-bar .dims { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.viewer-bar .dims b { color: var(--text); font-weight: 700; }
.zoom { display: flex; gap: 4px; align-items: center; }
.zoom button {
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 14px; line-height: 1;
}
.zoom span { font-size: 11.5px; color: var(--muted); min-width: 40px; text-align: center; }

.canvas-wrap {
  flex: 1; min-height: 0;
  display: grid; place-items: center;
  padding: 26px;
  overflow: auto;
}
#stageCanvas {
  display: block;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  background: #fff;
}
.stage-scaler {
  transform-origin: center center;
  overflow: hidden;
  filter: drop-shadow(0 24px 60px rgba(0,0,0,.55));
}

/* The actual 1080x1350 stage */
.stage {
  width: 1080px; height: 1350px;
  position: relative; overflow: hidden;
  background: #fff;
}

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 90px);
  background: #fff; color: #111; padding: 11px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 600; opacity: 0;
  transition: transform .25s, opacity .25s; z-index: 99;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
}
