/* === Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(12, 10, 9, 0.92);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-right: 1px solid rgba(240, 180, 41, 0.08);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: transform var(--duration-normal) var(--ease-out);
  overflow: hidden;
}

/* Subtle noise texture overlay on sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Warm glow at top of sidebar */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: radial-gradient(ellipse at 50% 0%, rgba(240, 180, 41, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid rgba(240, 180, 41, 0.08);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  position: relative;
}

.sidebar__brand:hover {
  background: rgba(240, 180, 41, 0.04);
}

/* Animated accent line under brand */
.sidebar__brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-5);
  right: var(--space-5);
  height: 1px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-warm), transparent);
  opacity: 0.4;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-slow) var(--ease-out);
}

.sidebar__brand:hover::after {
  transform: scaleX(1);
}

.sidebar__logo svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar__name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.02em;
}

.sidebar__tagline {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
}

.sidebar__linkedin {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.sidebar__linkedin:hover {
  color: #0A66C2;
  transform: scale(1.15);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}

/* Module group */
.nav-module {
  margin-bottom: var(--space-1);
}

.nav-module__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}

.nav-module__header:hover {
  color: var(--text-primary);
  background: rgba(240, 180, 41, 0.04);
}

/* Active module indicator - left edge glow */
.nav-module.is-open .nav-module__header {
  color: var(--text-primary);
}

.nav-module.is-open .nav-module__header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--accent-primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-primary-dim);
}

.nav-module__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.nav-module__label {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.nav-module__chevron {
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-out);
  opacity: 0.4;
}

.nav-module.is-open .nav-module__chevron {
  transform: rotate(90deg);
  opacity: 0.7;
}

.nav-module__lessons {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-normal) var(--ease-out);
}

.nav-module.is-open .nav-module__lessons {
  max-height: 500px;
}

.nav-lesson {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-12);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-dim);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-lesson:hover {
  color: var(--text-secondary);
  background: rgba(240, 180, 41, 0.04);
}

.nav-lesson.is-active {
  color: var(--accent-primary);
  background: var(--accent-primary-dim);
}

.nav-lesson.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 6px var(--accent-primary-dim);
}

.nav-lesson.is-completed {
  color: var(--text-secondary);
}

.nav-lesson__check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-lesson.is-completed .nav-lesson__check {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary-dim);
}

.nav-lesson.is-completed .nav-lesson__check::after {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 50%;
}

/* Sidebar footer */
.sidebar__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(240, 180, 41, 0.08);
}

.sidebar__progress-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.sidebar__reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  padding: 0;
  flex-shrink: 0;
}

.sidebar__reset-btn:hover {
  color: var(--accent-red);
  background: var(--accent-red-dim);
}

/* Sidebar toggle (mobile) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: calc(var(--z-sidebar) + 1);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(240, 180, 41, 0.15);
  border-radius: var(--radius-md);
  background: rgba(12, 10, 9, 0.9);
  backdrop-filter: blur(12px);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-toggle:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-primary-dim);
}

.sidebar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all var(--duration-normal) var(--ease-out);
}

/* === Main content === */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: var(--space-10) var(--space-8);
  transition: margin-left var(--duration-normal) var(--ease-out);
  position: relative;
}

.app-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* === Responsive === */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main {
    margin-left: 0;
    padding: var(--space-8) var(--space-4);
    padding-top: calc(var(--space-8) + 56px);
  }
}

@media (max-width: 640px) {
  .main {
    padding: var(--space-6) var(--space-4);
    padding-top: calc(var(--space-6) + 56px);
  }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}
