/**
 * WDHC · global selects & filter controls
 * Premium dark gold dropdowns (sort, gym, grip age, forms, portal).
 */

:root {
  --wdhc-select-bg: linear-gradient(165deg, rgba(28, 22, 12, 0.96) 0%, rgba(10, 8, 6, 0.98) 100%);
  --wdhc-select-bg-hover: linear-gradient(165deg, rgba(40, 30, 14, 0.98) 0%, rgba(14, 10, 6, 0.99) 100%);
  --wdhc-select-border: rgba(212, 175, 55, 0.28);
  --wdhc-select-border-hover: rgba(212, 175, 55, 0.5);
  --wdhc-select-border-focus: rgba(240, 215, 140, 0.65);
  --wdhc-select-text: #f5edd8;
  --wdhc-select-muted: rgba(245, 237, 216, 0.45);
  --wdhc-select-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(240, 215, 140, 0.08);
  --wdhc-select-shadow-focus:
    0 0 0 3px rgba(212, 175, 55, 0.16),
    0 4px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(240, 215, 140, 0.12);
  --wdhc-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.5L6 6L10.5 1.5' stroke='%23D4AF37' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ── Native selects (global) ── */
select:not([multiple]):not([size]),
.lb-gym-select,
.lb-filter-select,
.filter-select,
.hang-sort-select,
.tl-filter-select,
.portal-lb-select,
.form-select,
.form-input.form-select,
.grip-calc-field select,
.calc-field select,
.controls select,
.filter-bar select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  color-scheme: dark;
  font-family: 'Rajdhani', 'Source Sans 3', 'Segoe UI', system-ui, sans-serif !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--wdhc-select-text) !important;
  background-color: #100e0a !important;
  background-image:
    var(--wdhc-select-chevron),
    var(--wdhc-select-bg) !important;
  background-repeat: no-repeat, no-repeat !important;
  background-position: right 12px center, 0 0 !important;
  background-size: 12px 8px, 100% 100% !important;
  border: 1px solid var(--wdhc-select-border) !important;
  border-radius: 999px !important;
  padding: 9px 36px 9px 14px !important;
  min-height: 42px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--wdhc-select-shadow) !important;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    color 0.15s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    background-position 0.18s ease;
}
/* Chevron flips / control lifts when open or focused */
select:not([multiple]):not([size]):focus,
select:not([multiple]):not([size]):focus-visible,
.lb-gym-select:focus,
.lb-filter-select:focus,
.filter-select:focus {
  transform: translateY(-1px) scale(1.02);
  animation: wdhcSelectPulse 0.55s ease-out 1;
}
select:not([multiple]):not([size]):active {
  transform: scale(0.985);
}
@keyframes wdhcSelectPulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(212, 175, 55, 0),
      var(--wdhc-select-shadow);
  }
  40% {
    box-shadow:
      0 0 0 6px rgba(212, 175, 55, 0.18),
      0 6px 20px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(240, 215, 140, 0.14);
  }
  100% {
    box-shadow: var(--wdhc-select-shadow-focus);
  }
}
@media (prefers-reduced-motion: reduce) {
  select:not([multiple]):not([size]):focus,
  select:not([multiple]):not([size]):focus-visible,
  .lb-gym-select:focus,
  .lb-filter-select:focus {
    transform: none;
    animation: none;
  }
}

/* Uppercase UI filters (division / sort / gym) */
.lb-gym-select,
.lb-filter-select,
.filter-select,
.hang-sort-select,
.tl-filter-select,
.portal-lb-select {
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  font-size: 0.86rem !important;
}

select:not([multiple]):not([size]):hover,
.lb-gym-select:hover,
.lb-filter-select:hover,
.filter-select:hover,
.hang-sort-select:hover,
.tl-filter-select:hover,
.portal-lb-select:hover,
.form-select:hover,
.grip-calc-field select:hover,
.calc-field select:hover,
.controls select:hover {
  border-color: var(--wdhc-select-border-hover) !important;
  background-image:
    var(--wdhc-select-chevron),
    var(--wdhc-select-bg-hover) !important;
  color: #fff !important;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(212, 175, 55, 0.12),
    inset 0 1px 0 rgba(240, 215, 140, 0.1) !important;
}

select:not([multiple]):not([size]):focus,
select:not([multiple]):not([size]):focus-visible,
.lb-gym-select:focus,
.lb-filter-select:focus,
.filter-select:focus,
.hang-sort-select:focus,
.tl-filter-select:focus,
.portal-lb-select:focus,
.form-select:focus,
.grip-calc-field select:focus,
.calc-field select:focus,
.controls select:focus {
  outline: none !important;
  border-color: var(--wdhc-select-border-focus) !important;
  background-image:
    var(--wdhc-select-chevron),
    var(--wdhc-select-bg-hover) !important;
  box-shadow: var(--wdhc-select-shadow-focus) !important;
  color: #fff !important;
}

