/*
 * Canvas editor chrome.
 *
 * Nothing in here may leak onto the artboard: selection outlines, handles and
 * guides all live in an overlay that sits above the slide rather than inside
 * it, so what is exported is exactly what the slide markup says.
 */

.editor {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #15181a;
  color: #e7e9ea;
}

/* ---- top bar ---- */

.editor-bar {
  flex: 0 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: #191c1e;
  border-bottom: 1px solid #2c3237;
}

.editor-bar .app-title {
  color: #e7e9ea;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bar-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.bar-sep {
  width: 1px;
  height: 24px;
  background: #2c3237;
}

.bar-slides {
  display: flex;
  gap: 4px;
}

.slide-chip {
  min-width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #3a4147;
  color: #9aa3a9;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.slide-chip.is-active {
  border-color: var(--grc-red);
  background: rgba(160, 33, 34, 0.18);
  color: #fff;
}

.editor-bar .spacer {
  flex: 1;
}

.zoom-label {
  font-size: 12px;
  font-weight: 700;
  color: #9aa3a9;
  min-width: 42px;
  text-align: center;
}

.mini {
  border: 1px solid #3a4147;
  background: #22262a;
  color: #e7e9ea;
  border-radius: 7px;
  padding: 7px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini:hover {
  border-color: #4c565d;
}

.mini.is-active {
  border-color: var(--grc-red);
  background: rgba(160, 33, 34, 0.2);
}

.mini.is-danger {
  color: #e79a9a;
  border-color: #5c3335;
}

.mini:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---- body layout ---- */

.editor-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.rail {
  flex: 0 0 auto;
  width: 66px;
  background: #191c1e;
  border-right: 1px solid #2c3237;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  gap: 4px;
}

.rail-btn {
  background: transparent;
  border: 0;
  color: #8a9298;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 10px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rail-btn.is-active {
  color: #fff;
  background: #202528;
  box-shadow: inset 3px 0 0 var(--grc-red);
}

.rail-glyph {
  font-size: 17px;
  line-height: 1;
}

.flyout {
  flex: 0 0 auto;
  width: 250px;
  background: #191c1e;
  border-right: 1px solid #2c3237;
  overflow-y: auto;
  padding: 14px;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.panel-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7f888e;
  margin: 16px 0 8px;
}

.panel-title:first-child {
  margin-top: 0;
}

.panel-hint {
  font-size: 11px;
  color: #6f787e;
  line-height: 1.5;
  margin: 8px 0;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.add-btn {
  border: 1px solid #3a4147;
  background: #22262a;
  color: #e7e9ea;
  border-radius: 8px;
  padding: 11px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.add-btn:hover {
  border-color: var(--grc-red);
}

.add-btn.is-danger {
  color: #e79a9a;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.icon-btn {
  aspect-ratio: 1 / 1;
  border: 1px solid #2c3237;
  background: #1b1f22;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn:hover {
  border-color: var(--grc-red);
}

/* ---- layers ---- */

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #2c3237;
  border-radius: 8px;
  background: #1b1f22;
  cursor: pointer;
  font-size: 12px;
}

.layer-row.is-selected {
  border-color: var(--grc-red);
  background: rgba(160, 33, 34, 0.14);
}

.layer-row.is-drop-target {
  border-color: #4c9ffe;
}

.layer-kind {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  color: #7f888e;
  font-size: 12px;
}

.layer-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.layer-eye {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #7f888e;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}

.layer-row.is-hidden .layer-name {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ---- canvas ---- */

.canvas-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #15181a;
}

.canvas-scroll {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px;
}

/* The frame takes the scaled footprint; the slide inside stays at 1080. */
.canvas-frame {
  position: relative;
  flex: 0 0 auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.canvas-inner {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

/* Overlay carries selection chrome, so nothing decorative touches the slide. */
.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sel-box {
  position: absolute;
  border: 1.5px solid #4c9ffe;
  pointer-events: none;
}

.sel-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid #4c9ffe;
  border-radius: 2px;
  pointer-events: auto;
  cursor: nwse-resize;
}

.sel-handle[data-h="ne"], .sel-handle[data-h="sw"] {
  cursor: nesw-resize;
}

.sel-handle[data-h="n"], .sel-handle[data-h="s"] {
  cursor: ns-resize;
}

.sel-handle[data-h="e"], .sel-handle[data-h="w"] {
  cursor: ew-resize;
}

.hover-box {
  position: absolute;
  border: 1px dashed rgba(76, 159, 254, 0.7);
  pointer-events: none;
}

.guide {
  position: absolute;
  background: var(--grc-red);
  pointer-events: none;
}

.guide.is-x {
  width: 1px;
  top: 0;
  bottom: 0;
}

.guide.is-y {
  height: 1px;
  left: 0;
  right: 0;
}

.editor-status {
  flex: 0 0 auto;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  min-height: 30px;
  border-top: 1px solid #2c3237;
  background: #191c1e;
  color: #9aa3a9;
}

.editor-status.is-ok {
  color: #7fd18b;
}

.editor-status.is-error {
  color: #ec7d7d;
}

/* While dragging, text must not get selected by accident. */
.editor.is-dragging {
  user-select: none;
}

.editor.is-dragging .canvas-inner {
  cursor: grabbing;
}

/* An element being retyped shows a caret and nothing else. */
[data-grc-editing="1"] {
  outline: 2px solid #4c9ffe !important;
  outline-offset: 2px;
  cursor: text;
}

/* ---- inspector ---- */

.inspector {
  flex: 0 0 auto;
  width: 268px;
  background: #191c1e;
  border-left: 1px solid #2c3237;
  overflow-y: auto;
  padding: 14px;
}

.insp-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7f888e;
  margin-bottom: 12px;
}

.insp-group {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid #23282c;
}

.insp-group:last-child {
  border-bottom: 0;
}

.insp-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7f888e;
  margin: 10px 0 5px;
}

.insp-mini-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #6f787e;
  margin-bottom: 3px;
  text-align: center;
}

.insp-input {
  width: 100%;
  background: #1b1f22;
  border: 1px solid #2c3237;
  border-radius: 7px;
  color: #e7e9ea;
  padding: 7px 9px;
  font: inherit;
  font-size: 12px;
}

.insp-input:focus {
  outline: none;
  border-color: var(--grc-red);
}

textarea.insp-input {
  resize: vertical;
  line-height: 1.4;
}

.insp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.insp-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-row .mini {
  flex: 1 1 auto;
  padding: 7px 6px;
}

.swatch-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #3a4147;
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.swatch:hover {
  border-color: #fff;
}

.swatch.is-none {
  background: #1b1f22;
}

.swatch.is-none::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 11px;
  height: 1.5px;
  background: #e79a9a;
  transform: rotate(-45deg);
}

.swatch.is-custom {
  background: conic-gradient(#a02122, #c79a2e, #2f7d3a, #4c9ffe, #0c2430, #a02122);
  display: inline-flex;
}

.swatch.is-custom input {
  opacity: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---- new post dialog ---- */

.np-dialog {
  border: 1px solid #2c3237;
  border-radius: 14px;
  background: #191c1e;
  color: #e7e9ea;
  padding: 20px;
  width: min(400px, 92vw);
  font-family: var(--grc-font);
}

.np-dialog::backdrop {
  background: rgba(10, 12, 14, 0.65);
}

.np-dialog .swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--grc-red);
}

#np-error {
  color: #ec7d7d;
  min-height: 16px;
}
