/* ==========================================================================
   MCP Builder — Step Tabs / Wizard Mode
   ========================================================================== */

.stepnav {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-solid) 60%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 8px 20px;
}
.steptabs {
  display: flex; align-items: center; justify-content: center; gap: 0;
  max-width: 1180px; margin: 0 auto;
}
.steptabs button {
  white-space: nowrap; border: 0; background: transparent; cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 8px; color: var(--muted);
  font-weight: 600; font-size: 13px; transition: all .15s ease;
}
/* Connector line between steps */
.steptabs button + button::before {
  content: ""; width: 36px; height: 2px; border-radius: 2px; background: var(--border);
  margin: 0 10px 0 -14px;
}
.steptabs button:hover { color: var(--text); }
.steptabs button[aria-selected="true"] {
  color: var(--text); background: var(--panel-2);
}
.steptabs button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.steptabs .step-num {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 800; background: var(--panel-3); color: var(--muted);
}
.steptabs button[aria-selected="true"] .step-num {
  background: var(--accent); color: #fff; box-shadow: 0 0 0 3px var(--accent-soft);
}
.steptabs .badge {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.steptabs .badge:empty { display: none; }
.steptabs .badge.warn { background: var(--warn-soft); color: var(--warn); }
.steptabs .badge.ok { background: var(--ok-soft); color: var(--ok); }

/* Main wizard container */
main.wizard {
  display: block;
  max-width: 1560px;
  width: calc(100% - 32px);
  margin: 0 auto;
  padding: 16px 0 90px;
}
main.wizard > .panel {
  display: none;
  height: calc(100vh - 250px);
  min-height: 560px;
  grid-area: auto; position: static; max-height: none;
}
main.wizard > .panel.active {
  display: flex; flex-direction: column;
}

/* Step 1: Catalog takes full container width without default panel frame */
main.wizard > #catalog {
  max-width: 100%;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Steps 2 and 3: maintain focused reading width */
main.wizard > #creds,
main.wizard > #output {
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}

/* Ensure all 3 panels scroll cleanly in wizard mode */
main.wizard #catalog .server-list,
main.wizard #creds .creds-body,
main.wizard #output .out-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Sticky floating bottom stepbar */
.stepbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px;
  width: min(1000px, calc(100% - 32px)); padding: 8px 16px;
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.stepbar-info { flex: 1; text-align: center; font-size: 12.5px; font-weight: 550; color: var(--muted); }
.stepbar .btn[hidden] { display: inline-flex; visibility: hidden; }

@media (max-width: 960px) {
  .stepnav { padding: 6px 10px; }
  .steptabs { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .steptabs button { padding: 5px 8px; font-size: 12px; }
  .steptabs button + button::before { width: 14px; margin: 0 6px 0 -8px; }
  main.wizard { padding: 14px 14px 90px; }
  main.wizard > .panel { height: calc(100vh - 190px); min-height: 480px; }
  .stepbar-info { display: none; }
  .stepbar { justify-content: space-between; }
}

@media (max-width: 600px) {
  .stepnav { padding: 4px 8px; }
  .steptabs { -webkit-overflow-scrolling: touch; }
  .steptabs button { padding: 5px 6px; font-size: 11.5px; }
  .steptabs button + button::before { width: 10px; margin: 0 4px 0 -6px; }
  main.wizard { width: calc(100% - 16px); padding: 10px 4px 85px; }
  main.wizard > .panel { height: calc(100vh - 175px); min-height: 420px; }
  .stepbar { width: calc(100% - 16px); bottom: 10px; padding: 6px 12px; }
  .stepbar .btn { padding: 7px 12px; font-size: 12.5px; }
  main.wizard .cards { grid-template-columns: 1fr; }
  main.wizard .gtabs { grid-template-columns: repeat(2, 1fr); }
}

/* Keep toasts above the step bar */
body .toast { bottom: 82px; }

/* Category groups in wizard mode: fill available width smoothly */
main.wizard .gtabs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px;
}
main.wizard .gtab { padding: 7px 10px; font-size: 12px; }
main.wizard .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* My Selection rows: keep the category on one line and the credential badge from breaking */
.tray-item-meta { flex-wrap: wrap; gap: 3px 6px; min-width: 0; }
.tray-cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sel-cred-badge { white-space: nowrap; }
