/*
 * ep-dropdowns.css — EdgePath Global Dropdown Design System
 * Modern, smooth animations · Dark green (#064E3B) & white palette
 * Injected globally via includes/header.php
 */

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --ep-dd-green:        #3C2080;
  --ep-dd-green-mid:    #4D2EB3;
  --ep-dd-green-light:  #6650C0;
  --ep-dd-green-tint:   rgba(60, 32, 128, 0.07);
  --ep-dd-green-tint2:  rgba(60, 32, 128, 0.13);
  --ep-dd-green-ring:   rgba(102, 80, 192, 0.20);
  --ep-dd-white:        #ffffff;
  --ep-dd-border:       rgba(60, 32, 128, 0.10);
  --ep-dd-border-hover: rgba(60, 32, 128, 0.35);
  --ep-dd-shadow:       0 16px 48px -12px rgba(24, 8, 56, 0.28), 0 4px 16px rgba(0,0,0,0.06);
  --ep-dd-radius:       14px;
  --ep-dd-item-radius:  10px;
  --ep-dd-ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --ep-dd-ease-in:      cubic-bezier(0.4, 0, 1, 1);
}

/* ─── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes ep-dd-slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ep-dd-slide-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   0. NATIVE <select> COHESION
      The browser/OS renders the open option list for a native <select> —
      no site can restyle or animate that native popup (a real cross-browser
      limitation, not something CSS/JS can override). We still make the
      closed control match the green & white system exactly, so it reads as
      part of the same design language even though its open list is native.
   ═══════════════════════════════════════════════════════════════════════════ */

select:not(.ep-select-trigger) {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233C2080' 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 12px center;
  background-size: 15px;
  padding-right: 34px !important;
  border: 1.5px solid var(--ep-dd-border);
  border-radius: 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
select:not(.ep-select-trigger):hover {
  border-color: var(--ep-dd-border-hover);
}
select:not(.ep-select-trigger):focus {
  border-color: var(--ep-dd-green-light) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--ep-dd-green-ring) !important;
}
html.dark select:not(.ep-select-trigger) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2334d399' 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 12px center;
  background-size: 15px;
}
html.dark select:not(.ep-select-trigger):focus {
  box-shadow: 0 0 0 3px rgba(20,184,134,0.16) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1. CUSTOM SELECT DROPDOWNS  (.ep-select, .ep-select-panel, .ep-select-option)
   ═══════════════════════════════════════════════════════════════════════════ */

.ep-select {
  position: relative;
}

/* Trigger button */
.ep-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid var(--ep-dd-border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  text-align: left;
  outline: none;
  position: relative;
}

.ep-select-trigger:hover {
  border-color: var(--ep-dd-border-hover);
  background: var(--ep-dd-white);
}

.ep-select-trigger.open,
.ep-select-trigger:focus-visible {
  border-color: var(--ep-dd-green-light);
  background: var(--ep-dd-white);
  box-shadow: 0 0 0 3px var(--ep-dd-green-ring);
}

.ep-select-trigger.ep-select-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.ep-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-select-chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.22s var(--ep-dd-ease), color 0.18s ease;
}

.ep-select-trigger.open .ep-select-chevron {
  transform: rotate(180deg);
  color: var(--ep-dd-green-light);
}

/* Dark mode trigger */
html.dark .ep-select-trigger {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.09);
  color: #e5e7eb;
}
html.dark .ep-select-trigger:hover {
  border-color: rgba(15,157,111,0.40);
  background: rgba(255,255,255,0.07);
}
html.dark .ep-select-trigger.open {
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(20,184,134,0.16);
  border-color: var(--ep-dd-green-light);
}

/* Panel — sized to its own content (never narrower than the trigger,
   never wider than the viewport allows), instead of force-stretching
   to exactly match the trigger's width. */
.ep-select-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 200;
  width: max-content;
  min-width: 100%;
  max-width: min(92vw, 360px);
  background: var(--ep-dd-white);
  border: 1.5px solid var(--ep-dd-border);
  border-radius: var(--ep-dd-radius);
  box-shadow: var(--ep-dd-shadow);
  padding: 6px;
  max-height: 264px;
  overflow-y: auto;
  overflow-x: hidden;

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top left;
  transition:
    opacity 0.18s var(--ep-dd-ease),
    transform 0.18s var(--ep-dd-ease),
    visibility 0s linear 0.18s;

  /* Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(6,78,59,0.18) transparent;
}

/* Flipped to open upward when there isn't room below (see
   assets/js/ep-dropdown-position.js) — keeps the panel fully visible
   instead of running off the bottom of the page. */
