/* ================= SEARCH & CONTROLS ================= */
.control-panel {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.control-panel.dropdown-open,
.control-panel:has(.custom-dropdown.open) {
  z-index: 300;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-light);
  padding: 6px 8px 6px 24px;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.search-bar:focus-within {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 0 4px var(--primary-red-glow);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transition: transform 0.2s;
}

.search-btn-icon:hover {
  transform: scale(1.06);
}

.pokeball-search-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 50%, #fecaca 50%);
  border: 2px solid #ffffff;
  position: relative;
}
.pokeball-search-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  background: #ffffff;
  border: 2px solid #ef4444;
  border-radius: 50%;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pill-select {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  box-shadow: var(--shadow-subtle);
  position: relative;
  z-index: 10;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.filter-pill-select:hover,
.filter-pill-select:focus-within {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 4px 16px -2px rgba(239, 68, 68, 0.15);
  transform: translateY(-1px);
}

.pill-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.modern-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 26px 6px 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  border-radius: var(--radius-pill);
  transition: color 0.2s;
}

/* ================= CUSTOM ANIMATED SELECT DROPDOWN ================= */
.filter-pill-select.dropdown-active {
  z-index: 120 !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.2) !important;
}

.pack-modal-header {
  position: relative;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 16px;
  margin-bottom: 16px;
  padding-right: 52px;
}

.pack-modal-title-block {
  flex: 1;
  min-width: 0;
}

.pack-modal-header .filter-pill-select {
  flex-shrink: 0;
  margin-right: 0;
}

@media (max-width: 768px) {
  .pack-modal-header {
    flex-direction: column;
    align-items: stretch;
    padding-right: 0;
    gap: 12px;
  }
  .pack-modal-title-block {
    padding-right: 42px;
  }
}

@media (min-width: 769px) {
  #packCardsModal .custom-dropdown-menu {
    left: auto;
    right: 0;
  }
}

.custom-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.custom-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
  gap: 8px;
  user-select: none;
}

.custom-dropdown-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.custom-dropdown-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.custom-dropdown.open .custom-dropdown-arrow {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 230px;
  width: max-content;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top center;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.22s;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  overflow: hidden;
  box-sizing: border-box;
}

body.dark-mode .custom-dropdown-menu {
  background: #0c0c0f;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.92);
}

.custom-dropdown.open .custom-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-dropdown-list {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 4px 2px 2px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.custom-dropdown-list::-webkit-scrollbar {
  width: 5px;
  height: 0px !important;
}

.custom-dropdown-list::-webkit-scrollbar-horizontal {
  display: none !important;
  height: 0px !important;
  width: 0px !important;
}

.custom-dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 10px;
}

.custom-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}

.custom-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-sizing: border-box;
  width: 100%;
}

.custom-dropdown-item:hover {
  background: var(--bg-card-soft);
  color: var(--text-primary);
  padding-left: 15px;
}

.custom-dropdown-item.selected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--primary-red);
  font-weight: 800;
}

body.dark-mode .custom-dropdown-item.selected {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

body.dark-mode .search-bar:focus-within {
  border-color: #d4d4d8;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

body.dark-mode .filter-pill-select:hover,
body.dark-mode .filter-pill-select:focus-within,
body.dark-mode .filter-pill-select.dropdown-active {
  border-color: #d4d4d8 !important;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .custom-dropdown-arrow {
  color: #a1a1aa;
}

body.dark-mode .filter-pill-select:hover .custom-dropdown-arrow,
body.dark-mode .custom-dropdown.open .custom-dropdown-arrow {
  color: #ffffff;
}

body.dark-mode .custom-dropdown-item:hover .dropdown-item-dot,
body.dark-mode .custom-dropdown-item.selected .dropdown-item-dot {
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.55);
}

body.dark-mode .dropdown-item-check {
  color: #ffffff;
}

.dropdown-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.custom-dropdown-item:hover .dropdown-item-dot {
  background: var(--primary-red);
  transform: scale(1.3);
}

.custom-dropdown-item.selected .dropdown-item-dot {
  background: var(--primary-red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  transform: scale(1.3);
}

.dropdown-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item-check {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--primary-red);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.custom-dropdown-item.selected .dropdown-item-check {
  opacity: 1;
  transform: scale(1);
}

/* Fallback option style for standard select */
.modern-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 18px;
  line-height: 1.8;
}

body.dark-mode .modern-select option {
  background-color: #0b0b0d;
  color: #f4f4f6;
}

.modern-select option:checked {
  background: #ef4444 linear-gradient(0deg, #ef4444 0%, #ef4444 100%);
  color: #ffffff;
  font-weight: 800;
}

.range-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  box-shadow: var(--shadow-subtle);
}

.range-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.range-input {
  width: 58px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px 6px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  outline: none;
  background: var(--bg-card-soft);
  color: var(--text-primary);
  -moz-appearance: textfield;
  appearance: textfield;
}

.range-input::-webkit-outer-spin-button,
.range-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body.dark-mode .range-input {
  background: #050507;
  border-color: #27272f;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.9);
}

.active-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-left: auto;
}

