/* css/bundle.css — Bundle Builder modal styles */

/* ── Sidebar trigger button ── */
.bundle-trigger {
  margin: 10px 12px 4px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  width: calc(100% - 24px);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: var(--sans);
}
.bundle-trigger:hover { opacity: 0.88; }
.bundle-count {
  margin-left: auto;
  background: rgba(255,255,255,0.22);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  min-width: 22px;
  text-align: center;
}

/* ── Backdrop ── */
.bundle-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
.bundle-overlay.open { display: flex; }

/* ── Modal shell ── */
.bundle-modal {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 14px;
  width: 1120px;
  max-width: 96vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0,0,0,0.7);
}

/* ── Header ── */
.bm-header {
  padding: 16px 22px;
  border-bottom: 1px solid #21262d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 14px;
}
.bm-title {
  font-size: 15px;
  font-weight: 700;
  color: #e6edf3;
  display: flex;
  align-items: center;
  gap: 9px;
}
.bm-header-actions { display: flex; align-items: center; gap: 10px; }
.bm-step-info {
  font-size: 11px; color: #484f58;
  background: #161b22; border: 1px solid #21262d;
  border-radius: 6px; padding: 4px 12px;
}
.bm-close {
  width: 28px; height: 28px;
  border-radius: 6px; border: 1px solid #21262d;
  background: transparent; color: #8b949e;
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.bm-close:hover { background: #161b22; color: #e6edf3; }

/* ── 3-column body ── */
.bm-body {
  display: grid;
  grid-template-columns: 210px 1fr 370px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ─── Col 1: Resource list ─── */
.bm-list { border-right: 1px solid #21262d; display: flex; flex-direction: column; overflow: hidden; }
.bm-list-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.bm-list-title { font-size: 11px; font-weight: 700; color: #484f58; text-transform: uppercase; letter-spacing: 0.06em; }
.bm-list-actions { display: flex; gap: 5px; }
.bm-list-actions button {
  font-size: 10px; font-weight: 600;
  background: #161b22; border: 1px solid #21262d;
  color: #8b949e; border-radius: 5px;
  padding: 3px 8px; cursor: pointer; font-family: var(--sans);
}
.bm-list-actions button:hover { color: #e6edf3; background: #21262d; }
.bm-list-scroll { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.bm-list-scroll::-webkit-scrollbar { width: 3px; }
.bm-list-scroll::-webkit-scrollbar-thumb { background: #21262d; border-radius: 99px; }
.bm-group { margin-bottom: 4px; }
.bm-group-label {
  padding: 8px 14px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: #484f58; display: flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
}
.bm-group-label:hover { color: #6b7280; }
.bm-res-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 20px;
  cursor: pointer; transition: background 0.1s;
  border-left: 2px solid transparent;
}
.bm-res-row:hover { background: #0d1117; }
.bm-res-row.selected { border-left-color: #2563eb; background: rgba(37,99,235,0.07); }
.bm-res-row.active-config { background: rgba(37,99,235,0.15); border-left-color: #60a5fa; }
.bm-checkbox {
  width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid #30363d;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.12s;
}
.bm-res-row.selected .bm-checkbox { background: #2563eb; border-color: #2563eb; }
.bm-res-row.selected .bm-checkbox::after { content: '✓'; font-size: 9px; color: #fff; font-weight: 800; }
.bm-res-label { font-size: 12.5px; color: #8b949e; flex: 1; transition: color 0.1s; }
.bm-res-row.selected .bm-res-label { color: #c9d1d9; }
.bm-res-row.active-config .bm-res-label { color: #93c5fd; font-weight: 600; }
.bm-edit-pill {
  opacity: 0;
  font-size: 9px; font-weight: 700;
  background: #21262d; border: 1px solid #30363d;
  color: #6b7280; border-radius: 3px;
  padding: 1px 5px; pointer-events: none;
  transition: opacity 0.1s; white-space: nowrap;
}
.bm-res-row.selected .bm-edit-pill,
.bm-res-row:hover .bm-edit-pill { opacity: 1; }
.bm-res-row.active-config .bm-edit-pill { color: #93c5fd; border-color: #2563eb; background: rgba(37,99,235,0.15); }

/* ─── Col 2: Config form ─── */
.bm-config { border-right: 1px solid #21262d; display: flex; flex-direction: column; overflow: hidden; background: #0a0f17; }
.bm-config-header {
  padding: 11px 18px; border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.bm-config-title { font-size: 13px; font-weight: 600; color: #e6edf3; }
.bm-config-badge {
  font-size: 10px; font-weight: 600;
  background: rgba(37,99,235,0.15); color: #93c5fd;
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: 99px; padding: 2px 10px;
}
.bm-config-scroll { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.bm-config-scroll::-webkit-scrollbar { width: 3px; }
.bm-config-scroll::-webkit-scrollbar-thumb { background: #21262d; border-radius: 99px; }

/* Fields */
.bm-field { margin-bottom: 12px; }
.bm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.bm-label {
  font-size: 10px; font-weight: 600; color: #6b7280;
  letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 5px;
}
.bm-field input,
.bm-field select,
.bm-field-row .bm-field input,
.bm-field-row .bm-field select {
  width: 100%; padding: 8px 11px;
  border: 1px solid #21262d; border-radius: 7px;
  background: #161b22; color: #e6edf3;
  font-family: var(--sans); font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.bm-field input:focus, .bm-field select:focus { border-color: #2563eb; }
.bm-field input::placeholder { color: #484f58; }
.bm-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.bm-field select option { background: #161b22; }

.bm-section {
  font-size: 10px; font-weight: 700; color: #30363d;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 16px 0 10px; padding-bottom: 5px;
  border-bottom: 1px solid #161b22;
}

/* KV rows inside bundle config */
.bm-kv-hdr { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 7px; margin-bottom: 4px; }
.bm-kv-hdr span { font-size: 9px; color: #484f58; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }
.bm-kv-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.bm-kv-row { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 7px; align-items: center; }
.bm-kv-row input {
  width: 100%; padding: 6px 9px;
  border: 1px solid #21262d; border-radius: 6px;
  background: #161b22; color: #e6edf3;
  font-family: var(--sans); font-size: 12px; outline: none;
}
.bm-kv-row input:focus { border-color: #2563eb; }
.bm-kv-row input::placeholder { color: #484f58; }
.bm-kv-del {
  width: 28px; height: 28px;
  border-radius: 5px; border: 1px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.06); color: #ef4444;
  font-size: 16px; line-height: 1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.1s;
}
.bm-kv-del:hover { background: rgba(239,68,68,0.15); }
.bm-add-kv {
  font-size: 11px; font-weight: 600; color: #3b82f6;
  background: rgba(37,99,235,0.07);
  border: 1px dashed rgba(37,99,235,0.25);
  border-radius: 6px; padding: 6px;
  width: 100%; cursor: pointer; text-align: center;
  font-family: var(--sans); transition: background 0.1s;
}
.bm-add-kv:hover { background: rgba(37,99,235,0.14); }

.bm-config-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 12px;
  color: #21262d; font-size: 13px; text-align: center; padding: 40px;
}
.bm-config-empty-icon { font-size: 40px; opacity: 0.35; }
.bm-config-hint { font-size: 11px; color: #30363d; line-height: 1.6; margin-top: 4px; }

/* ─── Col 3: YAML preview ─── */
.bm-preview { display: flex; flex-direction: column; background: #040810; overflow: hidden; }
.bm-preview-header {
  padding: 11px 16px; border-bottom: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.bm-preview-title { font-size: 12px; font-weight: 600; color: #8b949e; }
.bm-preview-stats {
  font-size: 10px; color: #484f58;
  background: #0d1117; border: 1px solid #21262d;
  border-radius: 99px; padding: 2px 9px; font-family: var(--mono);
}
.bm-preview-stats b { color: #79c0ff; }
.bm-preview-code { flex: 1; overflow-y: auto; padding: 14px 16px; }
.bm-preview-code::-webkit-scrollbar { width: 3px; }
.bm-preview-code::-webkit-scrollbar-thumb { background: #21262d; border-radius: 99px; }
.bm-preview-code pre { font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: #e6edf3; white-space: pre; }
.bm-preview-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 8px; color: #21262d; font-size: 12px;
}

/* ── Footer ── */
.bm-footer {
  padding: 13px 22px; border-top: 1px solid #21262d;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 14px;
}
.bm-footer-info { font-size: 12px; color: #6b7280; }
.bm-footer-info b { color: #e6edf3; }
.bm-footer-btns { display: flex; gap: 9px; }
.bm-btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 9px 20px; border-radius: 8px; cursor: pointer; transition: all 0.12s;
}
.bm-btn-copy { background: #161b22; color: #8b949e; border: 1px solid #21262d; }
.bm-btn-copy:hover { background: #21262d; color: #e6edf3; }
.bm-btn-dl { background: linear-gradient(135deg, #1d4ed8, #7c3aed); color: #fff; border: none; }
.bm-btn-dl:hover { opacity: 0.9; }
.bm-btn-dl:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── File tree (col 3 top half) ── */
.bm-file-count {
  padding: 6px 14px;
  font-size: 10px; font-weight: 700; color: #484f58;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid #161b22; flex-shrink: 0;
  background: #040810;
}

.bm-file-tree {
  padding: 10px 12px;
  overflow-y: auto;
  max-height: 38%;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}
.bm-file-tree::-webkit-scrollbar { width: 3px; }
.bm-file-tree::-webkit-scrollbar-thumb { background: #21262d; border-radius: 99px; }

.ft-root {}
.ft-folder {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 4px; font-size: 12px; color: #8b949e;
  user-select: none;
}
.ft-group { padding-left: 14px; margin-bottom: 2px; }
.ft-file {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; font-size: 12px; color: #6b7280;
  border-radius: 5px; cursor: pointer; transition: all 0.1s;
  margin-left: 14px;
}
.ft-file:hover { background: #161b22; color: #c9d1d9; }
.ft-file.ft-active { background: rgba(37,99,235,0.15); color: #93c5fd; }
.ft-icon { font-size: 13px; flex-shrink: 0; }
.ft-name { font-family: var(--mono); font-size: 11.5px; }
.ft-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; padding: 28px 12px;
  color: #30363d; font-size: 12px; text-align: center;
}

/* Preview area (col 3 bottom half) */
.bm-preview-divider {
  padding: 7px 14px;
  font-size: 10px; font-weight: 700; color: #484f58;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-top: 1px solid #21262d; border-bottom: 1px solid #161b22;
  flex-shrink: 0; background: #040810;
}
.ft-preview-name {
  font-size: 11px; font-family: var(--mono);
  color: #484f58; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid #161b22;
}

/* override bm-preview to be flex-col */
.bm-preview { flex-direction: column; }
.bm-preview-code { flex: 1; overflow-y: auto; padding: 12px 16px; }
