/* =========================================================
   SIDEBAR STYLES (sidebar.css)
   ========================================================= */

.category-sidebar {
  border: none;
  padding: 0;
  margin-bottom: 24px;
}

/* Desktop List Styles */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 4px 0;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.category-link:hover {
  background-color: var(--bg-card-hover, rgba(0, 0, 0, 0.04));
  color: var(--primary);
}

.category-link.active {
  background-color: var(--primary-light, rgba(var(--primary-rgb), 0.1));
  color: var(--primary);
  font-weight: 600;
}

/* Mobile Dropdown Wrapper Styles (Loaded on small screens) */
.category-dropdown-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.category-dropdown-wrapper label {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.category-select {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--heading);
  font-size: 1.4rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.category-select:hover,
.category-select:focus {
  border-color: var(--primary);
}

.category-select:focus {
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* =========================================================
   MOBILE NAVIGATION (Narrow Screen Layout)
   ========================================================= */

@media (max-width: 860px) {

  #menuToggle {
    display: block;
  }

  #mainNav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;

    /* Enable vertical scrolling with viewport height restriction */
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    overscroll-behavior: contain;

    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;

    flex-direction: column;
    align-items: stretch;
    gap: 2px;

    padding: 12px;
    background: var(--header, #0f172a);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 999;
  }

  /* WebKit custom scrollbar styling */
  #mainNav::-webkit-scrollbar {
    width: 6px;
  }

  #mainNav::-webkit-scrollbar-track {
    background: transparent;
  }

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

  #mainNav::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted, #64748b);
  }

  #mainNav.open {
    display: flex;
  }

  #mainNav > a,
  #mainNav .nav-section-button {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    justify-content: space-between;
    text-align: left;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--text, #94a3b8);
    border-radius: var(--radius);
  }

  #mainNav > a:hover,
  #mainNav .nav-section-button:hover {
    color: var(--heading, #f8fafc);
    background: var(--light, #1e293b);
  }

  .nav-dropdown {
    width: 100%;
  }

  /* Mobile dropdown sub-menus container */
  .dropdown-menu,
  .framework-dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    min-width: 0;
    margin: 4px 0 8px 0;
    padding: 4px 0 4px 14px;

    opacity: 1;
    visibility: visible;
    transform: none;

    border: none;
    border-left: 2px solid var(--primary);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .nav-dropdown.active > .dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .nav-dropdown.active > .framework-dropdown-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .nav-category-button,
  .framework-dropdown-menu a {
    padding: 10px 12px;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text, #94a3b8);
    border-radius: 6px;
  }

  .nav-category-button:hover,
  .framework-dropdown-menu a:hover {
    background: var(--light, #1e293b);
    color: var(--primary);
  }

  .nav-all-button {
    font-weight: 600;
    color: var(--heading, #f8fafc);
  }
}

.category-pagination {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

category-page-button {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.category-page-button:hover {
  background: var(--surface-hover);
}
.category-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
}

.category-page-button {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.category-page-button:hover {
  background: var(--surface-hover);
}

.category-page-button:active {
  transform: translateY(1px);
}