/* ─────────────────────────────────────────────────────────────────────────
   custom-select — drop-in replacement UI for native <select>.
   Designed to match the dark "island" forms used across the site
   (contato, network, admin). Native <select> remains in the DOM so
   form submit + required validation + autofill keep working.
   ───────────────────────────────────────────────────────────────────────── */

.cs-wrap {
  position: relative;
  display: block;
  width: 100%;
}

/* Native select kept in DOM but visually hidden. Pointer-events:none so the
   trigger captures clicks; tab order via the trigger button. */
.cs-wrap > select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* ─── Trigger (looks/feels like a regular form input) ─── */
/* High-specificity selectors below: forms in this codebase often have
   a `.foo-form button { background: <brand gradient>; ... }` rule that
   would otherwise win over the trigger's defaults. */
.cs-wrap > .cs-trigger {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: .01em;
  text-transform: none;
  color: #fff;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  transition: border-color .25s, background .25s, box-shadow .25s, color .25s;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.cs-wrap > .cs-trigger:hover {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  transform: none;
  filter: none;
}

.cs-wrap > .cs-trigger:focus,
.cs-wrap > .cs-trigger:focus-visible,
.cs-wrap.cs-open > .cs-trigger {
  outline: none;
  border-color: rgba(0,204,255,.35);
  background: rgba(255,255,255,.05);
  box-shadow: 0 0 0 4px rgba(0,204,255,.08);
}

.cs-trigger-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-trigger-placeholder .cs-trigger-label { color: #82869a; }

.cs-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: transform .25s cubic-bezier(.22,1,.36,1), color .25s;
  flex-shrink: 0;
}

.cs-wrap.cs-open .cs-trigger-icon {
  transform: rotate(180deg);
  color: var(--cyan, #00ccff);
}

/* Invalid state (HTML5 :invalid won't reach the trigger since the select is
   the actual form control, so we toggle .cs-invalid via JS on the wrap). */
.cs-wrap.cs-invalid > .cs-trigger {
  border-color: rgba(255,77,94,.55);
  background: rgba(255,77,94,.05);
  box-shadow: 0 0 0 4px rgba(255,77,94,.06);
}

/* ─── Listbox (popover) ─── */
/* position: fixed escapes any ancestor `overflow: hidden` (form wraps that
   need it for masked gradient outlines). JS computes top/left/width on
   open + on scroll/resize. */
.cs-list {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #0d0d18;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow:
    0 1px 0 rgba(255,255,255,.04) inset,
    0 24px 60px rgba(0,0,0,.50),
    0 4px 12px rgba(0,0,0,.30);
  transform-origin: top center;
  animation: cs-pop .18s cubic-bezier(.22,1,.36,1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}

.cs-list[data-cs-flip="up"] { transform-origin: bottom center; }

.cs-list::-webkit-scrollbar { width: 8px; }
.cs-list::-webkit-scrollbar-track { background: transparent; }
.cs-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.14);
  border-radius: 4px;
}
.cs-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

@keyframes cs-pop {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1);     }
}

/* ─── Options ─── */
.cs-option {
  position: relative;
  padding: 10px 14px 10px 30px;
  font-size: 13.5px;
  font-weight: 300;
  color: #c8cdd9;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: .01em;
  user-select: none;
  transition: background .15s, color .15s;
}

.cs-option:hover,
.cs-option.cs-option-active {
  background: rgba(255,255,255,.05);
  color: #fff;
}

.cs-option.cs-option-selected {
  color: #fff;
  background: rgba(0,204,255,.08);
}

/* Dot marker for the selected option (left side). */
.cs-option.cs-option-selected::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan, #00ccff);
  box-shadow: 0 0 8px rgba(0,204,255,.5);
}

.cs-option.cs-option-placeholder {
  color: #75798a;
  font-style: italic;
}

.cs-option.cs-option-disabled {
  color: #555866;
  cursor: not-allowed;
  pointer-events: none;
}
