/**
 * Currency Mega Menu (isolated)
 * Applied ONLY to the header currency selector.
 */

.mega-menu {
  position: relative;
}

.currency-mega-menu {
  position: relative;
}

.header .nav-menu .nav-item:has(> .currency-mega-menu),
.header .navbar-collapse:has(.currency-mega-menu),
.header .navbar:has(.currency-mega-menu) {
  overflow: visible;
}

/*
 * Panel is positioned with JS (fixed, below trigger) so Bootstrap/Popper
 * and conflicting .dropdown--lang rules cannot flip it upward.
 */
.currency-mega-menu .currency-mega-menu-content.dropdown-menu {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: none;
  float: none;
  width: min(860px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  min-width: 0;
  margin: 0 !important;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: #ffffff;
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.12),
    0 4px 12px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  z-index: 2000;
}

.currency-mega-menu .currency-mega-menu-content.dropdown-menu.show {
  display: flex !important;
  flex-direction: column;
}

.currency-mega-menu-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.currency-mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.currency-mega-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.12rem;
  min-height: 58px;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.currency-mega-menu-item:hover,
.currency-mega-menu-item:focus {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
  color: #0f172a;
  text-decoration: none;
}

.currency-mega-menu-item.active {
  background: hsl(var(--main) / 0.08);
  border-color: hsl(var(--main) / 0.35);
  box-shadow: inset 0 0 0 1px hsl(var(--main) / 0.1);
}

.currency-mega-menu-item.active:hover,
.currency-mega-menu-item.active:focus {
  background: hsl(var(--main) / 0.1);
  color: #0f172a;
}

.currency-mega-menu-item-code {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.currency-mega-menu-item-check {
  display: none;
  color: hsl(var(--main));
  font-size: 0.85rem;
  line-height: 1;
}

.currency-mega-menu-item.active .currency-mega-menu-item-check {
  display: inline-flex;
}

.currency-mega-menu-item-name {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .currency-mega-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .currency-mega-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .currency-mega-menu-item {
    min-height: 52px;
    padding: 0.55rem 0.65rem;
  }
}

@media (max-width: 419.98px) {
  .currency-mega-menu-grid {
    grid-template-columns: 1fr;
  }
}
