@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --black:          #1A1A1A;
  --yellow:         #FAE428;
  --yellow-light:   #FEF8C9;
  --beige-mid:      #E4E2DE;
  --beige:          #D4D0CB;
  --beige-light:    #F1F0EE;
  --violet:         #ABA0FB;
  --violet-light:   #EAE7FE;

  --primary:        var(--black);
  --accent:         var(--yellow);
  --accent-light:   var(--yellow-light);
  --bg:             var(--beige-light);
  --surface:        #ffffff;
  --text:           var(--black);
  --text-muted:     #6b6b6b;
  --border:         var(--beige-mid);
  --sidebar-width:  280px;
  --radius:         8px;
  --shadow:         0 1px 4px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── HEADER ── */
header {
  background: var(--black);
  color: white;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
}

.header-logo {
  width: 34px;
  height: 34px;
  background: var(--yellow);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--black);
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.header-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.header-subtitle {
  font-size: 0.7rem;
  opacity: 0.55;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}

.header-right a:hover { color: var(--yellow); }

/* ── LAYOUT ── */
.layout {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 60px;
  bottom: 0;
  overflow-y: auto;
  padding: 1.5rem 0;
}

.sidebar-section {
  padding: 0 1rem 1.5rem;
}

.sidebar-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  line-height: 1.4;
}

.sidebar-item:hover {
  background: var(--beige-light);
  color: var(--black);
}

.sidebar-item.active {
  background: var(--yellow-light);
  color: var(--black);
  font-weight: 700;
}

.sidebar-item .mod-badge {
  background: var(--black);
  color: var(--yellow);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.sidebar-item.active .mod-badge {
  background: var(--yellow);
  color: var(--black);
}

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 900px;
}

.main img,
#content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.25rem auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ── HERO ── */
.hero {
  background: var(--black);
  color: white;
  border-radius: 12px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: var(--violet);
  border-radius: 50%;
  opacity: 0.12;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 60px;
  width: 160px; height: 160px;
  background: var(--yellow);
  border-radius: 50%;
  opacity: 0.1;
}

.hero-tag {
  display: inline-block;
  background: rgba(250,228,40,0.15);
  color: var(--yellow);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1rem;
  border: 1px solid rgba(250,228,40,0.3);
}

.hero h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.hero h1 span { color: var(--yellow); }

.hero p {
  font-size: 0.95rem;
  opacity: 0.8;
  max-width: 520px;
  line-height: 1.65;
  font-weight: 400;
}

/* ── SECTION TITLE ── */
.section-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── INFO CARDS ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.info-card-icon { font-size: 1.4rem; }

.info-card-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.info-card-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--black);
}

/* ── MODULE GRID ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
}

.module-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: var(--yellow);
  transform: translateY(-2px);
}

.module-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.module-num {
  background: var(--black);
  color: var(--yellow);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.module-card-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--black);
}

.module-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  font-weight: 400;
}

/* ── MARKDOWN CONTENT ── */
.md-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.md-content h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--yellow);
}

.md-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--black);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.md-content h3 {
  font-size: 0.95rem;
  color: var(--black);
  margin: 1.5rem 0 0.5rem;
  font-weight: 700;
}

.md-content p { margin-bottom: 1rem; font-size: 0.9rem; }

.md-content ul, .md-content ol {
  margin: 0.5rem 0 1rem 1.5rem;
  font-size: 0.9rem;
}

.md-content li { margin-bottom: 0.35rem; }

.md-content code {
  background: var(--beige-light);
  border: 1px solid var(--beige-mid);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.82em;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--black);
  font-weight: 600;
}

.md-content pre {
  background: var(--black);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  border-left: 3px solid var(--yellow);
}

.md-content pre code {
  background: none;
  border: none;
  color: #f1f0ee;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 400;
}

.md-content blockquote {
  border-left: 3px solid var(--violet);
  background: var(--violet-light);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  color: var(--black);
  font-size: 0.875rem;
}

.md-content blockquote p { margin: 0; }

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.md-content th {
  background: var(--black);
  color: var(--yellow);
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.md-content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.md-content tr:nth-child(even) td { background: var(--beige-light); }

.md-content a { color: var(--black); font-weight: 600; }
.md-content a:hover { color: var(--violet); }

.md-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── NAV BUTTONS ── */
.mod-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
}

.mod-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--black);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Montserrat', sans-serif;
}

.mod-nav-btn:hover {
  background: var(--yellow-light);
  border-color: var(--yellow);
}

.mod-nav-btn.primary {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

.mod-nav-btn.primary:hover {
  background: #f0d800;
  border-color: #f0d800;
}

/* ── LOADING ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--beige-mid);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.5rem; }
  .module-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.35rem; }
  .md-content { padding: 1.5rem; }
}

/* ── QUIZ STYLES ── */
#quiz-container {
  margin: 1.5rem 0;
}

.quiz-question {
  margin: 0;
}

.quiz-question-header {
  margin-bottom: 0.75rem;
}

.quiz-question-num {
  display: inline-block;
  background: var(--violet);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.quiz-question-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1rem;
}

.quiz-options {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.quiz-options li {
  margin: 0.4rem 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
  overflow: hidden;
}

.quiz-options li:hover {
  background: var(--yellow-light);
  border-color: var(--yellow);
}

.quiz-options li.opt-correct {
  background: #d4f4dd !important;
  border-color: #4caf50 !important;
}

.quiz-options li.opt-wrong {
  background: #ffd4d4 !important;
  border-color: #f44336 !important;
}

.quiz-options input[type="radio"] {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--violet);
}

.quiz-options label {
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  user-select: none;
}

.opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--beige-mid);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.quiz-check-btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  background: var(--violet);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-bottom: 0.75rem;
}

.quiz-check-btn:hover:not(:disabled) {
  background: #9b8ffb;
  transform: translateY(-1px);
}

.quiz-check-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.quiz-feedback {
  display: none;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.6;
  animation: fadeIn 0.25s ease;
}

.quiz-feedback.feedback-warning {
  background: #fff8e1;
  border: 2px solid #ffc107;
  color: #7a5c00;
  font-weight: 600;
}

.quiz-feedback.feedback-correct {
  background: #d4f4dd;
  border: 2px solid #4caf50;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.quiz-feedback.feedback-incorrect {
  background: #ffd4d4;
  border: 2px solid #f44336;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.fb-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

.quiz-divider {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 2rem 0;
}

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