/* ============================================================
   Arma Menu Creator — style.css
   ============================================================ */

:root {
  --bg: #1a1a1a;
  --surface: #252525;
  --surface2: #2e2e2e;
  --border: #3a3a3a;
  --border-hi: #555;
  --accent: #4e8a2e;
  --accent-hover: #5ea135;
  --text: #e0e0e0;
  --text-muted: #888;
  --danger: #c0392b;
  --warning: #e67e22;
  --warn-bg:  #1a1400;
  --warn-bd:  #4a3800;
  --warn-txt: #c8a832;
  --radius: 6px;
  --sidebar-w: 300px;
}

[data-theme="light"] {
  --bg: #f0f0f0;
  --surface: #ffffff;
  --surface2: #e8e8e8;
  --border: #cccccc;
  --border-hi: #aaa;
  --text: #1a1a1a;
  --text-muted: #666;
  --warn-bg:  #fdf6e0;
  --warn-bd:  #d4a800;
  --warn-txt: #7a5800;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.page-header a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.page-header a:hover { color: var(--text); }

/* ── Layout shell ────────────────────────────────────────────── */
.amc-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.amc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-panel {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
}

.sidebar-panel summary,
.panel-heading {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.3rem 0.2rem;
  cursor: pointer;
  user-select: none;
}

details > summary { list-style: none; }
details > summary::before { content: '▶ '; font-size: 0.7rem; }
details[open] > summary::before { content: '▼ '; }

details .panel-body { padding-top: 0.4rem; }

/* Config rows */
.cfg-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.cfg-row label {
  flex: 0 0 90px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.cfg-row input,
.cfg-row select {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.22rem 0.4rem;
  font-size: 0.8rem;
}
.cfg-row input[type="color"] {
  padding: 0.1rem;
  height: 26px;
  cursor: pointer;
}
.cfg-rgb {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ── Toolbox grid ────────────────────────────────────────────── */
.toolbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.4rem 0;
}
.toolbox-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.3rem;
  text-align: center;
  font-size: 0.78rem;
  cursor: grab;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.toolbox-item:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.toolbox-item .ti-icon { font-size: 1.1rem; display: block; margin-bottom: 0.1rem; }

/* ── Properties form ─────────────────────────────────────────── */
.props-empty {
  padding: 1rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}
.props-empty p { margin-bottom: 0.5rem; }
.props-form {}

.prop-type-banner {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.prop-row label {
  flex: 0 0 80px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.prop-row input,
.prop-row select {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.2rem 0.4rem;
  font-size: 0.78rem;
}

.prop-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}
.prop-row-2 input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.2rem 0.4rem;
  font-size: 0.78rem;
  width: 100%;
}

.prop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.hidden { display: none !important; }

/* ── Main canvas area ────────────────────────────────────────── */
.amc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Toolbar */
.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.canvas-toolbar .tb-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.2rem;
}
#snap-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* Canvas scroll container */
.canvas-outer {
  flex: 1;
  overflow: auto;
  padding: 2rem 1.5rem 1.5rem 2rem;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
}

/* The screen canvas — represents the full game viewport */
.canvas-safezone {
  position: relative;
  /* width + height set by JS based on selected resolution */
  background: #090909;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: default;
  /* very subtle wide grid — game world background context (hidden when scene active) */
  background-image:
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 55px 55px;
}
/* When a game scene is loaded, suppress the dot-grid on safezone */
.canvas-safezone.has-scene {
  background-image: none;
}

/* Scene background layer — fills the whole safezone behind everything */
.scene-layer {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.scene-layer.scene-active      { opacity: 1; }
.scene-layer.scene-edit-dim    { opacity: 0.42; }
/* Override: preview mode shows scene at full opacity */
.canvas-safezone.preview-mode .scene-layer.scene-active { opacity: 1; }

/* Dialog area sub-container — positioned at (ox,oy), sized (cw×ch) of screen */
.canvas-dialog-area {
  position: absolute;
  border: 1px dashed rgba(100, 200, 60, 0.45);
  overflow: visible;
  cursor: default;
  z-index: 2;  /* above scene-layer (z:0) */
  /* grid pattern within the dialog area */
  background: rgba(5, 15, 3, 0.6);
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: calc(100% / 20) calc(100% / 20);
  /* subtle inner glow to distinguish from game world */
  box-shadow: inset 0 0 0 1px rgba(100,200,60,0.08), 0 0 30px rgba(0,0,0,0.6);
}

/* Canvas infobar */
.canvas-infobar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
  flex-shrink: 0;
}

/* ── Placed controls ─────────────────────────────────────────── */
.ctrl-el {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
  cursor: move;
  overflow: visible;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 4px;
  min-height: 2px;
}
.ctrl-el:hover { border-color: rgba(255,255,255,0.5); }
.ctrl-el.selected {
  border: 1px solid #4e8a2e;
  outline: 1px solid rgba(78,138,46,0.4);
  background: rgba(78,138,46,0.08);
  z-index: 100;
}

/* Type-specific tints */
.ctrl-button        { background: rgba(78,138,46,0.12); }
.ctrl-listbox       { background: rgba(0,100,200,0.1); }
.ctrl-combo         { background: rgba(0,160,200,0.1); }
.ctrl-text          { background: rgba(200,200,200,0.05); }
.ctrl-structuredtext{ background: rgba(200,200,200,0.06); }
.ctrl-edit          { background: rgba(255,200,50,0.07); }
.ctrl-frame         { background: transparent; border-style: solid; border-color: rgba(255,255,255,0.3); }
.ctrl-picture       { background: rgba(100,50,200,0.12); }

.ctrl-label {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  pointer-events: none;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 90%;
  text-shadow: 0 1px 2px #000;
  z-index: 2;
}
.ctrl-type-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Resize handles */
.resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #4e8a2e;
  border: 1px solid #fff;
  border-radius: 1px;
  z-index: 200;
}
.handle-nw { top:-4px; left:-4px; cursor: nw-resize; }
.handle-n  { top:-4px; left:calc(50% - 4px); cursor: n-resize; }
.handle-ne { top:-4px; right:-4px; cursor: ne-resize; }
.handle-e  { top:calc(50% - 4px); right:-4px; cursor: e-resize; }
.handle-se { bottom:-4px; right:-4px; cursor: se-resize; }
.handle-s  { bottom:-4px; left:calc(50% - 4px); cursor: s-resize; }
.handle-sw { bottom:-4px; left:-4px; cursor: sw-resize; }
.handle-w  { top:calc(50% - 4px); left:-4px; cursor: w-resize; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.btn-danger:hover { background: #e74c3c; }
.btn.btn-sm { padding: 0.18rem 0.5rem; font-size: 0.75rem; }

/* ── Export modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 720px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.export-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}
.export-tab {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-weight: 600;
}
.export-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.modal-body { flex: 1; overflow: hidden; padding: 0.75rem 1rem; display: flex; flex-direction: column; }

#export-area {
  flex: 1;
  width: 100%;
  background: #111;
  border: 1px solid var(--border);
  color: #b5e891;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.78rem;
  resize: none;
  padding: 0.6rem;
  border-radius: var(--radius);
  line-height: 1.5;
  min-height: 350px;
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ── Tool header ─────────────────────────────────────────────── */
.tool-header {
  background: #0d1a08;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  flex-shrink: 0;
}
.tool-header-inner {
  max-width: min(960px, 96vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tool-header-title {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.tool-header-icon { font-size: 1.8rem; line-height: 1; }
.tool-header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.tool-header-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.tool-tag-beta {
  display: inline-block;
  font-size: 0.5em;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #1a3a12;
  border: 1px solid #4a8a3a;
  color: #7fd460;
  border-radius: 3px;
  padding: 2px 6px;
  vertical-align: middle;
  line-height: 1.6;
  margin-left: 0.3em;
  text-transform: uppercase;
}

/* ── Button system (btn-amc) ─────────────────────────────────── */
.btn-amc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ccc;
  border-radius: 4px;
  padding: 0.32rem 0.75rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
  user-select: none;
}
.btn-amc:hover { background: #363636; border-color: #555; color: #e8e8e8; }
.btn-amc:active { background: #1e1e1e; }
.btn-sm { padding: 0.22rem 0.55rem !important; font-size: 0.76rem !important; }
.btn-amc-ghost { background: transparent; border-color: #3a3a3a; color: #aaa; }
.btn-amc-ghost:hover { background: #2a2a2a; border-color: #555; color: #ddd; }
.btn-amc-primary { background: var(--accent); border-color: var(--accent); color: #fff !important; font-weight: 600; }
.btn-amc-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-amc-danger { background: #8b1e1e; border-color: #a12424; color: #fff !important; }
.btn-amc-danger:hover { background: #a62828; border-color: #c03030; }

/* Scene background / toolbar selects */
.toolbar-select {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #aaa;
  font-size: 0.76rem;
  padding: 0.22rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
  max-width: 130px;
}
.toolbar-select:hover  { border-color: #555; color: #ddd; background: #2a2a2a; }
.toolbar-select option { background: #1c2018; color: #ddd; }

/* ── Panel system ────────────────────────────────────────────── */
.amc-panel {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  flex-shrink: 0;
}
.amc-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Config form classes ─────────────────────────────────────── */
.cfg-label {
  flex: 0 0 88px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.cfg-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.22rem 0.4rem;
  font-size: 0.79rem;
  font-family: inherit;
  min-width: 0;
}
.cfg-input:focus { outline: none; border-color: var(--accent); }
.cfg-num { font-family: 'Consolas', monospace; }
.cfg-select {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.22rem 0.4rem;
  font-size: 0.79rem;
  min-width: 0;
}
.cfg-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 0.1rem 0 0.2rem 0;
  opacity: 0.8;
  margin: 0;
  white-space: normal;
}
.cfg-color-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}
.cfg-color {
  width: 34px;
  height: 26px;
  padding: 0.05rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}
.cfg-color-out {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.cfg-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  align-items: end;
  margin-bottom: 0.35rem;
}
.cfg-two > div { display: flex; flex-direction: column; gap: 0.15rem; }
.cfg-two .cfg-label { flex: none; }

/* ── Toolbox icon alias ──────────────────────────────────────── */
.toolbox-item .tb-icon { font-size: 1.1rem; display: block; margin-bottom: 0.1rem; }

/* ── Canvas toolbar extras ───────────────────────────────────── */
.canvas-hint { font-size: 0.71rem; color: var(--text-muted); padding: 0 0.2rem; white-space: nowrap; }
.canvas-toolbar-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; margin: 0 0.1rem; }

/* ── Properties form classes ─────────────────────────────────── */
.prop-label {
  flex: 0 0 78px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
}
.prop-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.18rem 0.35rem;
  font-size: 0.77rem;
  font-family: inherit;
  min-width: 0;
}
.prop-input:focus { outline: none; border-color: var(--accent); }
.prop-num { font-family: 'Consolas', monospace !important; }
.prop-select {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.18rem 0.35rem;
  font-size: 0.77rem;
  min-width: 0;
}
.prop-textarea {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.18rem 0.35rem;
  font-size: 0.74rem;
  font-family: 'Consolas', monospace;
  resize: vertical;
  min-width: 0;
}
.prop-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.3rem 0 0.05rem;
  border-top: 1px solid var(--border);
  margin-top: 0.15rem;
  width: 100%;
}
div.prop-section-label { display: block; }
.prop-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.22rem;
  margin-bottom: 0.3rem;
}
.prop-row-4 > div { display: flex; flex-direction: column; gap: 0.1rem; }
.prop-row-4 .prop-label { flex: none; margin: 0; font-size: 0.69rem; }
.prop-row-4 .prop-input { padding: 0.14rem 0.28rem; }
.prop-hint { font-size: 0.78rem; color: var(--accent); font-weight: 600; }
.prop-color-pair {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}
.prop-color {
  width: 30px;
  height: 22px;
  padding: 0.02rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}
.prop-alpha {
  width: 46px;
  flex-shrink: 0;
  font-family: 'Consolas', monospace;
}
.prop-alpha-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Modal extras ────────────────────────────────────────────── */
.modal-lg { width: 780px; }
.export-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.export-area {
  flex: 1;
  width: 100%;
  background: #0e0e0e;
  border: 1px solid var(--border);
  color: #b5e891;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.77rem;
  resize: none;
  padding: 0.6rem;
  border-radius: var(--radius);
  line-height: 1.5;
  min-height: 320px;
  max-height: 58vh;
  outline: none;
}

/* ── Guide lines overlay ─────────────────────────────────────── */
.canvas-guides { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.guide-line { position: absolute; pointer-events: none; opacity: 0.7; }
.guide-h { left: 0; right: 0; height: 1px; }
.guide-v { top: 0; bottom: 0; width: 1px; }
.guide-center { background: rgba(255,220,0,0.65); }
.guide-third  { background: rgba(80,160,255,0.45); }
.guide-h-center { top: 50%; }
.guide-v-center { left: 50%; }
.guide-h-t1 { top: 33.333%; }
.guide-h-t2 { top: 66.666%; }
.guide-v-t1 { left: 33.333%; }
.guide-v-t2 { left: 66.666%; }

/* ── ShortcutButton tint ─────────────────────────────────────── */
.ctrl-shortcutbutton { background: rgba(200,120,0,0.12); }

/* ── Light mode overrides ────────────────────────────────────── */
[data-theme="light"] .btn-amc { background: #eee; border-color: #ccc; color: #333; }
[data-theme="light"] .btn-amc:hover { background: #ddd; border-color: #bbb; }
[data-theme="light"] .btn-amc-primary { background: var(--accent); color: #fff !important; border-color: var(--accent); }
[data-theme="light"] .btn-amc-ghost { background: transparent; border-color: #ccc; color: #555; }
[data-theme="light"] .btn-amc-ghost:hover { background: #e8e8e8; }
[data-theme="light"] .cfg-input,
[data-theme="light"] .cfg-select,
[data-theme="light"] .prop-input,
[data-theme="light"] .prop-select,
[data-theme="light"] .prop-textarea { background: #fff; border-color: #ccc; color: #1a1a1a; }
/* ══ Beta notice ═══════════════════════════════════════════════════════════════ */
.amc-beta-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-bd);
  color: var(--warn-txt);
  font-size: 0.82rem;
  padding: 0.55rem 1.25rem;
  flex-shrink: 0;
}
.amc-beta-notice a { color: inherit; text-decoration: underline; }
.amc-beta-notice strong { font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   LAYERS NAVIGATOR
   ═══════════════════════════════════════════════════════════════ */
.layers-panel {
  position: fixed;
  bottom: 2.5rem;
  right: 1rem;
  width: 240px;
  max-height: 420px;
  background: #141a10;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  z-index: 500;
  user-select: none;
  overflow: hidden;
}
.layers-panel.hidden { display: none; }

.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: #0d130a;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  flex-shrink: 0;
}
.layers-header:active { cursor: grabbing; }
.layers-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.layers-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 2px;
  line-height: 1;
}
.layers-close:hover { color: var(--text); }

.layers-body {
  overflow-y: auto;
  flex: 1;
  padding: 0.3rem 0;
}

/* Layer group */
.lyr-group {
  margin-bottom: 2px;
}
.lyr-group-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.lyr-group-header:hover { color: var(--text); }
.lyr-caret { font-size: 0.6rem; transition: transform 0.15s; }
.lyr-group.collapsed .lyr-caret { transform: rotate(-90deg); }
.lyr-group-list { list-style: none; padding: 0; margin: 0; }
.lyr-group.collapsed .lyr-group-list { display: none; }

/* Layer row */
.lyr-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.5rem 0.22rem 1rem;
  cursor: pointer;
  font-size: 0.73rem;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  position: relative;
}
.lyr-row:hover { background: rgba(255,255,255,0.04); }
.lyr-row.selected {
  background: rgba(78,138,46,0.15);
  border-left-color: #4e8a2e;
}
.lyr-row.hidden-ctrl {
  opacity: 0.4;
}
.lyr-row.drag-over {
  background: rgba(78,138,46,0.25);
  border-left-color: #7fd460;
}
.lyr-drag-handle {
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: grab;
  flex-shrink: 0;
  padding-right: 2px;
}
.lyr-drag-handle:active { cursor: grabbing; }
.lyr-type-icon { flex-shrink: 0; font-size: 0.75rem; }
.lyr-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.lyr-vis {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 1px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.5;
}
.lyr-vis:hover { opacity: 1; }

[data-theme="light"] .layers-panel { background: #f5f9f2; border-color: #ccc; }
[data-theme="light"] .layers-header { background: #edf2ea; }
[data-theme="light"] .tool-header { background: #f5f9f2; border-color: #ccc; }
[data-theme="light"] .amc-sidebar { background: #f8f8f8; border-color: #ddd; }
[data-theme="light"] .amc-panel { border-color: #ddd; }
[data-theme="light"] .export-area { background: #111; color: #b5e891; }
/* Canvas stays dark in light mode — it simulates the game screen */
[data-theme="light"] .canvas-outer { background: #c8c8c8; }

/* ═══════════════════════════════════════════════════════════════
   ZOOM LABEL
   ═══════════════════════════════════════════════════════════════ */
.zoom-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
  font-family: 'Consolas', monospace;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   DIALOG TABS BAR
   ═══════════════════════════════════════════════════════════════ */
.amc-dialog-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.dialog-tabs-bar {
  display: flex;
  align-items: stretch;
  min-height: 30px;
  padding: 0 0.5rem;
  gap: 2px;
}
.dialog-tab {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
  user-select: none;
}
.dialog-tab:hover { color: var(--text); }
.dialog-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.dialog-tab-label { pointer-events: none; }
.dialog-tab.active .dialog-tab-label { pointer-events: auto; cursor: text; }
.dialog-tab-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 1px;
  opacity: 0.5;
}
.dialog-tab-close:hover { opacity: 1; color: var(--danger); }
.dialog-tab-add {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  align-self: center;
  line-height: 1;
  transition: color 0.12s;
}
.dialog-tab-add:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   RULERS
   ═══════════════════════════════════════════════════════════════ */
.ruler-h {
  position: absolute;
  top: -18px;
  left: 0;
  height: 18px;
  pointer-events: none;
  z-index: 60;
  display: block;
  image-rendering: pixelated;
}
.ruler-v {
  position: absolute;
  top: 0;
  left: -18px;
  width: 18px;
  pointer-events: none;
  z-index: 60;
  display: block;
  image-rendering: pixelated;
}

/* ═══════════════════════════════════════════════════════════════
   RUBBER-BAND SELECTION RECT
   ═══════════════════════════════════════════════════════════════ */
.rubberband-rect {
  position: absolute;
  border: 1px dashed rgba(78,138,46,0.9);
  background: rgba(78,138,46,0.08);
  pointer-events: none;
  z-index: 300;
}

/* ═══════════════════════════════════════════════════════════════
   MULTI-SELECT + LOCKED CONTROL STYLES
   ═══════════════════════════════════════════════════════════════ */
.ctrl-el.selected:not(.primary-selected) {
  /* secondary selection: blue-ish tint */
  border-color: rgba(60, 140, 220, 0.85);
  outline: 1px solid rgba(60, 140, 220, 0.3);
  background-color: rgba(60, 140, 220, 0.08);
}
.ctrl-el.locked-ctrl {
  cursor: not-allowed;
  opacity: 0.75;
}
.ctrl-el.locked-ctrl::after {
  content: '🔒';
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 9px;
  pointer-events: none;
  z-index: 3;
}
.lyr-row.locked-item .lyr-name { opacity: 0.6; }
.lyr-row.locked-item .lyr-drag-handle { opacity: 0.3; cursor: default; }

/* ═══════════════════════════════════════════════════════════════
   PREVIEW MODE — hides editing chrome
   ═══════════════════════════════════════════════════════════════ */
.canvas-safezone.preview-mode .ctrl-type-badge { display: none; }
.canvas-safezone.preview-mode .resize-handle   { display: none; }
.canvas-safezone.preview-mode .canvas-grid     { visibility: hidden; }
.canvas-safezone.preview-mode .canvas-guides   { visibility: hidden; }
.canvas-safezone.preview-mode .ctrl-el {
  /* JS handles border/outline per control type (Frame keeps a border) */
  cursor: default;
  overflow: hidden;  /* clip text/content that extends outside control bounds */
}
.canvas-safezone.preview-mode .ctrl-type-badge { display: none; }
/* Frame title: small label sitting on the top border line, like Arma renders it */
.preview-mode .ctrl-el.ctrl-frame .frame-title-label {
  position: absolute;
  top: -0.58em;
  left: 5px;
  white-space: nowrap;
  overflow: visible;
  font-size: 0.68rem;
  line-height: 1;
  padding: 0 3px;
  pointer-events: none;
  /* subtle bg so label reads against the border line */
  background: rgba(5, 12, 3, 0.82);
}
.canvas-safezone.preview-mode .canvas-dialog-area {
  border-color: transparent;
  background: transparent;
  background-image: none;
  box-shadow: none;
}
.canvas-safezone.preview-mode .ruler-h,
.canvas-safezone.preview-mode .ruler-v { display: none; }

/* ═══════════════════════════════════════════════════════════════
   CONTEXT MENU
   ═══════════════════════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  background: #1c2018;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  z-index: 2000;
  user-select: none;
}
.ctx-menu.hidden { display: none; }
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.78rem;
  font-family: inherit;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
}
.ctx-item:hover { background: rgba(78,138,46,0.2); color: #fff; }
.ctx-item.ctx-danger { color: #e07070; }
.ctx-item.ctx-danger:hover { background: rgba(180,40,40,0.25); color: #ff8888; }
.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/* ═══════════════════════════════════════════════════════════════
   LAYERS SEARCH
   ═══════════════════════════════════════════════════════════════ */
.layers-search-wrap {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.layers-search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font-size: 0.73rem;
  font-family: inherit;
  outline: none;
}
.layers-search-input:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   HPP PREVIEW IN PROPERTIES
   ═══════════════════════════════════════════════════════════════ */
.hpp-preview-code {
  display: block;
  font-size: 0.67rem;
  font-family: 'Consolas', 'Courier New', monospace;
  background: #0a100a;
  color: #8fc878;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
  margin: 0.25rem 0 0.4rem;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.45;
  max-height: 200px;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   CHEATSHEET MODAL
   ═══════════════════════════════════════════════════════════════ */
.cheatsheet-body {
  padding: 0.75rem 1.25rem 1rem;
  overflow-y: auto;
  max-height: 70vh;
}
.cheatsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.cheatsheet-table tr { border-bottom: 1px solid var(--border); }
.cheatsheet-table tr:last-child { border-bottom: none; }
.cheatsheet-table td {
  padding: 0.38rem 0.5rem;
  vertical-align: middle;
}
.cheatsheet-table td:first-child {
  white-space: nowrap;
  color: var(--text-muted);
  width: 44%;
}
kbd {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.72rem;
  font-family: 'Consolas', monospace;
  color: var(--text);
  line-height: 1.4;
}

/* Canvas-outer padding already defined above (2rem 1.5rem 1.5rem 2rem for ruler clearance) */