select:not([multiple]):not([size]):disabled,
.lb-gym-select:disabled,
.form-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Opened list (browser-limited) */
select option,
.lb-gym-select option,
.lb-filter-select option,
.filter-select option,
.form-select option {
  background-color: #14120e;
  color: #f5edd8;
  font-weight: 600;
  padding: 8px;
}

/* IE/legacy clear */
select::-ms-expand {
  display: none;
}

/* Full-width fields (forms / grip age) stay pill but stretch */
.grip-calc-field select,
.calc-field select,
.form-section select,
form select.form-input,
form select.form-select,
#submissionForm select,
.wdhc-form-page select {
  width: 100%;
  max-width: 100%;
  border-radius: 12px !important;
  min-height: 44px;
  font-size: 1rem !important;
  text-transform: none !important;
  letter-spacing: 0.02em !important;
}

/* ── Sort / filter buttons (non-select chips) ── */
.sort-btn,
.lb-filter-btn,
.lb-toolbar .sort-tabs button,
.lb-toolbar .sort-btn,
.sort-toggle,
.achievement-filter-btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: 'Rajdhani', 'Source Sans 3', sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c8c0b0 !important;
  background: linear-gradient(165deg, rgba(24, 20, 12, 0.9) 0%, rgba(10, 8, 6, 0.95) 100%) !important;
  border: 1px solid rgba(212, 175, 55, 0.22) !important;
  border-radius: 999px !important;
  padding: 7px 14px !important;
  min-height: 36px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(240, 215, 140, 0.06);
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sort-btn:hover,
.lb-filter-btn:hover,
.lb-toolbar .sort-tabs button:hover,
.lb-toolbar .sort-btn:hover,
.sort-toggle:hover,
.achievement-filter-btn:hover {
  color: #f5edd8 !important;
  border-color: rgba(212, 175, 55, 0.45) !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.12), inset 0 1px 0 rgba(240, 215, 140, 0.1);
}

.sort-btn.active,
.lb-filter-btn.active,
.lb-toolbar .sort-tabs button.active,
.lb-toolbar .sort-btn.active,
.sort-toggle.active,
.achievement-filter-btn.active,
.division-tabs button.active,
.lb-tab-strip.division-tabs button.active {
  color: #120c06 !important;
  background: linear-gradient(135deg, #FFE566 0%, #D4AF37 48%, #cd7f32 100%) !important;
  border-color: rgba(232, 120, 32, 0.55) !important;
  box-shadow:
    0 4px 14px rgba(212, 175, 55, 0.28),
    inset 0 1px 0 rgba(255, 255, 200, 0.35) !important;
}

/* Division tabs: keep underline variant optional — gold fill when active is stronger */
.lb-toolbar .lb-tab-strip.division-tabs button {
  border-bottom: none !important;
  border-radius: 999px !important;
  padding: 7px 12px !important;
}

/* Leaderboard toolbar selects: consistent min size */
.lb-toolbar-filters--row .lb-filter-select,
.lb-toolbar-filters--row .lb-gym-select,
.lb-filter-group--select .lb-gym-select,
.lb-filter-group--select #gym-filter,
.lb-filter-group--select #division-filter,
.lb-filter-group--select #sort-filter {
  min-width: 138px;
  max-width: 200px;
}

/* Search input sibling polish (match select language) */
.lb-toolbar-search .search-input,
.search-container .search-input,
#athlete-search {
  font-family: 'Rajdhani', 'Source Sans 3', sans-serif;
  font-weight: 600;
  color: var(--wdhc-select-text);
  background: linear-gradient(165deg, rgba(28, 22, 12, 0.96) 0%, rgba(10, 8, 6, 0.98) 100%);
  border: 1px solid var(--wdhc-select-border);
  border-radius: 999px;
  box-shadow: var(--wdhc-select-shadow);
  min-height: 42px;
  padding: 9px 40px 9px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lb-toolbar-search .search-input:focus,
.search-container .search-input:focus,
#athlete-search:focus {
  outline: none;
  border-color: var(--wdhc-select-border-focus);
  box-shadow: var(--wdhc-select-shadow-focus);
}

/* Portal / dashboard selects already classed */
.dashboard-page select:not([multiple]):not([size]),
.portal-panel select:not([multiple]):not([size]),
#section-training-log .tl-filter-select,
#section-your-gym .portal-lb-select,
#hangHistorySort {
  border-radius: 999px !important;
}

@media (max-width: 900px) {
  select:not([multiple]):not([size]),
  .lb-gym-select,
  .lb-filter-select,
  .filter-select,
  .hang-sort-select,
  .tl-filter-select {
    min-height: 44px;
    font-size: 0.9rem !important;
  }
  .lb-toolbar-filters--row .lb-filter-select,
  .lb-toolbar-filters--row .lb-gym-select {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
