/* ==============================================================================
   2. Layout, Header, Sidebar & Mobile Responsiveness - Learn Coding
   ============================================================================== */

/* Site Wrapper Flex Layout */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: #0b0f19;
}

/* Mobile Header & Overlay Defaults */
.mobile-header {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* Sidebar Styling - Dark Theme */
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-right: 1px solid #1e293b;
  display: flex !important;
  flex-direction: column !important;
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  overflow-y: auto !important;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  background-color: #020617;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none !important;
  color: #ffffff !important;
}

.brand-logo {
  font-size: 2rem;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff !important;
}

.brand-tagline {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 1.25rem 1rem;
  flex: 1;
}

.nav-back-container {
  margin-bottom: 1rem;
}

.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background-color: #1e293b;
  color: #38bdf8 !important;
  text-decoration: none !important;
  border-radius: 0.375rem;
  font-size: 0.825rem;
  font-weight: 600;
  border: 1px solid #334155;
  transition: all 0.2s ease;
}

.nav-back-btn:hover {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #3b82f6;
  transform: translateX(-2px);
}

.back-arrow {
  font-size: 0.9rem;
  font-weight: bold;
}

.course-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.25rem 0.75rem 0.25rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 0.85rem;
}

.course-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.course-header-badge {
  font-size: 0.725rem;
  font-weight: 600;
  background-color: #1d4ed8;
  color: #dbeafe;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid #2563eb;
}

.course-lessons-menu {
  gap: 0.25rem !important;
}

.course-lessons-menu .nav-link {
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
}

.nav-bullet {
  margin-right: 0.5rem;
  color: #64748b;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.nav-link:hover .nav-bullet {
  color: #38bdf8;
}

.nav-link.active .nav-bullet {
  color: #ffffff;
}

.nav-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.nav-menu {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  margin: 0 !important;
  list-style-type: none !important;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  color: #cbd5e1 !important;
  text-decoration: none !important;
  font-size: 0.925rem;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
  position: relative;
  border: 1px solid transparent;
}

.nav-icon {
  font-size: 1.1rem;
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.nav-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 0.725rem;
  font-weight: 600;
  background-color: #1e293b;
  color: #38bdf8;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #334155;
  transition: all 0.15s ease-in-out;
}

.nav-link:hover {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155;
  transform: translateX(3px);
}

.nav-link:hover .nav-badge {
  background-color: #334155;
  color: #7dd3fc;
}

.nav-link.active {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  border-color: #3b82f6;
}

.nav-link.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: transparent;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1.25rem 1rem;
  border-top: 1px solid #1e293b;
  background-color: #020617;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background-color: #1e293b;
  color: #f8fafc !important;
  text-decoration: none !important;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid #334155;
  transition: all 0.2s ease;
}

.github-link:hover {
  background-color: #334155;
  color: #ffffff !important;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.github-icon {
  fill: currentColor;
}

/* Main Content Area */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3.5rem;
  background-color: #0b0f19 !important;
  color: #cbd5e1 !important;
}

.content-wrapper {
  max-width: 960px;
  margin: 0 auto;
}

/* Mobile Responsiveness & Touch Optimization */
@media (max-width: 868px) {
  .site-wrapper {
    flex-direction: column !important;
  }

  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: #0f172a;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 900;
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    min-height: 56px;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    padding: 0.5rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
  }

  .sidebar-toggle-btn:active {
    background-color: #2563eb;
    border-color: #3b82f6;
  }

  .hamburger-icon {
    font-size: 1.1rem;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1.05rem;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 6px 0 25px rgba(0, 0, 0, 0.6) !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.active {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    padding: 1.25rem 1rem !important;
    width: 100% !important;
    overflow-x: hidden;
  }

  .content-wrapper h1 {
    font-size: 1.65rem !important;
    margin-bottom: 0.75rem !important;
  }

  .content-wrapper h2 {
    font-size: 1.3rem !important;
    margin-top: 1.75rem !important;
  }

  .content-wrapper h3 {
    font-size: 1.1rem !important;
  }

  .content-wrapper p, .content-wrapper li {
    font-size: 0.975rem !important;
    line-height: 1.65 !important;
  }
}
