/* ============================================================================
   Parkify Enterprise Dropdown System
   File: assets/css/dropdowns.css
   Purpose: Menu dropdowns, account menus and progressive custom <select> UI
   Load after: variables.css, typography.css, forms.css, navbar.css
   ============================================================================ */

:root {
  --pf-dd-bg: rgba(8, 17, 31, .98);
  --pf-dd-bg-soft: rgba(15, 28, 48, .92);
  --pf-dd-border: rgba(148, 163, 184, .16);
  --pf-dd-border-strong: rgba(148, 163, 184, .26);
  --pf-dd-text: #f8fafc;
  --pf-dd-muted: #94a3b8;
  --pf-dd-accent: #34d399;
  --pf-dd-cyan: #22d3ee;
  --pf-dd-shadow: 0 28px 80px rgba(0, 0, 0, .48), 0 8px 24px rgba(0, 0, 0, .24);
  --pf-dd-radius: 20px;
  --pf-dd-ease: cubic-bezier(.16, 1, .3, 1);
}

/* --------------------------------------------------------------------------
   01. Shared menu panel
---------------------------------------------------------------------------- */

.pf-dropdown,
.pf-enterprise-menu {
  position: absolute;
  top: calc(100% + .7rem);
  right: 0;
  z-index: 1200;
  width: min(23rem, calc(100vw - 1.25rem));
  padding: .55rem;
  border: 1px solid var(--pf-dd-border);
  border-radius: var(--pf-dd-radius);
  background:
    radial-gradient(circle at 12% 0%, rgba(16, 185, 129, .14), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(59, 130, 246, .12), transparent 40%),
    linear-gradient(145deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015)),
    var(--pf-dd-bg);
  color: var(--pf-dd-text);
  box-shadow: var(--pf-dd-shadow);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(9px) scale(.975);
  transform-origin: top right;
  transition: opacity .18s ease, visibility .18s ease, transform .24s var(--pf-dd-ease);
  overflow: hidden;
}

.pf-dropdown::before,
.pf-enterprise-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.pf-dropdown.is-open,
.pf-enterprise-menu.is-open,
.pf-user-menu.is-open > .pf-dropdown,
.pf-nav__item.is-open > .pf-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Keep hover compatibility on desktop, but JS remains source of truth. */
@media (hover: hover) and (pointer: fine) {
  .pf-nav__item:hover > .pf-dropdown,
  .pf-user-menu:hover > .pf-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }
}

.pf-dropdown--left { left: 0; right: auto; transform-origin: top left; }
.pf-dropdown--center { left: 50%; right: auto; transform: translate(-50%, 9px) scale(.975); transform-origin: top center; }
.pf-dropdown--center.is-open { transform: translate(-50%, 0) scale(1); }
.pf-dropdown--wide { width: min(31rem, calc(100vw - 1.25rem)); }

/* --------------------------------------------------------------------------
   02. Menu header, identity and sections
---------------------------------------------------------------------------- */

.pf-dropdown__header,
.pf-menu-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .8rem;
  margin-bottom: .35rem;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 15px;
  background: rgba(255, 255, 255, .035);
}

.pf-menu-profile__avatar {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 13px;
  background: linear-gradient(135deg, #10b981, #06b6d4 55%, #3b82f6);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(16, 185, 129, .18);
  overflow: hidden;
}

.pf-menu-profile__avatar img { width: 100%; height: 100%; object-fit: cover; }
.pf-menu-profile__body { min-width: 0; }
.pf-dropdown__title,
.pf-menu-profile__name {
  color: var(--pf-dd-text);
  font-size: .92rem;
  font-weight: 750;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-dropdown__text,
.pf-menu-profile__meta {
  margin-top: .14rem;
  color: var(--pf-dd-muted);
  font-size: .75rem;
  font-weight: 550;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-menu-profile__status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .32rem .55rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, .1);
  color: #6ee7b7;
  font-size: .68rem;
  font-weight: 750;
}
.pf-menu-profile__status::before {
  content: "";
  width: .38rem;
  height: .38rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .1);
}

.pf-dropdown__section-label {
  display: block;
  padding: .58rem .7rem .35rem;
  color: #64748b;
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.pf-dropdown__divider {
  height: 1px;
  margin: .45rem .3rem;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, .16), transparent);
}

.pf-dropdown__list,
.pf-menu-list {
  display: grid;
  gap: .2rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   03. Enterprise menu items
---------------------------------------------------------------------------- */

.pf-dropdown__link,
.pf-dropdown__button,
.pf-menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .68rem;
  width: 100%;
  min-height: 3.35rem;
  padding: .52rem .62rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--pf-dd-text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, background .18s ease, border-color .18s ease, color .18s ease;
  overflow: hidden;
}

