/* ── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #21262d;
  --border:    #30363d;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --accent:    #0078d4;
  --accent-lt: rgba(0,120,212,0.12);
  --success:   #3fb950;
  --warn:      #d29922;
  --danger:    #e74c3c;
  --radius:    10px;
  --sidebar-w: 360px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }
code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.85em;
}
kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: monospace;
  font-size: 0.8em;
}
h3 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-muted); font-size: 0.875rem; }

/* ── Screen switching ──────────────────────────────────────────── */
.screen[hidden]  { display: none !important; }
#screen-login:not([hidden]) { display: flex; }
#screen-lab:not([hidden])   { display: flex; }

/* ── Login ─────────────────────────────────────────────────────── */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at top, rgba(0,120,212,0.08) 0%, transparent 60%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.login-card h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem; }
.login-sub { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.75rem; line-height: 1.6; }

.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.field label { font-size: 0.85rem; font-weight: 600; }
.field input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--accent); }
.field-hint { font-size: 0.78rem; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.12); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-success { background: rgba(63,185,80,0.15); color: #3fb950; border: 1px solid rgba(63,185,80,0.3); }
.btn-full    { width: 100%; justify-content: center; padding: 0.75rem; font-size: 1rem; }
.btn-sm      { padding: 0.375rem 0.75rem; font-size: 0.82rem; }

/* ── Messages ──────────────────────────────────────────────────── */
.msg { padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; margin-bottom: 1rem; }
.msg-error   { background: rgba(231,76,60,0.12); border: 1px solid rgba(231,76,60,0.3); color: #e74c3c; }
.msg-success { background: rgba(63,185,80,0.12); border: 1px solid rgba(63,185,80,0.3); color: #3fb950; }

/* ── Lab split layout ──────────────────────────────────────────── */
.lab-split {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.lab-sidebar {
  width: var(--sidebar-w);
  min-width: 280px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(13,17,23,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  background: var(--accent-lt);
  color: #60a5fa;
  border: 1px solid rgba(0,120,212,0.35);
  border-radius: 20px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'SF Mono', Consolas, monospace;
}

/* ── Namespace card ─────────────────────────────────────────────── */
.ns-card {
  margin: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}

.ns-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.ns-value { font-family: 'SF Mono', Consolas, monospace; font-size: 0.85rem; color: #60a5fa; margin-bottom: 0.625rem; }
.ns-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.status-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green   { background: var(--success); box-shadow: 0 0 5px var(--success); }
.dot-grey    { background: var(--text-muted); }
.dot-blue    { background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.dot-pulse   { background: var(--warn); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Exercise tabs ──────────────────────────────────────────────── */
.day-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.day-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.day-tab:hover { background: var(--surface2); color: var(--text); }
.day-tab.active { background: var(--accent-lt); border-color: rgba(0,120,212,0.4); color: #60a5fa; }

.module-content[hidden] { display: none !important; }

/* ── Sidebar sections ──────────────────────────────────────────── */
.sidebar-section {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

.section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.625rem;
}

/* ── Day / module header ─────────────────────────────────────────── */
.day-header {
  padding: 0.75rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.day-badge {
  display: inline-block;
  background: var(--accent-lt);
  color: #60a5fa;
  border: 1px solid rgba(0,120,212,0.3);
  border-radius: 4px;
  padding: 0.08rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.day-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

/* ── Step list ─────────────────────────────────────────────────── */
.step-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.4rem;
}
.step-list li { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.step-list li strong { color: var(--text); }
.step-list pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.75rem;
  color: #a5d6ff;
  margin: 0.3rem 0 0;
  overflow-x: auto;
  white-space: pre;
}

/* ── Diagrams ───────────────────────────────────────────────────── */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem;
}
.diag-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
}
.diag-box {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.4rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text);
}
.diag-box span { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.68rem; }
.diag-blue   { background: rgba(0,120,212,0.1);  border-color: rgba(0,120,212,0.3);  color: #60a5fa; }
.diag-green  { background: rgba(63,185,80,0.1);   border-color: rgba(63,185,80,0.3);   color: #7ee787; }
.diag-orange { background: rgba(210,153,34,0.1);  border-color: rgba(210,153,34,0.3);  color: #f0b429; }
.diag-arrow  { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
.diag-modes  { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.5rem; }
.diag-mode   { display: flex; align-items: flex-start; gap: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }

/* ── Info table ─────────────────────────────────────────────────── */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.info-table td {
  padding: 0.3rem 0.4rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(48,54,61,0.5);
  vertical-align: middle;
}
.info-table td:first-child { white-space: nowrap; font-weight: 600; color: var(--text); }
.info-table tr:last-child td { border-bottom: none; }

/* ── Tag / badge ────────────────────────────────────────────────── */
.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Right pane ─────────────────────────────────────────────────── */
.lab-main {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Right-pane tabs (Guide | Terminal) ──────────────────────────── */
.right-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.rtab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.625rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.rtab:hover { color: var(--text); }
.rtab-active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Right-pane content areas ───────────────────────────────────── */
.rpane-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.rpane-content.hidden { display: none !important; }

/* terminal pane: no padding — xterm fills it fully */
#terminal-pane {
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  display: flex;
}
#terminal-pane.hidden { display: none !important; }

/* ── Terminal toolbar ───────────────────────────────────────────── */
#terminal-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;
}
.term-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  margin-right: 0.25rem;
}
.term-connected    { background: rgba(63,185,80,0.15); border: 1px solid rgba(63,185,80,0.35); color: #3fb950; }
.term-disconnected { background: rgba(139,148,158,0.15); border: 1px solid rgba(139,148,158,0.35); color: var(--text-muted); }
.term-connecting   { background: rgba(0,120,212,0.15); border: 1px solid rgba(0,120,212,0.35); color: #60a5fa; }

/* ── Terminal container ─────────────────────────────────────────── */
#terminal-container {
  flex: 1;
  background: #0d1117;
  overflow: hidden;
}
#terminal-container .xterm {
  padding: 0.5rem;
}
#terminal-container .xterm-viewport {
  background: transparent !important;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 700px;
}

.setup-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.setup-card p  { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }

.setup-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-lt);
  border: 1px solid rgba(0,120,212,0.3);
  color: #60a5fa;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.step-body { flex: 1; }
.step-body strong { font-size: 0.875rem; color: var(--text); display: block; margin-bottom: 0.3rem; }
.step-body p { font-size: 0.82rem; margin-bottom: 0.4rem; }
.step-body pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.75rem;
  color: #a5d6ff;
  overflow-x: auto;
  margin-top: 0.3rem;
}

.cluster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 700px;
}

.cluster-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.cluster-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.cluster-card .cluster-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #60a5fa;
  margin-bottom: 0.6rem;
}
.cluster-card p { font-size: 0.78rem; margin: 0; }

.hidden { display: none !important; }

/* ── Loading spinner ─────────────────────────────────────────────── */
.ring {
  width: 32px; height: 32px;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Provision status ─────────────────────────────────────────────── */
.provision-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.75rem;
  background: var(--surface2);
  border-radius: 8px;
  margin-top: 0.75rem;
}

.ex-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

/* ── Azure pane ─────────────────────────────────────────────────── */
#azure-pane {
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  display: flex;
}
#azure-pane.hidden { display: none !important; }

#azure-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.azure-toolbar-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #60a5fa;
  white-space: nowrap;
}
.azure-quicklinks {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.azure-link {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #60a5fa;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.azure-link:hover {
  background: var(--accent-lt);
  border-color: rgba(0,120,212,0.4);
}

/* Cloud Shell iframe fills remaining height */
#cloud-shell-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #000;
  display: block;
}
