@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8f9fa;
  --border: #e4e6eb;
  --accent: #2167ff;
  --accent-glow: rgba(33, 103, 255, 0.1);
  --accent-secondary: #28a745;
  --accent-warning: #ffc107;
  --accent-danger: #dc3545;
  --text-primary: #1c1e21;
  --text-secondary: #606770;
  --text-muted: #8d949e;
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── HEADER ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

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

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.header-logo .logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-logo .logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Language dropdown */
.lang-dropdown {
  position: relative;
  z-index: 1000;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  z-index: 10000;
  border: 1px solid rgba(88, 166, 255, 0.4);
  /* Make border more visible */
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.1);
}

.lang-dropdown-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.lang-current {
  color: var(--text-primary);
}

.lang-arrow {
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.lang-dropdown.open .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 120px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  z-index: 9999;
}

.lang-dropdown.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  white-space: nowrap;
}

.lang-dropdown-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.lang-dropdown-item.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── LAYOUT ── */
.layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 900;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar-section-title {
  padding: 8px 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

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

.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item .nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

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

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 40px 48px;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ── SECTIONS ── */
.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 HEADER ── */
.section-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-glow);
  border: 1px solid rgba(88, 166, 255, 0.3);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

/* Chapter cards for homepage */
.chapter-card {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.2s ease;
}

.chapter-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.15);
}

.chapter-card .card-title {
  margin-bottom: 8px;
}

.chapter-card .para {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.card-icon.blue {
  background: rgba(33, 103, 255, 0.1);
}

.card-icon.green {
  background: rgba(40, 167, 69, 0.1);
}

.card-icon.yellow {
  background: rgba(255, 193, 7, 0.1);
}

.card-icon.red {
  background: rgba(220, 53, 69, 0.1);
}

.card-icon.purple {
  background: rgba(111, 66, 193, 0.1);
}

/* ── NOTICE BOXES ── */
.notice {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 3px solid;
}

.notice-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notice-content {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.notice-content strong {
  color: var(--text-primary);
}

.notice.info {
  background: rgba(88, 166, 255, 0.08);
  border-color: var(--accent);
}

.notice.success {
  background: rgba(63, 185, 80, 0.08);
  border-color: var(--accent-secondary);
}

.notice.warning {
  background: rgba(210, 153, 34, 0.08);
  border-color: var(--accent-warning);
}

.notice.danger {
  background: rgba(248, 81, 73, 0.08);
  border-color: var(--accent-danger);
}

/* ── STEPS ── */
.steps-list {
  list-style: none;
}

.step-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
}

.step-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  width: 2px;
  height: calc(100% - 8px);
  background: linear-gradient(to bottom, var(--accent), transparent);
  opacity: 0.3;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.25);
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ── TABLE ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead {
  background: var(--bg-hover);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody td:first-child {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── TAGS ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.tag.blue {
  background: rgba(88, 166, 255, 0.15);
  color: #79bfff;
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.tag.green {
  background: rgba(63, 185, 80, 0.15);
  color: #56d364;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.tag.yellow {
  background: rgba(210, 153, 34, 0.15);
  color: #e3b341;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.tag.red {
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ── DEFINITION LIST ── */
.def-list {
  list-style: none;
}

.def-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.def-item:last-child {
  border-bottom: none;
}

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

.def-desc {
  color: var(--text-secondary);
  font-size: 13.5px;
  flex: 1;
}

/* ── GRID ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-gap-sm {
  gap: 10px;
}

.align-center {
  align-items: center;
}

.align-start {
  align-items: flex-start;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.grid-2,
.grid-3 {
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.info-card .info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.info-card .info-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.info-card .info-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── FORMULA BOX ── */
.formula-box {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 16px 0;
  font-family: 'Courier New', monospace;
  text-align: center;
}

.formula-text {
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.formula-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-family: 'Inter', sans-serif;
}

/* ── LIST STYLES ── */
ul.content-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.content-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding-left: 20px;
}

.content-list li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.content-list li:last-child {
  border-bottom: none;
}

.numbered-list {
  padding-left: 20px;
  margin: 12px 0;
}

.numbered-list li {
  padding: 6px 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.numbered-list li::marker {
  color: var(--accent);
  font-weight: bold;
}

/* ── HIGHLIGHT BLOCK ── */
.highlight-block {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.06), rgba(63, 185, 80, 0.06));
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

/* ── TIME TABLE ── */
.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 4px 4px 4px 0;
}

/* ── MOBILE TOGGLE ── */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .main {
    margin-left: 0;
    max-width: 100vw;
    padding: 24px 20px;
  }

  .mobile-toggle {
    display: block;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .lang-dropdown-btn {
    padding: 6px 12px;
    font-size: 11px;
  }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444d57;
}

/* ── SECTION DIVIDER ── */
h3.subsection {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

p.para {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.8;
}

/* ── FOOTER BAR ── */
.content-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-footer .footer-nav {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-outline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.btn-primary {
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  color: #fff;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── CONTENT IMAGES ── */
.content-img {
  width: 100%;
  max-width: 1000px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 16px 0;
  display: block;
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.img-half {
  width: 50% !important;
  max-width: 500px !important;
}

/* ── LIGHTBOX (IMAGE ZOOM) ── */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
  opacity: 1;
}

.lightbox-img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  background: #fff;
}

.lightbox.open .lightbox-img {
  transform: scale(1);
}