.pf-dropdown__link::before,
.pf-dropdown__button::before,
.pf-menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(#34d399, #22d3ee, #60a5fa);
  opacity: 0;
  transform: scaleY(.45);
  transition: opacity .18s ease, transform .22s var(--pf-dd-ease);
}

.pf-dropdown__link:hover,
.pf-dropdown__button:hover,
.pf-menu-item:hover,
.pf-dropdown__link:focus-visible,
.pf-dropdown__button:focus-visible,
.pf-menu-item:focus-visible,
.pf-dropdown__link.is-active,
.pf-menu-item.is-active {
  border-color: rgba(148, 163, 184, .14);
  background:
    linear-gradient(90deg, rgba(16, 185, 129, .10), rgba(34, 211, 238, .055) 58%, rgba(59, 130, 246, .04)),
    rgba(255, 255, 255, .028);
  color: #fff;
  transform: translateX(2px);
  outline: none;
}

.pf-dropdown__link:hover::before,
.pf-dropdown__button:hover::before,
.pf-menu-item:hover::before,
.pf-dropdown__link.is-active::before,
.pf-menu-item.is-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.pf-menu-item__icon,
.pf-dropdown__icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: #a5f3fc;
  font-size: 1rem;
  transition: transform .2s var(--pf-dd-ease), background .18s ease, border-color .18s ease, color .18s ease;
}

.pf-dropdown__link:hover .pf-menu-item__icon,
.pf-dropdown__link:hover .pf-dropdown__icon,
.pf-menu-item:hover .pf-menu-item__icon {
  transform: scale(1.05);
  border-color: rgba(34, 211, 238, .24);
  background: rgba(34, 211, 238, .1);
  color: #ecfeff;
}

.pf-menu-item__content { min-width: 0; }
.pf-menu-item__title {
  display: block;
  color: inherit;
  font-size: .84rem;
  font-weight: 720;
  line-height: 1.25;
}
.pf-menu-item__description {
  display: block;
  margin-top: .14rem;
  color: var(--pf-dd-muted);
  font-size: .71rem;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-menu-item__end {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 700;
}
.pf-menu-item__chevron {
  width: .45rem;
  height: .45rem;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.pf-menu-item--danger { color: #fecaca; }
.pf-menu-item--danger .pf-menu-item__icon { color: #fda4af; }
.pf-menu-item--danger:hover {
  border-color: rgba(244, 63, 94, .18);
  background: rgba(244, 63, 94, .085);
}
.pf-menu-item--danger::before { background: #fb7185; }

/* Trigger caret */
[data-pf-dropdown-trigger] .pf-dropdown-caret,
.pf-user-button .pf-dropdown-caret {
  width: .42rem;
  height: .42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform .22s var(--pf-dd-ease);
}
[aria-expanded="true"] .pf-dropdown-caret,
.is-open > [data-pf-dropdown-trigger] .pf-dropdown-caret {
  transform: rotate(225deg) translate(-1px, -1px);
}

/* --------------------------------------------------------------------------
   04. Progressive custom select
---------------------------------------------------------------------------- */

.pf-custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}
.pf-custom-select > select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.pf-custom-select__trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-height: 3rem;
  padding: .68rem .82rem;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018)), rgba(15, 23, 42, .7);
  color: var(--pf-dd-text);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.pf-custom-select__trigger:hover {
  border-color: rgba(148, 163, 184, .3);
  background: rgba(30, 41, 59, .82);
}
.pf-custom-select.is-open .pf-custom-select__trigger,
.pf-custom-select__trigger:focus-visible {
  outline: none;
  border-color: rgba(52, 211, 153, .62);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .12);
}
.pf-custom-select__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-custom-select__caret {
  width: .48rem;
  height: .48rem;
  border-right: 1.5px solid #94a3b8;
  border-bottom: 1.5px solid #94a3b8;
  transform: rotate(45deg) translateY(-1px);
  transition: transform .22s var(--pf-dd-ease), border-color .18s ease;
}
.pf-custom-select.is-open .pf-custom-select__caret {
  transform: rotate(225deg) translate(-1px, -1px);
  border-color: #6ee7b7;
}

.pf-custom-select__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .45rem);
  z-index: 1400;
  display: grid;
  gap: .35rem;
  width: max(100%, 15rem);
  max-height: min(22rem, 56vh);
  padding: .48rem;
  border: 1px solid var(--pf-dd-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 10% 0%, rgba(16,185,129,.12), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.012)),
    var(--pf-dd-bg);
  box-shadow: var(--pf-dd-shadow);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.98);
  transform-origin: top center;
  transition: opacity .16s ease, visibility .16s ease, transform .22s var(--pf-dd-ease);
  overflow: hidden;
}
.pf-custom-select.is-open .pf-custom-select__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pf-custom-select__search-wrap { position: relative; }
.pf-custom-select__search {
  width: 100%;
  min-height: 2.55rem;
  padding: .58rem .7rem .58rem 2.25rem;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
  color: #fff;
  font: inherit;
  font-size: .82rem;
  outline: none;
}
.pf-custom-select__search:focus { border-color: rgba(52, 211, 153, .42); box-shadow: 0 0 0 3px rgba(16,185,129,.09); }
.pf-custom-select__search-wrap::before {
  content: "";
  position: absolute;
  left: .82rem;
  top: 50%;
  width: .65rem;
  height: .65rem;
  border: 1.5px solid #64748b;
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}
.pf-custom-select__search-wrap::after {
  content: "";
  position: absolute;
  left: 1.38rem;
  top: 57%;
  width: .34rem;
  height: 1.5px;
  background: #64748b;
  transform: rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

.pf-custom-select__options {
  display: grid;
  gap: .16rem;
  max-height: 17rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.3) transparent;
}
.pf-custom-select__options::-webkit-scrollbar { width: .55rem; }
.pf-custom-select__options::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 999px; border: .14rem solid transparent; background-clip: padding-box; }

