/* ==========================================================================
   Language Switcher Component
   ========================================================================== */

.tw-lang-switcher {
  position: relative;
  display: inline-flex;
}

/* --------------------------------------------------------------------------
   Trigger
   -------------------------------------------------------------------------- */

.tw-lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border: 1px solid var(--color-alpha--white_alpha_25);
  border-radius: 12px;
  background-color: var(--color-brand--kind_blue_raw);
  cursor: pointer;
  font-family: var(--font-family--default);
  font-size: 16px;
  font-weight: var(--font-weight--semibold);
  line-height: 1.5;
  letter-spacing: 0.3px;
  color: var(--color-neutral-white--neutral_0);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tw-lang-switcher__trigger:hover {
  background-color: var(--color-neutral-black--neutral_90);
}

.tw-lang-switcher__trigger:focus-visible {
  outline: 2px solid var(--color-brand--kind_blue_medium);
  outline-offset: 2px;
}

.tw-lang-switcher__trigger-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */

.tw-lang-switcher__overlay {
  position: fixed;
  inset: 0;
  z-index: 100001 !important;
  background-color: var(--color-alpha--black_alpha_50);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tw-lang-switcher__overlay:not([hidden]) {
  opacity: 1;
}

.tw-lang-switcher__overlay[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Dialog
   -------------------------------------------------------------------------- */

.tw-lang-switcher__dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100002 !important;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  background-color: var(--color-neutral-white--neutral_bright_white);
  border-radius: 4px;
  box-shadow: var(--shadow-xxxl);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tw-lang-switcher__dialog:not([hidden]) {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.tw-lang-switcher__dialog[hidden] {
  display: none;
}

.tw-lang-switcher__dialog:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   Dialog Header
   -------------------------------------------------------------------------- */

.tw-lang-switcher__dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-neutral-beige--neutral_20);
}

.tw-lang-switcher__title {
  margin: 0;
  font-family: var(--font-family--default);
  font-size: 16px;
  font-weight: var(--font-weight--semibold);
  line-height: 1.4;
  letter-spacing: 0.3px;
  color: var(--color-neutral-black--neutral_100);
}

/* --------------------------------------------------------------------------
   Close Button
   -------------------------------------------------------------------------- */

.tw-lang-switcher__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-neutral-black--neutral_100);
  transition: background-color 0.2s ease;
}

.tw-lang-switcher__close:hover {
  background-color: var(--color-alpha--black_alpha_5);
}

.tw-lang-switcher__close:focus-visible {
  outline: 2px solid var(--color-brand--kind_blue_medium);
  outline-offset: 2px;
}

.tw-lang-switcher__close svg {
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------------------------
   Language List
   -------------------------------------------------------------------------- */

.tw-lang-switcher__list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 24px;
}

.tw-lang-switcher__item {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Language Link
   -------------------------------------------------------------------------- */

.tw-lang-switcher__link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
  color: var(--color-neutral-black--neutral_100) !important;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.tw-lang-switcher__link:hover {
  color: var(--color-brand--kind_blue_medium) !important;
  text-decoration: underline !important;
}

.tw-lang-switcher__link:focus-visible {
  outline: 2px solid var(--color-brand--kind_blue_medium);
  outline-offset: 4px;
  border-radius: 4px;
}

.tw-lang-switcher__item.is-active .tw-lang-switcher__link {
  color: var(--color-brand--kind_blue_medium);
}

/* --------------------------------------------------------------------------
   Flag Icons
   -------------------------------------------------------------------------- */

.tw-lang-switcher__flag {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--color-alpha--black_alpha_15);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.tw-lang-switcher__flag--germany {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3'%3E%3Crect width='5' height='1' fill='%23000'/%3E%3Crect y='1' width='5' height='1' fill='%23D00'/%3E%3Crect y='2' width='5' height='1' fill='%23FFCE00'/%3E%3C/svg%3E");
}

.tw-lang-switcher__flag--france {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23002395'/%3E%3Crect x='1' width='1' height='2' fill='%23fff'/%3E%3Crect x='2' width='1' height='2' fill='%23ED2939'/%3E%3C/svg%3E");
}

.tw-lang-switcher__flag--italy {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23009246'/%3E%3Crect x='1' width='1' height='2' fill='%23fff'/%3E%3Crect x='2' width='1' height='2' fill='%23CE2B37'/%3E%3C/svg%3E");
}

.tw-lang-switcher__flag--UK {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M0 0v30h60V0z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' clip-path='url(%23b)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/g%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Language Label
   -------------------------------------------------------------------------- */

.tw-lang-switcher__label {
  font-family: var(--font-family--default);
  font-size: 16px;
  font-weight: var(--font-weight--medium);
  line-height: 1.4;
  letter-spacing: 0.3px;
}

/* --------------------------------------------------------------------------
   Mobile / Light Variant
   -------------------------------------------------------------------------- */

.tw-lang-switcher--mobile {
  display: none; /* Hidden on desktop by default */
  width: 100%;
}

/* Show only when mobile menu is active (below 1400px) */
@container (max-width: 1399px) {
  .tw-lang-switcher--mobile {
    display: flex;
  }
}

.tw-lang-switcher--mobile .tw-lang-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 60px;
  padding: 0 20px;
  border: none;
  border-bottom: 1px solid var(--color-alpha--black_alpha_5);
  border-radius: 0;
  background-color: transparent;
  color: var(--color-brand--kind_blue_raw);
  font-weight: var(--font-weight--regular);
}

.tw-lang-switcher--mobile .tw-lang-switcher__trigger:hover {
  background-color: var(--color-alpha--black_alpha_5);
}

.tw-lang-switcher--mobile .tw-lang-switcher__trigger-icon {
  order: -1; /* Icon on the left */
  width: 24px;
  height: 24px;
}

.tw-lang-switcher--mobile .tw-lang-switcher__trigger-label {
  flex: 1;
  text-align: left;
}
