/* ========================================
   SEARCHABLE DROPDOWN STYLES
   ======================================== */

.searchable-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-search-input {
  width: 100%;
  padding: 0.375rem 2.5rem 0.375rem 1rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--text-primary);
  background: var(--bg-main);
  border: 1px solid var(--border-neon);
  border-radius: 8px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.dropdown-search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
  background-color: rgba(0, 212, 255, 0.05);
}

.dropdown-search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.dropdown-arrow {
  position: absolute;
  right: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  pointer-events: none;
}

.dropdown-input-container:hover .dropdown-arrow {
  color: var(--text-primary);
}

.dropdown-search-input:focus + .dropdown-arrow,
.dropdown-arrow.dropdown-open {
  transform: rotate(180deg);
  color: var(--primary-blue);
}

.dropdown-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 2px;
  background: var(--bg-main);
  border: 1px solid var(--border-neon);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow: hidden;
}

.dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.dropdown-selected {
  background-color: rgba(0, 212, 255, 0.1);
}

.dropdown-item.dropdown-no-results {
  color: var(--text-secondary);
  font-style: italic;
  cursor: default;
  text-align: center;
}

.dropdown-item.dropdown-no-results:hover {
  background-color: transparent;
}

.organization-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.organization-type {
  font-size: 0.6rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Theme-specific organization type colors */
.organization-type {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary-blue);
}

[data-theme="games"] .organization-type {
  background: rgba(0, 136, 204, 0.1);
  color: #0088cc;
}

[data-theme="film"] .organization-type {
  background: rgba(212, 175, 55, 0.1);
  color: #d4af37;
}

[data-theme="tech"] .organization-type {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* Responsive design */
@media (max-width: 768px) {
  .dropdown-search-input {
    font-size: 1rem; /* Prevent zoom on iOS */
    padding: 0.5rem 2.5rem 0.5rem 1rem;
  }
  
  .dropdown-item {
    padding: 1rem;
  }
  
  .dropdown-results {
    max-height: 250px;
  }
}

/* Loading state */
.searchable-dropdown.loading .dropdown-arrow::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-neon);
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: dropdown-spin 1s linear infinite;
}

.searchable-dropdown.loading .dropdown-arrow i {
  display: none;
}

@keyframes dropdown-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Focus trap for accessibility */
.dropdown-results:focus-within {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .dropdown-search-input {
    border-width: 2px;
  }
  
  .dropdown-item:hover,
  .dropdown-item.dropdown-selected {
    background-color: var(--primary-blue);
    color: var(--bg-main);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dropdown-arrow,
  .dropdown-item,
  .dropdown-search-input {
    transition: none;
  }
  
  .searchable-dropdown.loading .dropdown-arrow::before {
    animation: none;
  }
}
