/* ─── modals.css ──────────────────────────────────────────────────────────────
 * Setup/connect modal, context menus (explorer & editor), and resize handles.
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── Base modal overlay ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  width: min(820px, 95vw);
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 0;
  display: flex; flex-direction: column; gap: 0;
  overflow: hidden;
}

/* ── Setup modal: header bar ─────────────────────────────────────────────── */
.setup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.setup-header-logo {
  font-size: 15px; font-weight: 800; letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--fae-color1) 0%, var(--fae-color2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.setup-user-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--bg);
  font-size: 12px; color: var(--muted);
}
.setup-user-pill strong {
  color: var(--accent); font-family: 'Cascadia Code', Consolas, monospace;
}

/* ── Setup modal: two-column body ────────────────────────────────────────── */
.setup-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.setup-col { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.setup-col-left  { border-right: 1px solid var(--border); overflow-y: auto; }
.setup-col-right { overflow-y: auto; min-width: 230px; max-width: 250px; flex: none; }
.setup-col-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  padding: 12px 16px 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.template-explorer-toolbar {
  display: grid;
  grid-template-columns: 1fr 120px 140px;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.template-search,
.template-filter {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  padding: 7px 9px;
  font-size: 12px;
  outline: none;
}
.template-search:focus,
.template-filter:focus { border-color: var(--accent); }

/* ── Setup modal: template card grid ─────────────────────────────────────── */
.setup-templates-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding: 12px 14px;
}
.tmpl-card {
  border: 2px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,0.04);
  padding: 14px 12px 12px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.tmpl-card:hover { border-color: rgba(180,255,0,0.4); background: rgba(180,255,0,0.05); }
.tmpl-card.selected {
  border-color: var(--fae-color2);
  background: rgba(180,255,0,0.09);
  box-shadow: 0 0 0 1px var(--fae-color2) inset;
}
.tmpl-icon { font-size: 24px; line-height: 1; }
.tmpl-name { font-size: 13px; font-weight: 700; color: var(--text); }
.tmpl-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }
.tmpl-meta {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto;
  font-size: 10px; color: rgba(255,255,255,0.52);
}
.tmpl-pill {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.04);
}
.tmpl-pill.private { border-color: rgba(180,255,0,0.28); color: var(--fae-color2); }
.tmpl-empty {
  grid-column: 1 / -1;
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ── Setup modal: footer (room input + action buttons) ───────────────────── */
.setup-bottom {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}
.setup-room-input {
  flex: 1; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface2); color: var(--text);
  padding: 8px 12px; outline: none; font-size: 13px;
}
.setup-room-input:focus  { border-color: var(--accent); }
.setup-room-input::placeholder { color: var(--muted); }

/* ── Setup modal: recent apps list ──────────────────────────────────────── */
.setup-apps-list {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px; flex: 1; overflow-y: auto;
}
.setup-app-card {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255,255,255,0.03);
  transition: background 0.13s, border-color 0.13s; overflow: hidden;
}
.setup-app-card:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.18); }
.setup-app-logo {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0;
  background: var(--surface3); object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; overflow: hidden;
}
.setup-app-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.setup-app-info    { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.setup-app-name    { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-app-meta    { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-apps-empty,
.setup-apps-loading { color: var(--muted); font-size: 12px; padding: 20px 14px; text-align: center; }

/* ── Modal generic inputs ────────────────────────────────────────────────── */
.modal input {
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface2); color: var(--text);
  padding: 8px; outline: none;
}
.modal-row { display: flex; gap: 8px; }
.modal-user-row {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--bg);
  font-size: 12px; color: var(--muted);
}
.modal-user-label { white-space: nowrap; }
.modal-user-name {
  color: var(--accent); font-weight: 600;
  font-family: 'Cascadia Code', Consolas, monospace; font-size: 12px;
}
#user-chip {
  font-size: 11px; color: var(--muted);
  font-family: 'Cascadia Code', Consolas, monospace;
  padding: 2px 8px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 3px;
}

/* ── Right-click context menus ───────────────────────────────────────────── */
.context-menu {
  position: fixed; min-width: 190px;
  background: #252526; border: 1px solid #454545;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border-radius: 4px; padding: 4px;
  display: none; z-index: 1200;
}
.context-menu.show { display: block; }
.context-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; width: 100%; border: none; background: transparent;
  color: var(--text); text-align: left; font-size: 12px;
  padding: 6px 10px; border-radius: 2px; cursor: pointer;
}
.context-item:hover { background: #094771; color: #ffffff; }
.context-item.danger:hover { background: #5a1d1d; }
.context-shortcut {
  color: var(--muted); font-size: 11px;
  font-family: 'Cascadia Code', Consolas, monospace;
}
.context-item:hover .context-shortcut { color: #d9ecff; }
.context-sep { height: 1px; background: #3a3a3a; margin: 4px 0; }

/* ── Column/row resize handles ────────────────────────────────────────────── */
.resize-col {
  position: absolute; top: 0; bottom: 0;
  width: 5px; cursor: col-resize; z-index: 20;
  background: transparent; transition: background 0.15s;
}
.resize-col:hover,
.resize-col.is-dragging { background: var(--accent2); opacity: 0.7; }

.resize-row {
  width: 100%; height: 5px; cursor: row-resize;
  flex-shrink: 0; background: transparent; transition: background 0.15s;
}
.resize-row:hover,
.resize-row.is-dragging { background: var(--accent2); opacity: 0.7; }

/* Covers the preview iframe during drag so it can't swallow pointer events */
.drag-shield { position: fixed; inset: 0; z-index: 9999; display: none; }
.drag-shield.active { display: block; }
