/* ===== Shared Demo Page Styles =====
   Used by all styled demo pages under Instructions/Demos/
   Source of truth — edit here to update all demos.
*/

:root {
  --primary: #0078D4;
  --primary-dark: #005A9E;
  --primary-light: #DEECF9;
  --accent: #107C10;
  --accent-light: #DFF6DD;
  --warn: #D83B01;
  --warn-light: #FED9CC;
  --purple: #5C2D91;
  --purple-light: #E8DAEF;
  --neutral-900: #201F1E;
  --neutral-700: #323130;
  --neutral-500: #605E5C;
  --neutral-300: #A19F9D;
  --neutral-100: #F3F2F1;
  --white: #FFFFFF;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--neutral-700);
  line-height: 1.6;
  background: var(--neutral-100);
}

.back-bar {
  background: var(--white);
  border-bottom: 1px solid #E0E0E0;
  padding: 0.5rem 1.5rem;
  font-size: 0.88rem;
}
.back-bar a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.back-bar a:hover { text-decoration: underline; }

/* Hero — each demo overrides --hero-from / --hero-via for its own gradient */
.hero {
  background: linear-gradient(135deg, var(--hero-from, #1B5E20) 0%, var(--hero-via, #2E7D32) 40%, var(--hero-to, #0078D4) 100%);
  color: var(--white);
  padding: 3rem 2rem 2.5rem;
  position: relative; overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; top: -40%; right: -10%;
  width: 500px; height: 500px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.hero-inner { max-width: 960px; margin: 0 auto; position: relative; z-index: 1; }
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.4rem; }
.hero .subtitle { font-size: 1.1rem; opacity: 0.9; margin-bottom: 0.5rem; }
.hero .scenario {
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.hero-meta {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.9rem; opacity: 0.85;
}
.hero-meta span { display: flex; align-items: center; gap: 0.4rem; }

.layout {
  display: flex;
  max-width: 1260px;
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid #E0E0E0;
  padding: 1rem 0;
  font-size: 0.84rem;
  z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: 4px; }

.sidebar .sb-home {
  display: block;
  padding: 0.5rem 1.25rem 0.75rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--neutral-100);
  margin-bottom: 0.5rem;
}
.sidebar .sb-home:hover { text-decoration: underline; }

.sidebar .sb-title {
  padding: 0.4rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--neutral-900);
}

.sidebar a {
  display: block;
  padding: 0.35rem 1.25rem;
  color: var(--neutral-500);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.sidebar a:hover { color: var(--neutral-900); background: var(--neutral-100); }
.sidebar a.active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
  background: var(--primary-light);
}
.sidebar a.part-link {
  font-weight: 600;
  color: var(--neutral-700);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--neutral-100);
}
.sidebar a.section-link {
  color: var(--neutral-700);
  font-weight: 500;
  margin-top: 0.35rem;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2rem 4rem;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 200;
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: background 0.2s;
}
.sidebar-toggle:hover { background: var(--primary-dark); }

.section {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem; margin-bottom: 1.5rem;
}
.section h2 {
  font-size: 1.35rem; font-weight: 700;
  color: var(--neutral-900); margin-bottom: 1rem;
}
.section h3 {
  font-size: 1.1rem; font-weight: 600;
  color: var(--neutral-700); margin: 1.5rem 0 0.75rem;
}
.section p { margin-bottom: 0.75rem; }

.objectives-list { list-style: none; padding: 0; }
.objectives-list li {
  padding: 0.6rem 0 0.6rem 2rem; position: relative;
  border-bottom: 1px solid var(--neutral-100);
}
.objectives-list li:last-child { border-bottom: none; }
.objectives-list li::before {
  content: '✓'; position: absolute; left: 0; top: 0.6rem;
  width: 22px; height: 22px; background: var(--accent-light);
  color: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}

.prereq-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.prereq-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.75rem; background: var(--neutral-100);
  border-radius: 6px; font-size: 0.9rem;
}
.prereq-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.prereq-icon.blue { background: var(--primary-light); color: var(--primary); }
.prereq-icon.green { background: var(--accent-light); color: var(--accent); }
.prereq-icon.purple { background: var(--purple-light); color: var(--purple); }

