/* Switch CLI Lab — dark network-lab aesthetic */
:root {
  --bg: #0b0f14;
  --bg-elev: #121820;
  --bg-panel: #0e141c;
  --border: #1e2a38;
  --border-strong: #2a3a4d;
  --text: #e6edf5;
  --text-dim: #8b9bb0;
  --text-mute: #5c6b7e;
  --accent: #3d9cf0;
  --accent-soft: rgba(61, 156, 240, 0.12);
  --cisco: #49a5e6;
  --arista: #00c389;
  --success: #3ecf8e;
  --warn: #e6b84d;
  --danger: #f07178;
  --term-bg: #070b10;
  --term-green: #7ee787;
  --term-cyan: #79c0ff;
  --term-yellow: #e3b341;
  --term-white: #d4dce8;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
  color: inherit;
}

kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-elev);
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--text-dim);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--term-cyan);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
}

/* —— Top bar —— */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #121a24 0%, var(--bg-panel) 100%);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.platform-switch {
  display: flex;
  margin-left: auto;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.plat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.plat-btn:hover {
  color: var(--text);
}

.plat-btn.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.plat-btn.active[data-platform="cisco"] {
  box-shadow: inset 0 0 0 1px rgba(73, 165, 230, 0.35);
}

.plat-btn.active[data-platform="arista"] {
  box-shadow: inset 0 0 0 1px rgba(0, 195, 137, 0.35);
}

.plat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.plat-dot.cisco {
  background: var(--cisco);
}

.plat-dot.arista {
  background: var(--arista);
}

.top-actions {
  display: flex;
  gap: 0.4rem;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover {
  background: #1a2430;
  border-color: #3a4d64;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.btn.danger {
  border-color: rgba(240, 113, 120, 0.4);
  color: var(--danger);
}

.btn.danger:hover {
  background: rgba(240, 113, 120, 0.1);
}

.btn.primary {
  background: var(--accent-soft);
  border-color: rgba(61, 156, 240, 0.4);
  color: var(--accent);
}

/* —— Main layout —— */
.main {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr minmax(220px, 260px);
  flex: 1;
  min-height: 0;
}

/* —— Sidebar —— */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  min-height: 0;
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-tab {
  flex: 1;
  padding: 0.7rem 0.4rem;
  border: none;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.side-tab:hover {
  color: var(--text-dim);
}

.side-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.side-panels {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.side-panel {
  padding: 0.9rem;
}

.side-panel[hidden] {
  display: none !important;
}

.panel-intro {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  color: var(--text-mute);
}

/* Walkthrough list */
.walk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.walk-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.walk-card:hover {
  border-color: var(--border-strong);
  background: #16202b;
}

.walk-card.active {
  border-color: rgba(61, 156, 240, 0.5);
  background: var(--accent-soft);
}

.walk-card.done {
  border-color: rgba(62, 207, 142, 0.35);
}

.walk-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.walk-card p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.walk-card .walk-meta {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.chip {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.chip.cisco {
  color: var(--cisco);
  background: rgba(73, 165, 230, 0.12);
}

.chip.arista {
  color: var(--arista);
  background: rgba(0, 195, 137, 0.12);
}

.chip.both {
  color: var(--term-yellow);
  background: rgba(227, 179, 65, 0.12);
}

/* Command reference */
.ref-search-wrap {
  margin-bottom: 0.65rem;
}

.ref-search-wrap input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
}

.ref-search-wrap input:focus {
  border-color: var(--accent);
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ref-group-title {
  margin: 0.65rem 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}

.ref-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.ref-item:hover {
  background: var(--bg-elev);
  border-color: var(--border);
}

.ref-item .cmd {
  color: var(--term-green);
  display: block;
}

.ref-item .desc {
  font-family: var(--font);
  font-size: 0.72rem;
  color: var(--text-mute);
  margin-top: 0.1rem;
}

/* State view */
.state-view {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.state-view h4 {
  margin: 0.75rem 0 0.3rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  font-family: var(--font);
}

.state-view h4:first-child {
  margin-top: 0;
}

.state-view pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--term-white);
}

/* —— Terminal workspace —— */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.term-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  flex-shrink: 0;
}

.term-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(61, 156, 240, 0.15);
  color: var(--accent);
  white-space: nowrap;
}

.term-hostname {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.85rem;
}

.term-platform {
  font-size: 0.75rem;
  color: var(--text-mute);
}

.term-tools {
  display: flex;
  gap: 0.3rem;
}

.terminal {
  flex: 1;
  min-height: 0;
  background: var(--term-bg);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow: auto;
  outline: none;
  /* Real CLI: content grows downward; prompt follows last line, not pinned to pane bottom */
}

.terminal:focus-within {
  box-shadow: inset 0 0 0 1px rgba(61, 156, 240, 0.2);
}

.term-stream {
  display: block;
  padding: 0.75rem 1rem 1.25rem;
  min-height: min-content;
}

.term-output {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--term-white);
}

.term-output:empty {
  display: none;
}

.term-output .line-cmd,
.term-output .line-out,
.term-output .line-err,
.term-output .line-info,
.term-output .line-success,
.term-output .line-banner {
  display: block;
}

.term-output .line-cmd {
  color: var(--term-white);
}

.term-output .line-out {
  color: #b8c5d6;
}

.term-output .line-err {
  color: var(--danger);
}

.term-output .line-info {
  color: var(--term-cyan);
}

.term-output .line-success {
  color: var(--success);
}

.term-output .line-banner {
  color: var(--term-yellow);
}

/* Prompt sits immediately after output in the stream (shell-style cursor) */
.term-input-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.term-prompt {
  color: var(--term-green);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.term-input {
  flex: 1;
  min-width: 2ch;
  border: none;
  background: transparent;
  outline: none;
  color: var(--term-white);
  font-family: var(--mono);
  font-size: inherit;
  line-height: inherit;
  caret-color: var(--term-green);
  padding: 0;
  margin: 0;
}

/* Walkthrough active bar */
.walk-active {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #101820 0%, #0c1218 100%);
  padding: 0.75rem 1rem;
}

.walk-active-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.walk-active-head strong {
  font-size: 0.9rem;
}

.walk-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-right: 0.4rem;
}

.walk-active-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.walk-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.walk-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.25s ease;
}

