/* =========================================================
   Noctua — Shared Lab Guide Stylesheet
   Used by all lab-s1-unitX.html and lab-s2-unitX.html pages
   ========================================================= */

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === DESIGN TOKENS === */
:root {
  --bg: #0b0f19; --bg-card: #121929; --bg-sidebar: #060a14; --bg-code: #0f1525;
  --border: #2a3045; --text: #e8dcc8; --text-muted: #9a8e7a;
  --accent: #d4a017; --accent-hover: #f0c040; --accent-bg: rgba(212,160,23,0.10);
  --green: #50c878; --orange: #e67e22; --red: #e74c3c;
  --purple: #a78bfa; --teal: #2dd4bf;
  --table-header: #151d30; --table-row-alt: #121929;
}
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; font-size: 16px; display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar { width: 280px; min-width: 280px; background: var(--bg-sidebar); border-right: 1px solid rgba(212,160,23,0.15); padding: 24px 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; transition: transform 0.3s ease; }
.sidebar-header { padding: 0 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-header h1 { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.3px; text-shadow: 0 0 12px rgba(212,160,23,0.4); }
.sidebar-header p { font-size: 12px; color: var(--text-muted); margin-top: 4px; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 16px 20px 6px; }
.sidebar a { display: block; padding: 8px 20px 8px 28px; color: var(--text-muted); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; transition: all 0.15s ease; }
.sidebar a.sub { padding-left: 42px; font-size: 13px; }
.sidebar a:hover { color: var(--text); background: var(--accent-bg); }
.sidebar a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.menu-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 18px; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }

/* === MAIN LAYOUT === */
.main { margin-left: 280px; flex: 1; min-width: 0; }
.content { max-width: 900px; margin: 0 auto; padding: 40px 48px 80px; }

/* === TYPOGRAPHY === */
.content h1 { font-size: 32px; font-weight: 700; color: var(--text); margin: 0 0 8px; padding-bottom: 12px; border-bottom: 2px solid var(--accent); letter-spacing: -0.5px; }
.content h2 { font-size: 24px; font-weight: 600; color: var(--text); margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 1px solid rgba(212,160,23,0.3); }
.content h3 { font-size: 20px; font-weight: 600; color: var(--accent); margin: 32px 0 12px; }
.content h4 { font-size: 16px; font-weight: 600; color: var(--teal); margin: 24px 0 8px; }
.content h5 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.8px; }
.content p { margin: 0 0 16px; }
.content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
.content a:hover { border-bottom-color: var(--accent); }
.content ul, .content ol { margin: 0 0 16px 24px; }
.content li { margin-bottom: 6px; }
.content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.content code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; background: var(--bg-code); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }
.content pre { background: var(--bg-code); border: 1px solid var(--border); border-radius: 8px; padding: 18px 24px; overflow-x: auto; margin: 20px 0; line-height: 1.5; }
.content pre code { background: none; border: none; padding: 0; font-size: 13px; }

/* === CALLOUTS === */
.callout { padding: 16px 24px; margin: 20px 0; border-radius: 0 8px 8px 0; border-left: 4px solid; font-size: 14px; line-height: 1.7; }
.callout p { margin: 0; }
.callout-key  { border-color: var(--accent); background: rgba(212,160,23,0.08); }
.callout-tip  { border-color: var(--green); background: rgba(80,200,120,0.08); }
.callout-warn { border-color: var(--orange); background: rgba(230,126,34,0.08); }
.callout-reading { border-color: var(--teal); background: rgba(45,212,191,0.06); }
.callout-info { border-color: var(--purple); background: rgba(167,139,250,0.06); }
.callout-discuss { border-color: #a78bfa; background: rgba(167,139,250,0.08); }

/* === PROGRESS BAR === */
.lab-progress { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin-bottom: 32px; }
.lab-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lab-progress-header span { font-size: 13px; font-weight: 600; color: var(--accent); }
#prog-text { font-size: 13px; color: var(--text-muted); }
.prog-bar-track { height: 8px; background: rgba(212,160,23,0.15); border-radius: 4px; }
.prog-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease; width: 0%; }

/* === WEEK BADGES === */
.week-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.week-badge { background: var(--accent-bg); color: var(--accent); border: 1px solid rgba(212,160,23,0.3); padding: 3px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; white-space: nowrap; }
.week-sub { color: var(--text-muted); font-size: 14px; }

