
/* ==========================================================================
   Obsidian Primary Theme — Optimized for FellowMCQ
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Karla", system-ui, sans-serif;
  --font-serif: "Charter", "Bitstream Charter", "Sitka Text", "Cambria", serif;
}

/* Light Theme Variables (Primary Theme Warm Parchment) */
html.theme-light {
  --bg-primary: #fcfbf8;
  --bg-secondary: #f4ede2;
  --bg-card: #ffffff;
  --border-color: #e6dcce;
  --border-light: #ece3d7;
  --text-primary: #382b22;
  --text-secondary: #6e5e52;
  --text-muted: #948477;
  
  --heading-color: #382721;
  --lead-concept: #b84e3a;
  --qid-gold: #b7791f;
  
  --highlight-bg: rgba(78, 178, 210, 0.22);
  --highlight-text: #0d2847;
  --highlight-border: rgba(78, 178, 210, 0.45);
  
  --accent: #b84e3a;
  --accent-soft: rgba(184, 78, 58, 0.1);
  --sidebar-bg: #f7f2ea;
  
  --callout-answer-bg: rgba(16, 185, 129, 0.08);
  --callout-answer-border: #10b981;
  --callout-pearl-bg: rgba(245, 158, 11, 0.08);
  --callout-pearl-border: #f59e0b;
  --callout-diff-bg: rgba(139, 92, 246, 0.08);
  --callout-diff-border: #8b5cf6;
  --callout-nelson-bg: rgba(59, 130, 246, 0.08);
  --callout-nelson-border: #3b82f6;
}

/* Dark Theme Variables (Primary Theme Warm Charcoal) */
html.theme-dark {
  --bg-primary: #201d1a;
  --bg-secondary: #27231f;
  --bg-card: #2b2723;
  --border-color: #3d362e;
  --border-light: #342e27;
  --text-primary: #dcd4cb;
  --text-secondary: #a99d91;
  --text-muted: #7d7266;
  
  --heading-color: #f2ece4;
  --lead-concept: #e26d5c;
  --qid-gold: #e5b958;
  
  --highlight-bg: rgba(78, 178, 210, 0.16);
  --highlight-text: #4eb2d2;
  --highlight-border: rgba(78, 178, 210, 0.32);
  
  --accent: #e26d5c;
  --accent-soft: rgba(226, 109, 92, 0.15);
  --sidebar-bg: #1a1715;
  
  --callout-answer-bg: rgba(16, 185, 129, 0.12);
  --callout-answer-border: #10b981;
  --callout-pearl-bg: rgba(245, 158, 11, 0.12);
  --callout-pearl-border: #f59e0b;
  --callout-diff-bg: rgba(139, 92, 246, 0.12);
  --callout-diff-border: #8b5cf6;
  --callout-nelson-bg: rgba(59, 130, 246, 0.12);
  --callout-nelson-border: #3b82f6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.68;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 310px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--heading-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
}

.search-input {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input:focus {
  border-color: var(--accent);
}

.nav-subject {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-topic-list {
  list-style: none;
  padding: 0 0.5rem 0.5rem;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-link.active {
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-count {
  font-size: 0.75rem;
  background-color: var(--border-color);
  color: var(--text-secondary);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 500;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 310px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
}

.breadcrumbs {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--accent);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}
.theme-toggle-btn:hover {
  border-color: var(--accent);
}

/* Content Container */
.content-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

/* Header & Module Title */
.module-header {
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.module-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--heading-color);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.module-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Tabs */
.view-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.tab-btn.active {
  background-color: var(--accent-soft);
  color: var(--accent);
}

/* Concept Notes Section */
.concept-section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}

.concept-list {
  list-style: none;
}

.concept-item {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 1.2rem;
  line-height: 1.75;
}

.concept-item::before {
  content: "•";
  position: absolute;
  left: 0.2rem;
  top: 0;
  color: var(--lead-concept);
  font-size: 1.4rem;
  line-height: 1.4;
}

.concept-lead {
  color: var(--lead-concept);
  font-weight: 600;
}

/* Exact Highlight Pill styling matching Images */
mark.pill-highlight {
  display: inline;
  background-color: var(--highlight-bg) !important;
  color: var(--highlight-text) !important;
  border: 1px solid var(--highlight-border);
  border-radius: 9999px;
  padding: 0.12em 0.55em;
  margin: 0 0.12em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 500;
  line-height: inherit;
}

/* QID Gold Links matching Images */
a.qid-badge {
  color: var(--qid-gold);
  font-weight: 600;
  text-decoration: none;
  padding: 0 0.15em;
  transition: opacity 0.15s ease;
}
a.qid-badge:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* Interactive Question Cards (MCQ Tab) */
.mcq-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  scroll-margin-top: 5rem;
}

.mcq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.mcq-qid {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--bg-secondary);
  color: var(--qid-gold);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.mcq-stem {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.mcq-options {
  list-style: none;
  margin-bottom: 1.25rem;
}

.mcq-option-item {
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.95rem;
}

/* Foldable Answer Box */
.answer-fold {
  border: 1px solid var(--callout-answer-border);
  background: var(--callout-answer-bg);
  border-radius: 8px;
  overflow: hidden;
}

.answer-fold summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #10b981;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.answer-details {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  font-size: 0.95rem;
}

.callout-box {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.callout-pearl {
  background: var(--callout-pearl-bg);
  border-left: 4px solid var(--callout-pearl-border);
}
.callout-pearl-title {
  color: #f59e0b;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.callout-diff {
  background: var(--callout-diff-bg);
  border-left: 4px solid var(--callout-diff-border);
}
.callout-diff-title {
  color: #8b5cf6;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.callout-nelson {
  background: var(--callout-nelson-bg);
  border-left: 4px solid var(--callout-nelson-border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
  }
}