.ep-select-panel.ep-dd-open-up,
.relative [x-show][class*="absolute"].ep-dd-open-up {
  top: auto !important;
  bottom: calc(100% + 6px);
  margin-top: 0 !important;
  margin-bottom: 6px !important;
  transform-origin: bottom left;
}

.ep-select-panel::-webkit-scrollbar { width: 5px; }
.ep-select-panel::-webkit-scrollbar-thumb {
  background: rgba(6,78,59,0.18);
  border-radius: 999px;
}

.ep-select-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.18s var(--ep-dd-ease),
    transform 0.18s var(--ep-dd-ease);
}

html.dark .ep-select-panel {
  background: #111b17;
  border-color: rgba(255,255,255,0.09);
  box-shadow: 0 20px 48px -12px rgba(0,0,0,0.55);
}

/* Options */
.ep-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--ep-dd-item-radius);
  font-size: 13.5px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
}

.ep-select-option:hover {
  background: var(--ep-dd-green-tint);
  color: var(--ep-dd-green);
}

.ep-select-option.highlighted {
  background: var(--ep-dd-green-tint2);
}

.ep-select-option.selected {
  color: var(--ep-dd-green-light);
  font-weight: 700;
  background: var(--ep-dd-green-tint);
}

.ep-select-option.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.ep-select-option .ep-select-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ep-dd-green-light);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ep-select-option.selected .ep-select-check {
  opacity: 1;
}