.pf-custom-select__option {
  position: relative;
  display: grid;
  grid-template-columns: 1.85rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .58rem;
  width: 100%;
  min-height: 2.8rem;
  padding: .42rem .5rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #dbeafe;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.pf-custom-select__option:hover,
.pf-custom-select__option.is-highlighted,
.pf-custom-select__option:focus-visible {
  outline: none;
  border-color: rgba(148, 163, 184, .12);
  background: linear-gradient(90deg, rgba(16,185,129,.1), rgba(34,211,238,.045));
  transform: translateX(1px);
}
.pf-custom-select__option.is-selected {
  color: #fff;
  border-color: rgba(52, 211, 153, .18);
  background: rgba(16, 185, 129, .1);
}
.pf-custom-select__option:disabled,
.pf-custom-select__option.is-disabled { opacity: .42; cursor: not-allowed; transform: none; }
.pf-custom-select__option-icon {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: #67e8f9;
  font-size: .72rem;
  font-weight: 800;
}
.pf-custom-select__option-text { min-width: 0; }
.pf-custom-select__option-title { display: block; font-size: .82rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-custom-select__option-description { display: block; margin-top: .08rem; color: #64748b; font-size: .68rem; }
.pf-custom-select__check {
  width: .9rem;
  height: .48rem;
  border-left: 2px solid #6ee7b7;
  border-bottom: 2px solid #6ee7b7;
  transform: rotate(-45deg) translateY(-2px);
  opacity: 0;
}
.pf-custom-select__option.is-selected .pf-custom-select__check { opacity: 1; }
.pf-custom-select__empty { padding: 1rem; color: #64748b; font-size: .8rem; text-align: center; }

/* Preserve compact controls used in search/filter bars. */
.pm-search-field .pf-custom-select__trigger,
.pm-field .pf-custom-select__trigger,
.pm-toolbar .pf-custom-select__trigger { min-height: inherit; border: 0; background: transparent; box-shadow: none; padding: 0; }
.pm-search-field .pf-custom-select__panel,
.pm-field .pf-custom-select__panel,
.pm-toolbar .pf-custom-select__panel { min-width: 17rem; }

/* --------------------------------------------------------------------------
   05. Mobile behavior
---------------------------------------------------------------------------- */

.pf-dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1190;
  background: rgba(2, 6, 23, .56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.pf-dropdown-backdrop.is-open { opacity: 1; visibility: visible; }

@media (max-width: 700px) {
  .pf-dropdown,
  .pf-enterprise-menu {
    position: fixed;
    left: .55rem !important;
    right: .55rem !important;
    top: auto !important;
    bottom: max(.55rem, env(safe-area-inset-bottom));
    width: auto;
    max-height: min(78vh, 42rem);
    border-radius: 22px;
    transform: translateY(1.5rem) scale(.985);
    transform-origin: bottom center;
    overflow-y: auto;
  }
  .pf-dropdown.is-open,
  .pf-enterprise-menu.is-open,
  .pf-user-menu.is-open > .pf-dropdown,
  .pf-nav__item.is-open > .pf-dropdown {
    transform: translateY(0) scale(1);
  }

  .pf-custom-select__panel {
    position: fixed;
    left: .55rem;
    right: .55rem;
    top: auto;
    bottom: max(.55rem, env(safe-area-inset-bottom));
    width: auto;
    max-height: 70vh;
    border-radius: 22px;
    transform: translateY(1.5rem) scale(.985);
    transform-origin: bottom center;
  }
  .pf-custom-select.is-open .pf-custom-select__panel { transform: translateY(0) scale(1); }
  .pf-custom-select__options { max-height: 52vh; }
  body.pf-dropdown-lock { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-dropdown,
  .pf-enterprise-menu,
  .pf-custom-select__panel,
  .pf-dropdown__link,
  .pf-dropdown__button,
  .pf-menu-item,
  .pf-custom-select__option { transition: none !important; }
}
