/* Edit panel — right side, shows when a component is selected in edit
   mode. Sibling to the layout-editor panel. */

.ep-panel {
  position: fixed;
  /* Anchor to the bottom-right so it never collides with the layout-
     editor panel (which is top-right). The two stacks grow toward each
     other; if the selected component has many fields, ep-panel scrolls
     internally via max-height. */
  bottom: 16px;
  right: 16px;
  width: 300px;
  max-height: calc(100vh - 280px);   /* leave room for the top panel */
  overflow-y: auto;
  background: #15171a;
  border: 1px solid #3c3f43;
  color: #dddcd5;
  font: 12px 'Segoe UI', system-ui, sans-serif;
  padding: 12px 14px;
  z-index: 1000;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}
.ep-panel::-webkit-scrollbar { width: 6px; }
.ep-panel::-webkit-scrollbar-thumb { background: #2f3236; border-radius: 3px; }
.ep-panel h3 {
  margin: 0 0 10px;
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ff9c2e;
  font-weight: 700;
}
.ep-panel h3 .ep-title-key {
  font-family: ui-monospace, Consolas, monospace;
  color: #dddcd5;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  margin-left: 4px;
}
.ep-body { display: flex; flex-direction: column; gap: 14px; }
.ep-field {
  display: flex; flex-direction: column; gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2a2d31;
}
.ep-field:last-child { border-bottom: none; padding-bottom: 0; }
.ep-field-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8b8c89;
  font-weight: 600;
}
.ep-field-current {
  font: 10.5px ui-monospace, Consolas, monospace;
  color: #7cc97b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-file-upload {
  background: #1b1d20;
  color: #dddcd5;
  border: 1px dashed #3c3f43;
  padding: 6px 10px;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.ep-file-upload:hover { border-color: #ff9c2e; color: #ff9c2e; }
.ep-file-upload-compact {
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: none;
  font-weight: normal;
}

/* List-type panel field — dynamic array editor for alliances, relations. */
.ep-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ep-list-item {
  background: #0c0d0f;
  border: 1px solid #2a2d31;
  padding: 8px;
  border-radius: 2px;
}
.ep-list-item-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2d31;
  font: 11px ui-monospace, Consolas, monospace;
  color: #dddcd5;
}
.ep-list-item-remove {
  background: transparent;
  border: 1px solid transparent;
  color: #8b8c89;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 2px;
}
.ep-list-item-remove:hover { color: #c44a3a; border-color: #c44a3a; }
.ep-list-subfield {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 6px;
  margin-bottom: 4px;
  align-items: center;
}
.ep-list-subfield > label {
  font-size: 9.5px;
  color: #8b8c89;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.ep-list-subfield input[type=text],
.ep-list-subfield input[type=number] {
  background: #1b1d20;
  color: #dddcd5;
  border: 1px solid #2f3236;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 2px;
  font-family: inherit;
  min-width: 0;
}
.ep-list-subfield input:focus {
  outline: none;
  border-color: #ff9c2e;
}
.ep-list-add {
  background: transparent;
  color: #8b8c89;
  border: 1px dashed #3c3f43;
  padding: 6px 10px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 1px;
  font-weight: 600;
  border-radius: 2px;
}
.ep-list-add:hover { color: #ff9c2e; border-color: #ff9c2e; }

/* Range slider field (font sizes, etc.) */
.ep-range-track {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ep-range-track input[type=range] {
  flex: 1;
  accent-color: #ff9c2e;
  cursor: pointer;
}
.ep-range-value {
  font: 11.5px ui-monospace, Consolas, monospace;
  color: #dddcd5;
  min-width: 42px;
  text-align: right;
}

.ep-hint {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #2a2d31;
  font-size: 10.5px;
  color: #8b8c89;
  line-height: 1.4;
}

/* Inline-editable text cue — hover outline so the user knows what's
   editable without over-decorating in the final render. */
.is-inline-editable {
  outline: 1px dashed transparent;
  outline-offset: 2px;
  border-radius: 2px;
  transition: outline-color 0.12s, background-color 0.12s;
}
.superevent-stage.is-debug .is-inline-editable {
  cursor: text;
  outline-color: rgba(124, 201, 123, 0.25);
}
.superevent-stage.is-debug .is-inline-editable:hover {
  outline-color: rgba(124, 201, 123, 0.7);
  background-color: rgba(124, 201, 123, 0.05);
}
.superevent-stage.is-debug .is-inline-editable:focus {
  outline: 2px solid #7cc97b !important;
  outline-offset: 2px;
  background-color: rgba(124, 201, 123, 0.08);
}

/* Re-enable pointer-events on inline-editable text (the layout-editor
   globally disables interactions with inner content). !important so the
   click always lands on the text element first. */
.superevent-stage.is-debug .is-inline-editable {
  pointer-events: auto !important;
  user-select: text !important;
}

/* Empty editable elements collapse to zero height and become unclickable.
   Keep a minimum hit target so the user can still click "into" them to
   start typing. Only apply to small inline text (tag, name, headline) —
   body/description elements already fill their host via other rules. */
.superevent-stage.is-debug .is-inline-editable:empty:not(.np-body):not(.bio-body):not(.cic-description) {
  min-height: 16px;
  min-width: 40px;
}

/* Process-portrait toggle — appears above the upload button when the
   selected component is a leader portrait. Lets the user opt out of
   the painted-TNO pipeline (crop + bg-strip + tonify) and just store
   the raw upload as the portrait. */
.ep-process-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.ep-process-toggle:hover {
  color: var(--text);
  border-color: rgba(212, 210, 202, 0.2);
}
.ep-process-toggle input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* Portrait-processing status + progress bar. Appears below the upload
   button while cropping / bg-stripping / TNO-ifying. Hidden when idle. */
.ep-process-status {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  line-height: 1.3;
}
.ep-process-status.is-err {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(196, 74, 58, 0.08);
  font-style: normal;
}
.ep-process-bar {
  width: 100%;
  height: 6px;
  margin-top: 4px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 3px;
  background: #2a2c30;
  overflow: hidden;
}
.ep-process-bar::-webkit-progress-bar {
  background: #2a2c30;
  border-radius: 3px;
}
.ep-process-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent-warm), var(--accent));
  border-radius: 3px;
  transition: width 0.18s ease;
}
.ep-process-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent-warm), var(--accent));
  border-radius: 3px;
}