.walk-step {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.walk-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--term-yellow);
  font-family: var(--mono);
}

/* —— Right bar —— */
.rightbar {
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 1rem;
  overflow-y: auto;
  min-height: 0;
}

.rightbar h2 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}

.rightbar h2:not(:first-child) {
  margin-top: 1.25rem;
}

.tips-box {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tips-box ul {
  margin: 0;
  padding-left: 1.1rem;
}

.tips-box li {
  margin-bottom: 0.35rem;
}

.diff-card {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

.diff-card p {
  margin: 0 0 0.5rem;
}

.diff-card p:last-child {
  margin-bottom: 0;
}

.diff-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-top: 0.4rem;
}

.diff-card th,
.diff-card td {
  text-align: left;
  padding: 0.25rem 0.3rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.diff-card th {
  color: var(--text-mute);
  font-weight: 500;
}

.kbd-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.kbd-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

/* —— Modal —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-card h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-body {
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.modal-body ul {
  padding-left: 1.2rem;
}

.modal-body p:first-child {
  margin-top: 0;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .main {
    grid-template-columns: minmax(240px, 280px) 1fr;
  }

  .rightbar {
    display: none;
  }
}

@media (max-width: 760px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 38vh;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .platform-switch {
    margin-left: 0;
    order: 3;
    width: 100%;
    justify-content: stretch;
  }

  .plat-btn {
    flex: 1;
    justify-content: center;
  }

  .tagline {
    display: none;
  }
}

/* Scrollbars */
.terminal::-webkit-scrollbar,
.side-panels::-webkit-scrollbar,
.rightbar::-webkit-scrollbar {
  width: 8px;
}

.terminal::-webkit-scrollbar-thumb,
.side-panels::-webkit-scrollbar-thumb,
.rightbar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