html.dark .ep-select-option { color: #d1d5db; }
html.dark .ep-select-option:hover  { background: rgba(20,184,134,0.14); color: #fff; }
html.dark .ep-select-option.selected { color: #34d399; background: rgba(20,184,134,0.10); }


/* ═══════════════════════════════════════════════════════════════════════════
   2. ALPINE.JS POPUP / CONTEXT-MENU DROPDOWNS
      Targets: absolute positioned panels opened via x-show="open"
      Classes: rounded-2xl rounded-xl + shadow-2xl + bg-white
   ═══════════════════════════════════════════════════════════════════════════ */

/*
 * Global panel style — scoped to any relative wrapper that contains
 * an absolute child with rounded + shadow (the common Alpine dropdown pattern).
 * We use attribute selectors to keep specificity manageable.
 */
.relative [x-show][class*="absolute"][class*="bg-white"],
.relative [x-show][class*="absolute"][class*="bg-myfx-surface-dark"],
.relative [x-show][class*="absolute"][class*="rounded"] {
  background: var(--ep-dd-white) !important;
  border: 1.5px solid var(--ep-dd-border) !important;
  border-radius: var(--ep-dd-radius) !important;
  box-shadow: var(--ep-dd-shadow) !important;
  overflow: hidden;
}

/* Dark mode panel */
html.dark .relative [x-show][class*="absolute"][class*="bg-white"],
html.dark .relative [x-show][class*="absolute"][class*="bg-myfx-surface-dark"],
html.dark .relative [x-show][class*="absolute"][class*="rounded"] {
  background: #180838 !important;
  border-color: rgba(255,255,255,0.09) !important;
  box-shadow: 0 20px 48px -12px rgba(0,0,0,0.60) !important;
}

/* ─── Menu Items inside Alpine dropdowns ────────────────────────────────── */
/* Sidebar-matched hover: every item (account switcher rows, notification
   rows, profile menu links) gets the same full-card gradient fill + left
   accent bar treatment as the sidebar's .nav-link hover — flat, edge-to-
   edge, bleeding to the full width of the dropdown card (no rounded pill
   inset), exactly like the sidebar rail. */

/* Links / buttons that are menu items */
.relative [x-show][class*="absolute"] a[class*="px-"],
.relative [x-show][class*="absolute"] a[class*="flex"],
.relative [x-show][class*="absolute"] button[class*="px-"],
.relative [x-show][class*="absolute"] button[class*="w-full"] {
  position: relative;
  overflow: hidden;
  /* Flat, edge-to-edge bar — no rounded pill inset — so the hover fill
     reads as the full width/size of the dropdown card, exactly like the
     sidebar rail. The panel itself has overflow:hidden + rounded corners,
     so the first/last item is clipped into that shape automatically. */
  border-radius: 0 !important;
  font-weight: 600;
  transform: translate3d(0, 0, 0);
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease,
              transform 0.22s ease !important;
}

/* Left accent bar — same signature as the sidebar rail, clipped to the
   item's own rounded card so it reads as a full-card hover, not a line */
.relative [x-show][class*="absolute"] a[class*="px-"]::before,
.relative [x-show][class*="absolute"] a[class*="flex"]::before,
.relative [x-show][class*="absolute"] button[class*="px-"]::before,
.relative [x-show][class*="absolute"] button[class*="w-full"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--ep-dd-green);
  opacity: 0;
  transform: scaleY(0.6);
  transform-origin: left center;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease;
  pointer-events: none;
}

/* Hover state — full-card gradient fill (green items) */
.relative [x-show][class*="absolute"] a[class*="hover:bg-myfx-green"]:hover,
.relative [x-show][class*="absolute"] button[class*="hover:bg-myfx-green"]:hover,
.relative [x-show][class*="absolute"] button[class*="hover:bg-gray"]:hover,
.relative [x-show][class*="absolute"] a[class*="hover:bg-gray"]:hover {
  background: linear-gradient(90deg, var(--ep-dd-green-tint2), var(--ep-dd-green-tint)) !important;
  color: var(--ep-dd-green) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(6, 78, 59, 0.10) !important;
  transform: translateX(2px);
}
.relative [x-show][class*="absolute"] a[class*="hover:bg-myfx-green"]:hover::before,
.relative [x-show][class*="absolute"] button[class*="hover:bg-myfx-green"]:hover::before,
.relative [x-show][class*="absolute"] button[class*="hover:bg-gray"]:hover::before,
.relative [x-show][class*="absolute"] a[class*="hover:bg-gray"]:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

html.dark .relative [x-show][class*="absolute"] a[class*="hover:bg-myfx-green"]:hover,
html.dark .relative [x-show][class*="absolute"] button[class*="hover:bg-myfx-green"]:hover,
html.dark .relative [x-show][class*="absolute"] button[class*="hover:bg-gray"]:hover,
html.dark .relative [x-show][class*="absolute"] a[class*="hover:bg-gray"]:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 4px 14px rgba(0, 0, 0, 0.28) !important;
}
html.dark .relative [x-show][class*="absolute"] a[class*="hover:bg-myfx-green"]:hover::before,
html.dark .relative [x-show][class*="absolute"] button[class*="hover:bg-myfx-green"]:hover::before,
html.dark .relative [x-show][class*="absolute"] button[class*="hover:bg-gray"]:hover::before,
html.dark .relative [x-show][class*="absolute"] a[class*="hover:bg-gray"]:hover::before {
  background: #ffffff;
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.5);
}

/* Hover state — full-card gradient fill (destructive/red items, e.g. Sign Out) */
.relative [x-show][class*="absolute"] a[class*="hover:bg-red"]:hover,
.relative [x-show][class*="absolute"] button[class*="hover:bg-red"]:hover {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.12), rgba(220, 38, 38, 0.03)) !important;
  color: #dc2626 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(220, 38, 38, 0.10) !important;
  transform: translateX(2px);
}
.relative [x-show][class*="absolute"] a[class*="hover:bg-red"]:hover::before,
.relative [x-show][class*="absolute"] button[class*="hover:bg-red"]:hover::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #dc2626;
  opacity: 1;
  transform: scaleY(1);
}

/* ─── .ep-hdr-item ───────────────────────────────────────────────────────
   Explicit, dedicated class applied directly to the account-switcher rows,
   notification rows, and avatar/profile menu links. Using a real class
   (instead of matching against Tailwind's own hover: utilities) means this
   can never lose a cascade race with the Tailwind stylesheet — the
   conflicting hover:bg-* utilities have been removed from those elements
   in the markup, so this is the only hover rule left to apply. Same
   flat, edge-to-edge, full-card-size treatment as the sidebar's
   .nav-link: no rounded pill, gradient fill spans the entire row, left
   accent bar. */
