/* Pre-Comp Study Guide Styles */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a24;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-dim: rgba(255, 255, 255, 0.7);
  --muted: rgba(255, 255, 255, 0.5);
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --accent-2: #60a5fa;
  --accent-3: #f472b6;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.back-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--accent);
}

.back-btn img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1) opacity(0.5);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title img {
  width: 24px;
  height: 24px;
  filter: brightness(0) saturate(100%) invert(76%) sepia(52%) saturate(497%) hue-rotate(88deg) brightness(95%) contrast(92%);
}

.header-title h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Navigation */
.nav-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  overflow-x: auto;
}

.nav-list {
  display: flex;
  gap: 8px;
  list-style: none;
}

.nav-item {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* Section */
.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Title */
.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title img {
  width: 28px;
  height: 28px;
  filter: brightness(0) saturate(100%) invert(76%) sepia(52%) saturate(497%) hue-rotate(88deg) brightness(95%) contrast(92%);
}

/* Topic Card */
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.topic-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.topic-header:hover {
  background: var(--surface-2);
}

.topic-header h3 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
}

.topic-toggle {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1) opacity(0.5);
  transition: transform 0.3s;
}

.topic-card.open .topic-toggle {
  transform: rotate(180deg);
}

.topic-card.open .topic-header {
  border-bottom: 1px solid var(--border);
}

.topic-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.topic-card.open .topic-content {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

.topic-body {
  padding: 20px;
}

/* Content Typography */
.topic-body h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 20px 0 12px;
}

.topic-body h4:first-child {
  margin-top: 0;
}

.topic-body p {
  margin-bottom: 12px;
  color: var(--text-dim);
}

.topic-body ul, .topic-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.topic-body li {
  margin-bottom: 8px;
  color: var(--text-dim);
}

.topic-body strong {
  color: var(--text);
  font-weight: 600;
}

.topic-body em {
  color: var(--accent);
  font-style: normal;
}

/* Definition List */
.def-list {
  display: grid;
  gap: 8px;
}

.def-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: 8px;
}

.def-term {
  font-weight: 600;
  color: var(--accent);
  min-width: 150px;
}

.def-desc {
  color: var(--text-dim);
}

/* Example Box */
.example-box {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}

.example-box .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}

.example-box code {
  display: block;
  font-family: 'Fira Code', monospace;
  color: var(--text);
  font-size: 0.95rem;
}

/* Formula */
.formula {
  display: inline-block;
  padding: 8px 16px;
  background: var(--surface-2);
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  color: var(--accent);
  margin: 8px 0;
}

/* Table */
.content-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.content-table th,
.content-table td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--border);
}

.content-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--accent);
}

.content-table td {
  color: var(--text-dim);
}

/* Images */
.topic-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }

  .nav-bar {
    padding: 10px 16px;
  }

  .container {
    padding: 24px 16px;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .def-item {
    flex-direction: column;
    gap: 4px;
  }

  .def-term {
    min-width: unset;
  }
}
