:root {
  --primary: #0B3D91;
  --primary-light: #1565C0;
  --accent: #00A3A3;
  --grey: #5A6470;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e3e8ef;
  --text: #1c2530;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
header {
  background: var(--primary);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
header .logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
header .logo span { color: var(--accent); }
nav a {
  color: #dce6f5;
  text-decoration: none;
  margin-left: 1.4rem;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s;
}
nav a:hover { color: white; }

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 55%, var(--accent) 100%);
  color: white;
  padding: 3.5rem 2rem;
  text-align: center;
}
.hero .eyebrow {
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #b9d4f5;
  margin-bottom: 0.6rem;
}
.hero h1 { font-size: 2.4rem; margin-bottom: 0.6rem; font-weight: 700; }
.hero p { font-size: 1.05rem; color: #e3edfb; max-width: 640px; margin: 0 auto 1.4rem; }
.hero-buttons { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
.btn-primary { background: white; color: var(--primary); }
.btn-outline { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.6); }

main { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.5rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(11,61,145,0.10);
  transform: translateY(-3px);
  border-color: var(--primary-light);
}
.card .icon { font-size: 1.6rem; margin-bottom: 0.5rem; display: block; }
.card h3 { color: var(--primary); margin-bottom: 0.4rem; font-size: 1.08rem; }
.card p { font-size: 0.92rem; color: var(--grey); }
.tag {
  display: inline-block;
  background: #e6f0fb;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-top: 0.6rem;
}

article h1 { color: var(--primary); margin-bottom: 0.8rem; font-size: 1.9rem; }
article h2 { color: var(--primary); margin: 1.6rem 0 0.6rem; font-size: 1.3rem; border-left: 4px solid var(--accent); padding-left: 0.6rem; }
article p { margin-bottom: 0.8rem; }
article ul, article ol { margin: 0.5rem 0 1rem 1.5rem; }
article li { margin-bottom: 0.4rem; }
code {
  background: #eef2f7;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
  color: #b3261e;
}
.diagram {
  background: #0B3D91;
  color: #d6e6fb;
  border-radius: 8px;
  padding: 1.2rem;
  margin: 1rem 0;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.88rem;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.2rem;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.back-link:hover { text-decoration: underline; }

footer {
  text-align: center;
  padding: 2rem;
  color: var(--grey);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  background: var(--card);
}

.section-title {
  font-size: 1.5rem;
  color: var(--primary);
  margin-top: 2.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

/* Quiz styles */
.quiz-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  margin: 1rem 0;
}
.quiz-q { font-weight: 600; margin-bottom: 0.7rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-options button {
  text-align: left;
  background: #f4f6f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-options button:hover { background: #e6f0fb; border-color: var(--primary-light); }
.quiz-options button.correct { background: #e3f7e8; border-color: #34a853; color: #1e6b32; }
.quiz-options button.incorrect { background: #fdeaea; border-color: #ea4335; color: #a52822; }
.quiz-feedback { margin-top: 0.6rem; font-size: 0.9rem; font-weight: 600; }

/* Search bar */
.search-wrap { position: relative; margin-left: 1.4rem; }
.search-wrap input {
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 0.88rem;
  width: 160px;
  outline: none;
}
.search-wrap input::placeholder { color: #cdddf2; }
.search-wrap input:focus { background: rgba(255,255,255,0.22); width: 200px; transition: width 0.2s; }
#search-results {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  min-width: 220px;
  z-index: 20;
  overflow: hidden;
}
.search-item {
  display: block;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #e6f0fb; }

/* Chatbot */
#chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 30;
}
#chatbot-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 5.2rem;
  right: 1.5rem;
  width: 300px;
  height: 380px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
  overflow: hidden;
  z-index: 30;
  border: 1px solid var(--border);
}
#chatbot-panel .chat-header {
  background: var(--primary);
  color: white;
  padding: 0.8rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-msg {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.86rem;
  max-width: 85%;
  line-height: 1.4;
}
.chat-msg.bot { background: #eef2f7; align-self: flex-start; }
.chat-msg.user { background: var(--primary); color: white; align-self: flex-end; }
.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  border: none;
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  outline: none;
}
.chat-input-row button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 1rem;
  cursor: pointer;
  font-weight: 600;
}

/* Lab terminal */
.terminal {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.88rem;
  min-height: 160px;
  margin-bottom: 0.8rem;
  white-space: pre-wrap;
  overflow-x: auto;
}
.terminal .prompt { color: #4ec9b0; }
.lab-input-row { display: flex; gap: 0.5rem; }
.lab-input-row input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.9rem;
}
.lab-input-row button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
}