/* === QUIZ BLOCKS === */
.quiz-block { background: var(--bg-card); border: 1px solid rgba(45,212,191,0.25); border-radius: 8px; padding: 20px 24px; margin: 24px 0; }
.quiz-block > h4 { color: var(--teal); margin: 0 0 4px; font-size: 15px; }
.quiz-block > .quiz-intro { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.quiz-question { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.quiz-question:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.quiz-question .q-text { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; line-height: 1.5; }
.quiz-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.quiz-opts label { display: flex; align-items: flex-start; gap: 9px; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 14px; border: 1px solid var(--border); transition: all 0.15s; line-height: 1.4; }
.quiz-opts label:hover { background: var(--accent-bg); border-color: rgba(212,160,23,0.3); }
.quiz-opts input[type=radio] { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); }
.quiz-opts label.opt-correct { background: rgba(80,200,120,0.12); border-color: var(--green); color: var(--green); }
.quiz-opts label.opt-wrong   { background: rgba(231,76,60,0.10); border-color: var(--red); color: #f08080; }
.quiz-feedback { font-size: 13px; padding: 8px 12px; border-radius: 4px; margin-top: 6px; display: none; line-height: 1.5; }
.quiz-feedback.show { display: block; }
.quiz-feedback.fb-correct { background: rgba(80,200,120,0.1); color: var(--green); border-left: 3px solid var(--green); }
.quiz-feedback.fb-wrong   { background: rgba(231,76,60,0.08); color: #f08080; border-left: 3px solid var(--red); }
.quiz-feedback.fb-warn    { background: var(--accent-bg); color: var(--accent); border-left: 3px solid var(--accent); }
.quiz-check-btn { margin-top: 8px; background: var(--teal); color: #0b0f19; border: none; padding: 7px 18px; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 13px; transition: opacity 0.15s; }
.quiz-check-btn:hover { opacity: 0.85; }
.quiz-check-btn:disabled { opacity: 0.4; cursor: default; }

/* === LAB STEPS === */
.lab-section { background: var(--bg-card); border: 1px solid rgba(212,160,23,0.2); border-radius: 8px; padding: 20px 24px; margin: 20px 0; }
.lab-section > h4 { color: var(--accent); margin: 0 0 14px; font-size: 15px; }
.lab-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.lab-step { border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; transition: all 0.2s; }
.lab-step.step-done { border-color: var(--green); background: rgba(80,200,120,0.05); }
.lab-step label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.lab-step input[type=checkbox] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; accent-color: var(--green); }
.step-content { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.lab-step.step-done .step-title { color: var(--text-muted); text-decoration: line-through; }
.step-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* === CODE COPY BLOCKS === */
.code-block { position: relative; margin: 10px 0; }
.code-block pre { margin: 0; }
.copy-btn { position: absolute; top: 8px; right: 8px; background: rgba(212,160,23,0.15); color: var(--accent); border: 1px solid rgba(212,160,23,0.3); padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.copy-btn:hover { background: rgba(212,160,23,0.28); }

/* === COLLAPSIBLE CODE BLOCKS === */
.code-toggle { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px 6px 0 0; padding: 7px 12px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-muted); transition: background 0.15s, color 0.15s; border-bottom: none; }
.code-toggle:hover { background: var(--border-light, #3a4060); color: var(--text); }
.code-toggle:hover .toggle-pill { background: rgba(212,160,23,0.28); }
.toggle-arrow { font-size: 10px; color: var(--accent); min-width: 10px; }
.toggle-label { flex: 1; font-family: var(--font-mono, monospace); }
.toggle-lines { font-size: 11px; color: var(--text-muted); opacity: 0.7; margin-right: 8px; }
.toggle-pill { background: rgba(212,160,23,0.15); color: var(--accent); border: 1px solid rgba(212,160,23,0.3); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-family: inherit; white-space: nowrap; transition: background 0.15s; }
.code-block[data-collapsible][data-collapsed="true"] .code-toggle { border-radius: 0 6px 6px 0; border-bottom: 1px solid var(--border); }
.code-block[data-collapsible][data-collapsed="true"] pre { display: none; }
.code-block[data-collapsible][data-collapsed="true"] .copy-btn { display: none; }

/* === CONVERSATION STARTERS (copyable callout prompts) === */
.conversation-starter { position: relative; background: rgba(45,212,191,0.06); border: 1px solid rgba(45,212,191,0.2); border-left: 3px solid var(--teal); border-radius: 0 6px 6px 0; padding: 10px 52px 10px 14px; margin: 10px 0; font-size: 13px; line-height: 1.6; font-style: italic; color: var(--text); }
.conversation-starter .copy-btn { top: 6px; right: 6px; }

/* === DELIVERABLES === */
.deliverables { background: rgba(167,139,250,0.06); border-left: 3px solid var(--purple); border-radius: 0 6px 6px 0; padding: 14px 18px; margin: 18px 0; }
.deliverables h5 { color: var(--purple); margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.deliverables li { font-size: 14px; margin-bottom: 6px; }

/* === UNIT COMPLETION === */
.unit-complete { text-align: center; padding: 40px 20px; border: 2px solid var(--accent); border-radius: 12px; margin: 40px 0; background: var(--accent-bg); }
.unit-complete h3 { color: var(--accent); font-size: 22px; margin-bottom: 8px; }
.unit-complete p { color: var(--text-muted); font-size: 14px; }
.unit-complete a { color: var(--accent); font-weight: 600; }

/* === TABLES === */
.content table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.content thead { background: var(--table-header); }
.content th { text-align: left; padding: 10px 14px; font-weight: 600; color: var(--text); border-bottom: 2px solid var(--border); font-size: 13px; }
.content td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.content tbody tr:nth-child(even) { background: var(--table-row-alt); }

/* === SCENARIO BOX === */
.scenario-box { background: rgba(167,139,250,0.06); border: 1px solid rgba(167,139,250,0.2); border-radius: 8px; padding: 16px 20px; margin: 16px 0; font-size: 14px; }
.scenario-box strong { color: var(--purple); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); } .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; } .menu-toggle { display: block; }
  .main { margin-left: 0; } .content { padding: 60px 20px 60px; }
  .content h1 { font-size: 26px; } .content h2 { font-size: 20px; }
}

/* === SITE SEARCH === */
.search-wrap { padding: 12px 16px 4px; position: relative; }
.search-wrap input { width: 100%; background: #0b1020; border: 1px solid rgba(212,160,23,0.3); border-radius: 6px; color: var(--text); font-size: 13px; font-family: inherit; padding: 7px 10px; outline: none; transition: border-color 0.15s; }
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap input:focus { border-color: var(--accent); }
#site-search-results { display: none; position: absolute; top: calc(100% - 4px); left: 16px; right: 16px; background: #0d1525; border: 1px solid rgba(212,160,23,0.35); border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.7); z-index: 9999; max-height: 380px; overflow-y: auto; }
#site-search-results.open { display: block; }
.ssr-item { display: block; padding: 9px 14px; border-bottom: 1px solid #1a2035; text-decoration: none; color: inherit; }
.ssr-item:last-child { border-bottom: none; }
.ssr-item:hover { background: rgba(212,160,23,0.08); }
.ssr-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.ssr-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.ssr-tag { display: inline-block; font-size: 10px; background: rgba(212,160,23,0.1); border: 1px solid rgba(212,160,23,0.25); color: var(--accent); border-radius: 3px; padding: 1px 5px; margin-top: 3px; margin-right: 3px; }
.ssr-empty { padding: 12px 14px; color: var(--text-muted); font-size: 12px; text-align: center; }

/* === ELEMENTS APPENDED TO BODY BY main.js ===
   body is display:flex — anything appended to it becomes a flex item and
   breaks the layout unless given position:fixed to pull it out of flow.   */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 999; pointer-events: none; transition: width 0.1s linear; }
.back-to-top { position: fixed; bottom: 32px; right: 24px; z-index: 200; width: 36px; height: 36px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 16px; display: none; align-items: center; justify-content: center; transition: opacity 0.2s; }
.back-to-top.visible { display: flex; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(212,160,23,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,160,23,0.45); }

/* === ON-PAGE NAV (created by main.js on pages with 3+ h2s) === */
/* Must be position:fixed or it collapses the flex layout */
.page-nav { position: fixed; top: 100px; right: 24px; width: 180px; max-height: calc(100vh - 140px); overflow-y: auto; font-size: 12px; z-index: 50; }
.page-nav-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.page-nav a { display: block; padding: 4px 0 4px 12px; color: var(--text-muted); text-decoration: none; border-left: 2px solid var(--border); transition: all 0.15s; line-height: 1.4; }
.page-nav a:hover, .page-nav a.active { color: var(--accent); border-left-color: var(--accent); }
/* Hide when viewport too narrow — sidebar already handles navigation */
@media (max-width: 1400px) { .page-nav { display: none; } }

/* Lucide icon alignment */
.licon {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
