/* Header switcher popups (currency / language): anchored top-right beneath
   their trigger, sliding down on open. Sizing/chrome converted from the
   theme's .desktop-menu__popup (main.css; theme rem base is 10px at our
   reference 1868px viewport, so its 1.4rem = 14px, etc.). */

.site-header__switcher,
[data-popup-anchor] {
  position: relative;
}

.popup--anchored {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 60;
  width: 320px;
  max-width: calc(100vw - var(--space-4) * 2);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  padding: 22px 20px;
  background: var(--color-surface);
  border-radius: 7px;
  box-shadow: 1px 4px 15px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.is-open > .popup--anchored {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}

.popup__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.55rem;
  color: var(--color-text-soft);
}

.popup__close {
  border: 0;
  background: none;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-border-input);
  cursor: pointer;
}

.popup__body {
  margin-top: var(--space-4);
  overflow-y: auto;
}

.popup__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.popup__list li {
  border-bottom: 1px solid var(--color-border);
}

.popup__list li:last-child {
  border-bottom: 0;
}

.popup__list button,
.popup__list a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) 0;
  background: none;
  border: 0;
  font-size: var(--text-body);
  color: var(--color-text-soft);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.popup__list li:first-child button,
.popup__list li:first-child a {
  padding-top: 0;
}

.popup__list li:last-child button,
.popup__list li:last-child a {
  padding-bottom: 0;
}

.popup__list button:hover,
.popup__list a:hover,
.popup__list button[aria-current="true"] {
  color: var(--color-action);
}

.popup__sign {
  display: inline-flex;
  justify-content: center;
  min-width: 20px;
  font-size: 1.25rem;
  font-weight: 600;
}

/* Currency code (USD / EUR …) sits right of the symbol, muted until active. */
.popup__code {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.popup__flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
}

/* Empty-cart popup: centred icon, message, outlined CTA. */
.popup--cart .popup__body {
  margin-top: var(--space-4);
}

/* `.cart-empty`/`.cart-list` set display:flex/grid, which beats the UA
   `[hidden]{display:none}` — restore it so cart.js toggling `hidden` works
   (else the empty message shows alongside items). */
.cart-empty[hidden],
.cart-list[hidden] {
  display: none;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-2);
}

.cart-empty__icon {
  font-size: 2.25rem;
  color: var(--color-border-input);
}

.cart-empty__text {
  margin: 0;
  font-size: var(--text-body);
  color: var(--color-text-soft);
}

.cart-empty__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: 1px solid var(--color-action);
  border-radius: 6px;
  color: var(--color-action);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.cart-empty__cta:hover {
  background: var(--color-action);
  color: #fff;
  text-decoration: none;
}

/* --- Cart popup ------------------------------------------------------------ */
.site-header__cart-count[hidden] { display: none; }

.cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  max-height: 60vh;
  overflow-y: auto;
}
/* Soft divider between cart rows (not above the first). */
.cart-item + .cart-item {
  border-top: 1px solid var(--color-border);
}
.cart-item__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-btn);
  text-decoration: none;
  color: var(--color-primary);
}
.cart-item__link:hover {
  background: var(--color-bg-alt);
  text-decoration: none;
}
.cart-item__logo { flex: none; width: 30px; height: 30px; object-fit: contain; }
.cart-item__titles { display: flex; flex-direction: column; min-width: 0; }
.cart-item__name { font-weight: 600; line-height: 1.2; }
.cart-item__operator { color: var(--color-text-soft); font-size: var(--text-xs); }
