/* 
 * Dropdown Navigation System
 * A hierarchical navigation system with collapsible categories
 */

/* Base dropdown container */
.nav-02__item.dropdown {
  position: relative;
  display: inline-block;
}

/* Main dropdown container */
.dropdown-content {
  --dropdown-animation-speed: 0.3s;
  display: none;
  position: absolute;
  background-color: var(--background-color, #fff);
  min-width: 280px;
  max-width: 400px;
  max-height: 60vh; /* Reduced height to ensure it fits better on smaller screens */
  overflow-y: auto; /* Make content scrollable */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  border-radius: 8px;
  margin-top: 12px;
  left: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity var(--dropdown-animation-speed) ease, transform var(--dropdown-animation-speed) ease;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color, #fb5168) transparent;
}

/* Custom scrollbar styling */
.dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.dropdown-content::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-content::-webkit-scrollbar-thumb {
  background-color: var(--primary-color, #fb5168);
  border-radius: 6px;
}

/* Dropdown visibility state */
.nav-02__item:hover .dropdown-content,
.nav-02__item:focus-within .dropdown-content {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Dropdown menu styling */
.dropdown-menu {
  padding: 8px 0;
}

/* Course list styling */
.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--text-color, #333);
}

.course-list li {
  position: relative;
}

/* Flattened category structure styling */
.category-header,
.subcategory-header {
  position: relative;
  margin-bottom: 0;
}

.category-title {
  font-weight: 600;
  padding: 10px 20px 5px;
  color: var(--primary-color, #fb5168);
  font-size: 0.9rem;
  position: sticky;
  top: 0;
  background-color: var(--background-color, #fff);
  z-index: 2;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-title::after {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.category-title[aria-expanded="true"]::after {
  transform: rotate(90deg);
}

/* Category items styling */
.category-item {
  margin: 0;
}

/* Indentation for hierarchy levels */
.indent-level-1 .category-title {
  padding-left: 35px;
  font-size: 0.85rem;
}

.indent-level-1 .dropdown-item {
  padding-left: 35px;
}

.indent-level-2 .category-title {
  padding-left: 50px;
  font-size: 0.8rem;
}

.indent-level-2 .dropdown-item {
  padding-left: 50px;
}

/* Course items */
.dropdown-item {
  display: block;
  padding: 10px 20px;
  color: var(--text-color, #333);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--hover-bg-color, #f5f5f5);
  color: var(--primary-color, #fb5168);
  outline: none;
}

/* Lazy loading optimization */
.dropdown-content {
  contain: content;
  will-change: transform, opacity;
}

/* Performance optimizations */
.dropdown-item,
.category-title {
  contain: content;
  will-change: background-color;
}

/* Reduce paint operations */
.category-title,
.dropdown-item {
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Course category styling */
:root {
  --category-title-padding: 10px 20px 5px;
  --category-title-font-size: 0.9rem;
  --subcategory-title-font-size: 0.85rem;
  --category-border: 1px solid rgba(0, 0, 0, 0.05);
  --category-indicator-size: 0.7rem;
  --category-transition: 0.3s ease;
}