.ep-hdr-item {
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  border-radius: 0 !important;
  transform: translate3d(0, 0, 0);
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease,
              transform 0.22s ease !important;
}
.ep-hdr-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--ep-dd-green);
  opacity: 0;
  transform: scaleY(0.6);
  transform-origin: left center;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease;
  pointer-events: none;
}
.ep-hdr-item:hover {
  background: linear-gradient(90deg, var(--ep-dd-green-tint2), var(--ep-dd-green-tint)) !important;
  color: var(--ep-dd-green) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(6, 78, 59, 0.10) !important;
  transform: translateX(2px);
}
.ep-hdr-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}
html.dark .ep-hdr-item:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 4px 14px rgba(0, 0, 0, 0.28) !important;
}
html.dark .ep-hdr-item:hover::before {
  background: #ffffff;
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.5);
}
/* Icons inside a hovered item pick up the same tint the sidebar uses */
.ep-hdr-item:hover [data-lucide] {
  color: inherit;
}

/* Destructive variant — Sign Out */
.ep-hdr-item--danger:hover {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.12), rgba(220, 38, 38, 0.03)) !important;
  color: #dc2626 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(220, 38, 38, 0.10) !important;
}
.ep-hdr-item--danger:hover::before {
  background: #dc2626 !important;
}

/* ─── .ep-hdr-trigger ────────────────────────────────────────────────────
   Same sidebar hover language (gradient wash + left accent bar + lift)
   applied to the header's own controls — the account-switcher pill, the
   notification bell, the avatar/profile trigger, and the sidebar-collapse
   toggle — so every hoverable thing in the header matches the sidebar
   exactly, not just the items inside the dropdown panels. */
.ep-hdr-trigger {
  position: relative !important;
  overflow: hidden !important;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease,
              border-color 0.22s ease, transform 0.22s ease !important;
}
.ep-hdr-trigger::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--ep-dd-green);
  opacity: 0;
  transform: scaleY(0.6);
  transform-origin: left center;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease;
  pointer-events: none;
}
.ep-hdr-trigger:hover {
  background: linear-gradient(90deg, var(--ep-dd-green-tint2), var(--ep-dd-green-tint)) !important;
  color: var(--ep-dd-green) !important;
  border-color: var(--ep-dd-border-hover) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 4px 14px rgba(6, 78, 59, 0.10) !important;
  transform: translateX(2px);
}
.ep-hdr-trigger:hover::before {
  opacity: 1;
  transform: scaleY(1);
}
html.dark .ep-hdr-trigger:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 4px 14px rgba(0, 0, 0, 0.28) !important;
}
html.dark .ep-hdr-trigger:hover::before {
  background: #ffffff;
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.5);
}
/* Icon color inside a hovered trigger follows the same text color */
.ep-hdr-trigger:hover [data-lucide] {
  color: inherit;
}

/* ─── Dividers inside dropdown panels ───────────────────────────────────── */
.relative [x-show][class*="absolute"] [class*="border-t"] {
  border-color: var(--ep-dd-border) !important;
}
html.dark .relative [x-show][class*="absolute"] [class*="border-t"] {
  border-color: rgba(255,255,255,0.07) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   3. SPECIFIC NAMED DROPDOWNS (Header)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Notification bell panel ─────────────────────────────────────────────── */
#notifBell [x-show] {
  background: var(--ep-dd-white) !important;
  border: 1.5px solid var(--ep-dd-border) !important;
  border-radius: 18px !important;
  box-shadow: var(--ep-dd-shadow) !important;
}
html.dark #notifBell [x-show] {
  background: #180838 !important;
  border-color: rgba(255,255,255,0.09) !important;
}

/* ── Account switcher panel ──────────────────────────────────────────────── */
#accountSwitcher [x-show] {
  background: var(--ep-dd-white) !important;
  border: 1.5px solid var(--ep-dd-border) !important;
  border-radius: 18px !important;
  box-shadow: var(--ep-dd-shadow) !important;
}
html.dark #accountSwitcher [x-show] {
  background: #180838 !important;
  border-color: rgba(255,255,255,0.09) !important;
}

/* Active account item highlight */
#accountSwitcher .bg-myfx-green {
  background: var(--ep-dd-green) !important;
}