.part-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
  overflow: hidden;
}
.part-header-bar { height: 5px; width: 100%; background: var(--primary); }
.part-header-bar.blue    { background: #0078D4; }
.part-header-bar.green   { background: #107C10; }
.part-header-bar.purple  { background: #5C2D91; }
.part-header-bar.orange  { background: #D83B01; }
.part-header-bar.teal    { background: #008272; }
.part-header-bar.navy    { background: #2B579A; }
.part-header-bar.magenta { background: #B4009E; }

.part-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem; cursor: pointer; user-select: none;
}
.part-header:hover { background: var(--neutral-100); }
.part-header h2 { margin: 0; font-size: 1.25rem; }
.part-header .toggle-icon {
  font-size: 1.4rem; color: var(--neutral-500);
  transition: transform 0.3s;
}
.part-header .toggle-icon.open { transform: rotate(180deg); }
.part-body { padding: 0 2rem 2rem; }
.part-body.collapsed { display: none; }

.part-body h3 {
  font-size: 1.1rem; font-weight: 600;
  color: var(--neutral-700); margin: 1.5rem 0 0.75rem;
  scroll-margin-top: 1rem;
}
.part-body p { margin-bottom: 0.75rem; }

.prompt-box {
  position: relative; background: #1E1E1E; color: #D4D4D4;
  border-radius: 6px; padding: 1rem 2.75rem 1rem 1.25rem;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.88rem; line-height: 1.7;
  margin: 0.75rem 0 1rem; white-space: pre-wrap; word-wrap: break-word;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.1); border: none;
  color: #D4D4D4; padding: 4px 10px; border-radius: 4px;
  font-size: 0.75rem; cursor: pointer; transition: background 0.2s;
}
.copy-btn:hover { background: rgba(255,255,255,0.25); }
.copy-btn.copied { background: var(--accent); color: var(--white); }

.callout {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 0.85rem 1rem; border-radius: 0 6px 6px 0;
  margin: 1rem 0; font-size: 0.92rem;
}
.callout.green  { border-left-color: var(--accent); background: var(--accent-light); }
.callout.warn   { border-left-color: var(--warn);   background: var(--warn-light); }
.callout.purple { border-left-color: var(--purple); background: var(--purple-light); }
.callout strong { font-weight: 600; }

.steps { counter-reset: step; padding-left: 0; list-style: none; margin: 1rem 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 0.5rem 0 0.5rem 2.5rem; margin-bottom: 0.5rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.45rem;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}

.self-check {
  background: var(--accent-light); border-radius: 6px;
  padding: 1rem 1.25rem; margin: 1.5rem 0 0.5rem;
}
.self-check h4 { color: var(--accent); margin-bottom: 0.5rem; font-size: 0.95rem; }
.self-check label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; margin-bottom: 0.3rem; cursor: pointer;
}
.self-check input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.tips-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.tips-list li {
  padding: 0.3rem 0 0.3rem 1.5rem; position: relative; font-size: 0.92rem;
}
.tips-list li::before { content: '💡'; position: absolute; left: 0; top: 0.3rem; }

.takeaways-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin: 1rem 0;
}
.takeaway-card {
  background: var(--neutral-100); border-radius: var(--radius);
  padding: 1.25rem; text-align: center;
}
.takeaway-card .icon { font-size: 2rem; margin-bottom: 0.5rem; }
.takeaway-card h4 { font-size: 0.95rem; margin-bottom: 0.4rem; color: var(--neutral-900); }
.takeaway-card p { font-size: 0.85rem; color: var(--neutral-500); }

footer.demo-footer {
  text-align: center; padding: 2rem; font-size: 0.85rem;
  color: var(--neutral-500); border-top: 1px solid var(--neutral-300);
  margin-top: 2rem;
}

img.demo-img { max-width: 100%; border-radius: 6px; margin: 0.5rem 0; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 270px;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    z-index: 300;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 250;
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .main-content { padding: 1.5rem 1.25rem 3rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-meta { flex-direction: column; gap: 0.5rem; }
  .part-header { padding: 1rem 1.25rem; }
  .part-body { padding: 0 1.25rem 1.5rem; }
  .takeaways-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .sidebar-toggle, .sidebar-overlay, .back-bar { display: none !important; }
  .main-content { padding: 0; }
  .part-body.collapsed { display: block !important; }
}

[id] { scroll-margin-top: 1rem; }
