/**
 * Dropdown Component Styles
 * Industry standard dropdown behavior and styling
 * Extracted from custom.css for better organization
 */

/* ============================================================================
   DROPDOWN SYSTEM - INDUSTRY STANDARD HOVER BEHAVIOR
   ============================================================================ */

/* Base dropdown state - hidden by default */
.dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(-8px);
  transition: opacity 0.15s ease-out, visibility 0.15s ease-out, transform 0.15s ease-out;
  pointer-events: none;
  transform-origin: top center;
}

/* Dropdown state when container has .open class */
.dropdown-container.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Dropdown arrow rotation with smooth transition */
.dropdown-arrow {
  transition: transform 0.2s ease-out;
}

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

/* Invisible bridge styling */
.dropdown-bridge {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 8px;
  background: transparent;
  z-index: 49;
  pointer-events: auto;
}

/* ============================================================================
   DROPDOWN MENU STYLING
   ============================================================================ */

/* Enhanced dropdown menu styling */
.dropdown-menu {
  background: rgb(255 255 255 / 98%);
  backdrop-filter: blur(12px);
  border: 1px solid rgb(0 0 0 / 8%);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 10%), 0 10px 10px -5px rgb(0 0 0 / 4%);
  padding: 0.5rem;
  min-width: 160px;
  z-index: var(--z-dropdown);
}

html.dark .dropdown-menu {
  background: rgb(31 41 55 / 98%);
  border-color: rgb(255 255 255 / 10%);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 30%), 0 10px 10px -5px rgb(0 0 0 / 20%);
}

/* Dropdown menu items with enhanced hover effects */
.dropdown-menu a {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-gray-700);
  transition: all 0.15s ease-out;
  border-radius: 8px;
  margin: 2px 4px;
  font-size: 0.875rem;
  line-height: 1.25;
}

.dropdown-menu a:hover {
  background: rgb(59 130 246 / 10%);
  color: #1e40af;
  transform: translateX(4px);
}

html.dark .dropdown-menu a {
  color: var(--color-dark-text);
}

html.dark .dropdown-menu a:hover {
  background: rgb(59 130 246 / 20%);
  color: #60a5fa;
}

/* ============================================================================
   DROPDOWN POSITIONING
   ============================================================================ */

/* Dropdown positioning utilities */
.dropdown-menu.dropdown-menu-right {
  right: 0;
  left: auto;
}

.dropdown-menu.dropdown-menu-left {
  left: 0;
  right: auto;
}

.dropdown-menu.dropdown-menu-top {
  top: auto;
  bottom: 100%;
  transform: scale(0.95) translateY(8px);
}

.dropdown-container.open .dropdown-menu.dropdown-menu-top {
  transform: scale(1) translateY(0);
}

/* ============================================================================
   MOBILE DROPDOWN BEHAVIOR
   ============================================================================ */

/* Mobile menu - separate from dropdown system */
#mobile-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
  background: rgb(255 255 255 / 98%);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgb(0 0 0 / 10%);
}

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

html.dark #mobile-menu {
  background: rgb(17 24 39 / 98%);
  border-top-color: rgb(255 255 255 / 10%);
}

/* ============================================================================
   DROPDOWN ACCESSIBILITY
   ============================================================================ */

/* Focus states for keyboard navigation */
.dropdown-menu a:focus {
  outline: 2px solid var(--color-primary-blue);
  outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .dropdown-menu {
    border: 2px solid currentColor;
  }

  .dropdown-menu a:hover {
    background: currentColor;
    color: white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dropdown-menu {
    transition: none;
  }

  .dropdown-menu a {
    transition: none;
  }

  .dropdown-menu a:hover {
    transform: none;
  }
}

/* ============================================================================
   DROPDOWN RESPONSIVE BEHAVIOR
   ============================================================================ */

@media (width <= 768px) {
  .dropdown-menu {
    min-width: 200px;
    max-width: 90vw;
    border-radius: 8px;
  }

  .dropdown-menu a {
    padding: 1rem;
    font-size: 1rem;
  }
}

@media (width <= 480px) {
  .dropdown-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    max-width: none;
    transform: translateY(100%);
  }

  .dropdown-container.open .dropdown-menu {
    transform: translateY(0);
  }
}

/* ============================================================================
   DROPDOWN VARIANTS
   ============================================================================ */

/* Compact dropdown */
.dropdown-menu.dropdown-compact {
  padding: 0.25rem;
}

.dropdown-menu.dropdown-compact a {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

/* Large dropdown */
.dropdown-menu.dropdown-large {
  padding: 1rem;
  border-radius: 16px;
}

.dropdown-menu.dropdown-large a {
  padding: 1rem 1.25rem;
  font-size: 1rem;
}

/* ============================================================================
   DROPDOWN SEPARATORS
   ============================================================================ */

/* Dropdown separator */
.dropdown-separator {
  height: 1px;
  background: var(--color-gray-200);
  margin: 0.5rem 0;
}

html.dark .dropdown-separator {
  background: var(--color-dark-border);
}

/* ============================================================================
   DROPDOWN ICONS
   ============================================================================ */

/* Dropdown menu item icons */
.dropdown-menu a .icon {
  margin-right: 0.5rem;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Dropdown menu item with icon layout */
.dropdown-menu a {
  display: flex;
  align-items: center;
}
