/* =========================================================
   Shared custom dropdown (js/dropdown.js)
   Used on the Courses page and on "My courses" (dashboard).
   The closed pill keeps the page's own ".select" look; this file only
   adds the full-pill button, the shown value and the menu.
   ========================================================= */

/* ---------- Closed pill ---------- */
.dd-pill { cursor: pointer; }
.dd-native {               /* the real <select>: kept, but hidden */
  position: absolute !important; width: 1px !important; height: 1px !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
  opacity: 0 !important; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none;
}
.dd-value {                /* same text style the native select had */
  display: block; min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 15px var(--font-body, "Inter", system-ui, sans-serif);
  color: var(--ink, #fff); pointer-events: none;
}
.dd-button {               /* invisible button covering the WHOLE pill */
  position: absolute; inset: -1px; z-index: 1;   /* -1px: also covers the pill's border */
  margin: 0; padding: 0; border: 0; border-radius: inherit;
  background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dd-button:focus { outline: none; }
.dd-button:focus-visible { box-shadow: 0 0 0 3px rgba(156,192,255,.55); }
.dd-pill:hover { background: rgba(255,255,255,.12); }
.dd-pill.is-open { border-color: var(--accent-hi, #9CC0FF); }
.dd-pill::after { transition: transform .18s ease; }
.dd-pill.is-open::after { transform: translateY(3px) rotate(225deg); }   /* chevron flips up */

/* ---------- Menu (drawn above everything) ---------- */
.dd-menu {
  position: fixed; z-index: 1000; box-sizing: border-box;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; border-radius: 22px;
  background: rgba(10,16,34,.9);
  border: 1px solid var(--glass-border, rgba(255,255,255,.12));
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 24px 60px -18px rgba(0,0,0,.85), 0 10px 30px -12px rgba(47,107,255,.35);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top center;
  transition: opacity .14s ease, transform .14s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
}
.dd-menu.is-up { transform-origin: bottom center; transform: translateY(6px) scale(.98); }
.dd-menu.is-open { opacity: 1; transform: none; }
.dd-menu:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { .dd-menu, .dd-pill::after { transition: none; } }

/* Group heading, e.g. PHARMACOLOGY (same style as the phone sheet) */
.dd-group + .dd-group, .dd-option + .dd-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.07); }
.dd-group__label {
  padding: 10px 12px 6px;
  font: 500 11px var(--font-mono, "JetBrains Mono", monospace);
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent-hi, #9CC0FF);
}

/* One choice */
.dd-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 10px 12px 10px 14px; margin: 2px 0; border-radius: 14px; cursor: pointer;
  font: 500 15px var(--font-body, "Inter", system-ui, sans-serif); color: var(--ink, #fff);
  border: 1px solid transparent; user-select: none;
}
.dd-option__text { min-width: 0; overflow-wrap: anywhere; }
.dd-option.is-active { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.08); }
.dd-option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
/* Selected = white chip with a check mark (like the phone sheet's active option) */
.dd-option.is-selected { background: #FFFFFF; color: var(--btn-ink, #0B1220); border-color: transparent; }
.dd-option.is-selected.is-active { box-shadow: 0 0 0 3px rgba(156,192,255,.45); }
.dd-check {
  width: 18px; height: 18px; flex: none; opacity: 0;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.dd-option.is-selected .dd-check { opacity: 1; }