/* ── Profile dropdown panel ──────────────────────────────────────────────── */
/* Targets the div immediately after the profile button */
[x-data="{ open: false }"] [x-show][class*="w-64"] {
  border: 1.5px solid var(--ep-dd-border) !important;
  box-shadow: var(--ep-dd-shadow) !important;
}

/* Profile panel header (user info strip) */
[x-data="{ open: false }"] [x-show][class*="w-64"] > div:first-child {
  background: linear-gradient(135deg, rgba(6,78,59,0.06) 0%, rgba(6,78,59,0.02) 100%) !important;
  border-bottom-color: var(--ep-dd-border) !important;
}

/* Profile items hover */
[x-data="{ open: false }"] [x-show][class*="w-64"] a[class*="hover:bg-myfx-green"]:hover {
  background: var(--ep-dd-green) !important;
  color: #fff !important;
  border-radius: var(--ep-dd-item-radius) !important;
}

/* Sign-out item — keep red danger styling */
[x-data="{ open: false }"] [x-show][class*="w-64"] a[class*="text-red"] {
  color: #dc2626 !important;
}
[x-data="{ open: false }"] [x-show][class*="w-64"] a[class*="text-red"]:hover {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border-radius: var(--ep-dd-item-radius) !important;
}
html.dark [x-data="{ open: false }"] [x-show][class*="w-64"] a[class*="text-red"]:hover {
  background: rgba(220,38,38,0.12) !important;
}

