/* =============================================
   LocEssentials Course — course.css
   Brand: Pink #ef91c6 / Blues / Alabaster bg
   Aesthetic: Premium, light, generous spacing
   ============================================= */



/* === Variables === */
:root {
  --pink:        #ef91c6;
  --blue-light:  #50A5E6;
  --blue-mid:    #2b7bb9;
  --blue-dark:   #1c6399;
  --green-neon:  #60ff6c;
  --alabaster:   #F5F7F9;
  --white:       #ffffff;
  --ink:         #1a1a2e;
  --ink-muted:   #4a4a6a;
  --border:      #e2e6ed;

  --sidebar-width: 320px;
  --topbar-height: 60px;

  --font-display: Arial, sans-serif;
  --font-body:    Arial, sans-serif;

  --radius:   8px;
  --shadow:   0 2px 12px rgba(28, 99, 153, 0.08);
  --shadow-md: 0 4px 24px rgba(28, 99, 153, 0.13);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: 300;
  background: var(--alabaster);
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
}

/* === Topbar === */
#topbar {
  grid-area: topbar;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

#topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

#topbar-logo img {
  height: 36px;
  width: auto;
}

#topbar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--blue-dark);
  letter-spacing: 0.01em;
}

#topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language Toggle */
#lang-toggle {
  display: flex;
  align-items: center;
  background: var(--alabaster);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-muted);
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--blue-mid);
  color: var(--white);
  box-shadow: 0 1px 4px rgba(43, 123, 185, 0.3);
}

.lang-btn:hover:not(.active) {
  background: var(--pink);
  color: var(--white);
}

/* === Sidebar === */
#sidebar {
  grid-area: sidebar;
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  height: calc(100vh - var(--topbar-height));
  position: sticky;
  top: var(--topbar-height);
  padding: 1.5rem 0 2rem;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 1.5rem;
  margin: 1.25rem 0 0.5rem;
}

.sidebar-section-label:first-child {
  margin-top: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 1.5rem;
}

/* Nav links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--ink-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-link .nav-icon {
  font-size: 0.9rem;
  opacity: 0.7;
}

.nav-link:hover {
  color: var(--blue-mid);
  background: rgba(80, 165, 230, 0.06);
  border-left-color: var(--blue-light);
}

.nav-link.active {
  color: var(--blue-dark);
  font-weight: 500;
  background: rgba(80, 165, 230, 0.1);
  border-left-color: var(--blue-mid);
}

/* Lesson links */
.lesson-link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.lesson-link:hover {
  background: rgba(239, 145, 198, 0.08);
  border-left-color: var(--pink);
}

.lesson-link.active {
  background: rgba(239, 145, 198, 0.12);
  border-left-color: var(--pink);
}

.lesson-number {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--white);
  background: var(--blue-light);
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 24px;
  text-align: center;
  margin-top: 2px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.lesson-link.active .lesson-number {
  background: var(--pink);
}

.lesson-title {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-muted);
  line-height: 1.4;
}

.lesson-link.active .lesson-title {
  color: var(--ink);
  font-weight: 500;
}

/* === Main Content === */
#main {
  grid-area: main;
  padding: 3rem;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

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

/* Loading state */
#main.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

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

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


/* === Course title block in sidebar === */
#course-title-block {
  padding: 1.25rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

#course-number {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 0.3rem;
}

#course-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue-dark);
  line-height: 1.35;
}

/* === Content max-width === */
#content {
  max-width: 80%;
  margin-left: 2.5rem;
}

/* === Markdown Content Styles === */
#content h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--blue-dark);
  line-height: 1.2;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--pink);
}

#content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--blue-dark);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

#content h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 550;
  color: var(--blue-dark);
  letter-spacing: 0.06em;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

#content h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--blue-dark);
  letter-spacing: 0.06em;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

#content p {
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 1.1rem;
  font-weight: 300;
}

#content strong {
  font-weight: bold;
  color: var(--ink);
}

#content em {
  font-style: italic;
  color: var(--ink-muted);
}

#content a {
  color: var(--blue-mid);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#content a:hover {
  color: var(--blue-dark);
}

#content ul, #content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}

#content li {
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--ink);
  font-weight: 300;
  margin-bottom: 0.2rem;
}

#content li strong {
  font-weight: bold;
}

/* Blockquotes */
#content blockquote {
  border-left: 3px solid var(--pink);
  background: rgba(239, 145, 198, 0.07);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

#content blockquote p {
  margin-bottom: 0;
  font-style: italic;
  color: var(--ink-muted);
  font-size: 1rem;
}

/* Tables */
#content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}

#content thead tr {
  background: var(--blue-dark);
  color: var(--white);
}

#content thead tr strong {
  font-weight: bold;
  color: var(--white);
}

#content th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 500;
  letter-spacing: 0.03em;
}

#content tbody tr:nth-child(even) {
  background: rgba(80, 165, 230, 0.05);
}

#content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-muted);
}

#content tbody tr:hover td {
  background: rgba(239, 145, 198, 0.08);
  color: var(--ink);
}

#content figure.image-center {
  text-align: center;
  margin: 1.5rem auto;
}

#content figure.image-center img {
  width: 100%;
}

#content figure.image-sm img  { width: 30%; max-width: 300px; }
#content figure.image-md img  { width: 55%; max-width: 500px; }
#content figure.image-lg img  { width: 80%; max-width: 700px; }
#content figure.image-full img { width: 100%; }

/* Code */
#content code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
  background: rgba(28, 99, 153, 0.07);
  color: var(--blue-dark);
  padding: 2px 6px;
  border-radius: 4px;
}

#content pre {
  background: var(--ink);
  color: #e8eaf0;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}

#content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Horizontal rule */
#content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Images */
#content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 1.5rem auto;
}

/* Figure helper classes for image placement */
#content figure {
  margin: 1.5rem 0;
}

#content figure.image-right {
  float: right;
  margin: 0 0 1.5rem 2rem;
  max-width: 340px;
}

#content figure.image-left {
  float: left;
  margin: 0 2rem 1.5rem 0;
  max-width: 340px;
}

#content figure.image-full {
  clear: both;
  width: 100%;
}

#content figcaption {
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

#content .clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* Video embeds */
#content .video-wrapper {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

#content .video-wrapper iframe {
  width: 760px;
  height: 428px;
  border-radius: var(--radius);
  margin: 0;
}

#content .video-wrapper iframe {
  border: none;
}

/* === Error state === */
.error-message {
  background: rgba(239, 145, 198, 0.1);
  border: 1px solid var(--pink);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  #sidebar {
    display: none;
  }

  #main {
    padding: 2rem 1.5rem;
  }
}