/* ============================================
   DROPDOWN SYSTEM - Click-Only, Clean Implementation
   No hover triggers, full accessibility
   ============================================ */

/* Dropdown Container */
.dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 9998; /* Just below dropdown menu (9999) but above everything else */
}

/* Dropdown Menu (Hidden by default) */
.dropdown-menu {
  position: absolute; /* Simple absolute positioning relative to container */
  top: calc(100% + 10px); /* 10px below button */
  right: 0; /* Align to right of container */
  background: var(--bg-elevated, #2a2a2a);
  border: 1px solid var(--border-primary, #444);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 180px;
  z-index: 1200 !important; /* Above navbar (1100) */
  
  /* Default: Hidden */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: block; /* Always in DOM, just invisible */
}

/* Dropdown Menu Closed State (explicit) */
.dropdown-menu[data-state="closed"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: block; /* Keep in DOM */
}

/* Dropdown Menu Open State - INSTANT DISPLAY */
.dropdown-menu[data-state="open"] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: block !important;
}

/* Force display even if parent is hovered */
.dropdown-container:hover .dropdown-menu[data-state="open"] {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Dropdown Item */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-primary, #444);
  color: var(--text-primary, #fff);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  font-family: inherit;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--bg-tertiary, #333);
  color: var(--accent-primary, #007bff);
  outline: none;
}

.dropdown-item:active {
  background: var(--bg-tertiary, #333);
  transform: scale(0.98);
}

/* Item Icons */
.dropdown-item .item-icon,
.dropdown-item .check-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.dropdown-item:hover .item-icon,
.dropdown-item:focus .item-icon {
  opacity: 1;
}

/* Active Language Item */
.dropdown-item[data-active="true"] .check-icon {
  opacity: 1;
  stroke: var(--brand-color, #f1c40f);
}

/* Button Focus State (for keyboard navigation) */
.main-v2-nav-icon-btn:focus-visible {
  outline: 2px solid var(--accent-primary, #007bff);
  outline-offset: 2px;
  border-radius: 4px;
}

.main-v2-nav-icon-btn[aria-expanded="true"] {
  background: var(--bg-tertiary, #333);
  border-radius: 4px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .dropdown-menu {
    min-width: 160px;
    font-size: 13px;
  }
  
  .dropdown-item {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .dropdown-item .item-icon,
  .dropdown-item .check-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .dropdown-menu {
    min-width: 140px;
    right: -10px;
  }
  
  .dropdown-item {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* Keyboard Navigation Highlights */
.dropdown-item:focus-visible {
  outline: 2px solid var(--accent-primary, #007bff);
  outline-offset: -2px;
}

/* Prevent text selection during interaction */
.dropdown-container {
  user-select: none;
  -webkit-user-select: none;
}

/* Loading State (optional) */
.dropdown-menu[data-loading="true"] .dropdown-item {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}
