/**
 * Currency Switcher styles - matches language dropdown appearance
 */

/* ==================== DESKTOP (navbar) ==================== */

.soeco-currency-switcher {
  min-height: 2rem;
  align-items: center;
  display: flex;
}

/* Match the language switcher: when the dropdown is open, the switcher
   block itself shows a white background instead of the navbar yellow. */
.navbar-main .soeco-currency-switcher:has(.soeco-currency-switcher__list.is-open) {
  background-color: #fff;
}

.soeco-currency-switcher__wrapper {
  position: relative;
}

.soeco-currency-switcher__toggle {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #FFDD00;
  border: none;
  border-radius: 0;
  color: #000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 0 36px 0 16px;
  text-transform: uppercase;
  position: relative;
  line-height: 2rem;
}

/* Currency icon before the toggle label – mirrors the language switcher globe. */
.soeco-currency-switcher__toggle::before {
  content: '';
  display: inline-flex;
  width: 15px;
  height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8'/%3E%3Cpath d='M12 18V6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
}

/* Chevron arrow via ::after - using theme's chevron-icon.svg */
.soeco-currency-switcher__toggle::after {
  content: '';
  display: inline-flex;
  width: 16px;
  height: 16px;
  background-image: url('/themes/custom/soeco_custom/build/assets/icons/chevron-icon.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease-in-out;
  filter: invert(1);
}

.soeco-currency-switcher__toggle[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(180deg);
}

.soeco-currency-switcher__toggle:focus {
  background-color: #FFDD00;
  outline: 2px solid #000;
  outline-offset: -2px;
}

/* When the dropdown is open, the toggle becomes transparent so the white
   background of the wrapper shows through (mirrors the language switcher).
   Placed after the :focus rule so it still applies while the button is focused. */
.soeco-currency-switcher__toggle[aria-expanded="true"],
.soeco-currency-switcher__toggle[aria-expanded="true"]:focus {
  background-color: transparent;
}

.soeco-currency-switcher__list {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease-in-out;
}

.soeco-currency-switcher__list.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.soeco-currency-switcher__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  color: #000;
}

/* Flag icon before each currency option – mirrors the language switcher. */
.soeco-currency-switcher__option::before {
  content: '';
  display: block;
  width: 15px;
  height: 15px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  border: 1px solid #000;
  border-radius: 50%;
  flex-shrink: 0;
}

.soeco-currency-switcher__option[data-currency-code="SEK"]::before {
  background-image: url('/themes/custom/soeco_custom/components/block-dropdown-language/lang-sv-icon.svg');
}

.soeco-currency-switcher__option[data-currency-code="DKK"]::before {
  background-image: url('/themes/custom/soeco_custom/components/block-dropdown-language/da.png');
}

.soeco-currency-switcher__option[data-currency-code="NOK"]::before {
  background-image: url('/themes/custom/soeco_custom/components/block-dropdown-language/nb.png');
}

/* Temporary placeholder for EUR — replace when the final icon is provided. */
.soeco-currency-switcher__option[data-currency-code="EUR"]::before {
  background-image: url('/themes/custom/soeco_custom/components/block-dropdown-language/eu.png');
}

.soeco-currency-switcher__option:hover,
.soeco-currency-switcher__option:focus {
  background-color: #f8f8f8;
}

.soeco-currency-switcher__option.is-active {
  font-weight: 700;
}

/* ==================== OFFCANVAS (mobile) ==================== */

.offcanvas .soeco-currency-switcher {
  background-color: #f8f8f8;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  overflow: hidden;
  position: relative;
  padding: 0;
  width: 100%;
  flex-direction: column;
  align-items: stretch;
}

/* Currency icon (€ symbol circle) on the left */
.offcanvas .soeco-currency-switcher::before {
  content: '';
  display: inline-flex;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8'/%3E%3Cpath d='M12 18V6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  position: absolute;
  top: 17px;
  left: 14px;
  z-index: 1;
  pointer-events: none;
}

/* Toggle button in offcanvas */
.offcanvas .soeco-currency-switcher__toggle {
  background-color: transparent;
  border: none;
  border-radius: 0;
  color: #000;
  cursor: pointer;
  display: block;
  font-size: 14px;
  font-weight: normal;
  padding: 16px 37px 16px 39px;
  text-align: left;
  text-transform: none;
  width: 100%;
  line-height: normal;
}

.offcanvas .soeco-currency-switcher__toggle::after {
  right: 0;
}

.offcanvas .soeco-currency-switcher__toggle::before {
  content: none;
}

/* Collapsible list in offcanvas */
.offcanvas .soeco-currency-switcher__list {
  position: static;
  opacity: 0;
  visibility: hidden;
  display: block;
  height: 0;
  padding: 0;
  border: none;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  background-color: #fff;
  margin: 0 -16px;
  transform: none;
  transition: all 0.25s ease-out;
  min-width: auto;
}

.offcanvas .soeco-currency-switcher__list.is-open {
  opacity: 1;
  visibility: visible;
  height: auto;
}

/* Option buttons in offcanvas */
.offcanvas .soeco-currency-switcher__option {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: normal;
  text-transform: none;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}

.offcanvas .soeco-currency-switcher__option:hover,
.offcanvas .soeco-currency-switcher__option:focus {
  background-color: #f0f0f0;
}