/* ─── Search results dropdown ────────────────────────────────────────────── */
/* The search panel uses x-show="open && q.trim() >= 2" */
[x-show][class*="absolute"][class*="z-50"][class*="shadow"] {
  border-radius: 16px !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   4. CONTEXT / ACTION MENUS  (.more-vertical trigger → absolute panel)
      Used in admin pages, trade lists, etc.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Context menu panel — more specific than generic selector above */
[x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] {
  background: var(--ep-dd-white) !important;
  border: 1.5px solid var(--ep-dd-border) !important;
  border-radius: var(--ep-dd-radius) !important;
  box-shadow: var(--ep-dd-shadow) !important;
  padding: 5px !important;
  /* Content-fit width — honour Tailwind w-* but ensure it doesn't overflow viewport */
  max-width: min(100vw - 24px, 260px);
}
html.dark [x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] {
  background: #180838 !important;
  border-color: rgba(255,255,255,0.09) !important;
}

/* Context menu items */
[x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] button,
[x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] a {
  border-radius: 8px !important;
  transition: background 0.13s ease, color 0.13s ease !important;
  white-space: nowrap;
}

[x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] button:hover {
  background: var(--ep-dd-green-tint) !important;
  color: var(--ep-dd-green) !important;
}
html.dark [x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] button:hover {
  background: rgba(102,80,192,0.18) !important;
  color: #A090D8 !important;
}

/* Destructive item in context menus */
[x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] button[class*="text-red"]:hover {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}
html.dark [x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] button[class*="text-red"]:hover {
  background: rgba(220,38,38,0.12) !important;
  color: #fca5a5 !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. VANILLA JS hidden/flex toggle dropdowns  (hidden → flex + show class)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Playbook context menus, trade menus etc. use a custom class */
.trade-playbook-menu,
[class*="dropdown-menu"],
[class*="action-menu"] {
  background: var(--ep-dd-white) !important;
  border: 1.5px solid var(--ep-dd-border) !important;
  border-radius: var(--ep-dd-radius) !important;
  box-shadow: var(--ep-dd-shadow) !important;
  overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════════════════════
   6. ALPINE x-transition OVERRIDE (for consistent animation)
      Alpine's x-transition uses inline styles — we patch the timing here
      so our spring ease is used instead of the default linear one.
   ═══════════════════════════════════════════════════════════════════════════ */

/*
 * Override Alpine's transition classes when applied to dropdown panels.
 * Alpine sets transition-* on elements via inline style during enter/leave;
 * we can't override those, so we instead apply our animation to the panel
 * element itself the moment it becomes visible.
 */

.relative [x-show][class*="absolute"] {
  animation-duration: 0.22s !important;
  animation-timing-function: var(--ep-dd-ease) !important;
  animation-fill-mode: both !important;
}

/* ─── Desktop and laptop header refinement (992px+) ──────────────────────
   Keeps the compact mobile layout intact while giving pointer-driven screens
   comfortable widths, clear hierarchy, and fully legible menu copy. */
@media (min-width: 992px) {
  #accountSwitcher > button {
    min-width: 208px;
    max-width: 300px;
    min-height: 42px;
    padding-inline: 14px;
    font-size: 13px;
  }
  #accountSwitcher [x-show] {
    width: 420px !important;
    max-width: min(420px, calc(100vw - 48px)) !important;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
  #accountSwitcher [x-show] > div:first-child {
    padding: 14px 16px !important;
    background: linear-gradient(135deg, #24104c 0%, #3C2080 100%) !important;
  }
  #accountSwitcher [x-show] > div:first-child :is(p, span) { color:#fff !important; }
  #accountSwitcher [x-show] form > button {
    min-height: 72px;
    padding: 14px 16px !important;
    border-radius: 10px !important;
  }
  #accountSwitcher [x-show] form > button :is(p, span) { white-space: normal; }
  #accountSwitcher [x-show] .text-gray-400 { color:#667b73 !important; }
  #accountSwitcher [x-show] .text-gray-500 { color:#43584f !important; }
  #accountSwitcher [x-show] .text-gray-600 { color:#243a31 !important; }

  #notifBell [x-show] {
    width: 460px !important;
    max-width: min(460px, calc(100vw - 48px)) !important;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
  }
  #notifBell [x-show] .text-gray-400 { color:#64748b !important; }
  #notifBell [x-show] .text-gray-500 { color:#475569 !important; }
  #notifBell [x-show] a {
    min-height: 78px;
    padding: 14px 18px !important;
  }
  #notifBell [x-show] a p { line-height:1.45; white-space:normal; }

  header [x-data="{ open: false }"] [x-show][class*="w-64"] {
    width: 336px !important;
    max-width: min(336px, calc(100vw - 48px)) !important;
  }
  header [x-data="{ open: false }"] [x-show][class*="w-64"] > div:first-child {
    padding: 16px 18px !important;
    background: linear-gradient(135deg, #f4fbf7 0%, #fff 100%) !important;
  }
  header [x-data="{ open: false }"] [x-show][class*="w-64"] .text-gray-400 { color:#667b73 !important; }
  header [x-data="{ open: false }"] [x-show][class*="w-64"] .text-gray-500 { color:#475569 !important; }
  header [x-data="{ open: false }"] [x-show][class*="w-64"] a {
    min-height: 50px;
    padding-inline: 18px !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   7. RESPONSIVE SAFETY — prevent dropdowns from overflowing viewport
   ═══════════════════════════════════════════════════════════════════════════ */

/* Right-anchored panels on small screens */
@media (max-width: 480px) {
  /* Notification and profile dropdowns that anchor to the right */
  #notifBell [x-show],
  [x-data="{ open: false }"] [x-show][class*="w-64"],
  [x-data="{ open: false }"] [x-show][class*="w-80"],
  [x-data="{ open: false }"] [x-show][class*="w-96"] {
    width: calc(100vw - 24px) !important;
    max-width: 360px !important;
    right: 0 !important;
    left: auto !important;
  }
}

/* Ensure context menus never clip off the right edge */
@media (max-width: 640px) {
  [x-data="{ open: false }"] > div[x-show][class*="absolute"][class*="w-"] {
    max-width: calc(100vw - 32px) !important;
  }

  .ep-select-panel {
    /* Allow panel to be wider than trigger on very small screens */
    min-width: 100%;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   8. SCROLLBAR styling for all dropdown panels
   ═══════════════════════════════════════════════════════════════════════════ */

.relative [x-show][class*="absolute"],
.ep-select-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(6,78,59,0.18) transparent;
}

.relative [x-show][class*="absolute"]::-webkit-scrollbar,
.ep-select-panel::-webkit-scrollbar {
  width: 5px;
}

.relative [x-show][class*="absolute"]::-webkit-scrollbar-thumb,
.ep-select-panel::-webkit-scrollbar-thumb {
  background: rgba(6,78,59,0.18);
  border-radius: 999px;
}

/* ─── Reduced motion support ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ep-select-panel,
  .ep-select-chevron,
  .relative [x-show][class*="absolute"] {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
