/**
 * Synergi 顶栏附加区 — 语言切换美化（GTranslate float）
 * 自动注入：xiaoyucms/{theme}/css/xy_header_extra.css
 */

/* Override system gap:0 on ul.xy-header-extra-nav */
ul.xy-header-extra-nav,
.xy-header-extra-fallback,
.header .header__extra,
.synergi-home ul.xy-header-extra-nav {
  gap: 14px !important;
}

.header__utils {
  gap: 14px;
}

.header__extra > li.xy-header-lang,
.header__extra > li.xy-member-nav,
.header__extra > li.xy-basket-nav,
.header__extra > li.xy-wishlist-nav,
ul.xy-header-extra-nav > li.xy-header-lang,
ul.xy-header-extra-nav > li.xy-member-nav {
  margin: 0 !important;
  padding: 0 !important;
}

ul.xy-header-extra-nav > li.xy-member-nav .xy-member-nav-login,
ul.xy-header-extra-nav > li.xy-member-nav .xy-member-nav-trigger {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #1a2b4a;
  transition: color 0.2s;
}

ul.xy-header-extra-nav > li.xy-member-nav .xy-member-nav-login:hover,
ul.xy-header-extra-nav > li.xy-member-nav .xy-member-nav-trigger:hover {
  color: #c4a35a;
}

.xy-header-lang {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  line-height: 1;
}

.xy-header-lang-switcher {
  line-height: 1 !important;
  overflow: visible !important;
  position: relative;
  z-index: 130;
}

.xy-header-lang-switcher #gt_float_wrapper {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  height: auto !important;
  z-index: 130 !important;
  display: block !important;
  overflow: visible !important;
}

.xy-header-lang-switcher .gt_float_switcher {
  position: relative !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  font-family: "Montserrat", system-ui, sans-serif !important;
  font-size: 12px !important;
  line-height: 1 !important;
  color: #1a2b4a !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected {
  background: transparent !important;
  float: none !important;
  cursor: pointer !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 36px !important;
  padding: 0 12px 0 10px !important;
  color: #1a2b4a !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  background: #fff !important;
  border: 1px solid #e2e6ec !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: border-color 0.2s, color 0.2s, background 0.2s !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang:hover {
  color: #c4a35a !important;
  border-color: #c4a35a !important;
  background: #fbf8f1 !important;
}

.xy-header-lang-switcher .gt_float_switcher img {
  width: 18px !important;
  height: 12px !important;
  max-width: 18px !important;
  max-height: 12px !important;
  margin: 0 !important;
  border-radius: 1px !important;
  vertical-align: middle !important;
  object-fit: cover !important;
  object-position: center !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  box-shadow: 0 0 0 1px rgba(26, 43, 74, 0.08);
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang span.gt-lang-code,
.synergi-home .xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang span.gt-lang-code {
  min-width: 1.4em;
  text-align: center;
  letter-spacing: 0.06em;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow {
  display: inline-block !important;
  height: 10px !important;
  width: 10px !important;
  margin-left: 2px !important;
  vertical-align: middle !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 8px !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 285 285'><path d='M282 76.5l-14.2-14.3a9 9 0 0 0-13.1 0L142.5 174.4 30.3 62.2a9 9 0 0 0-13.2 0L3 76.5a9 9 0 0 0 0 13.1l133 133a9 9 0 0 0 13.1 0l133-133a9 9 0 0 0 0-13z' fill='%231a2b4a'/></svg>") !important;
  opacity: 0.7;
  transition: transform 0.2s, opacity 0.2s;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang:hover span.gt_float_switcher-arrow {
  opacity: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 285 285'><path d='M282 76.5l-14.2-14.3a9 9 0 0 0-13.1 0L142.5 174.4 30.3 62.2a9 9 0 0 0-13.2 0L3 76.5a9 9 0 0 0 0 13.1l133 133a9 9 0 0 0 13.1 0l133-133a9 9 0 0 0 0-13z' fill='%23c4a35a'/></svg>") !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow.gt_arrow_rotate {
  transform: rotate(180deg);
}

.xy-header-lang-switcher .gt_float_switcher .gt_options {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  left: auto !important;
  float: none !important;
  width: 320px !important;
  max-width: min(320px, calc(100vw - 24px)) !important;
  max-height: min(360px, 65vh) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 10px 8px !important;
  margin: 0 !important;
  background: #fff !important;
  border: 1px solid #e2e6ec !important;
  border-radius: 0 !important;
  box-shadow: 0 12px 28px rgba(26, 43, 74, 0.12) !important;
  z-index: 200 !important;
  white-space: normal !important;
  transform: none !important;
  opacity: 1 !important;
  display: none !important;
  box-sizing: border-box !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-rows: min-content !important;
  align-content: start !important;
  gap: 2px 4px !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt_options.gt-open {
  display: grid !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt_options a {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 9px 10px !important;
  color: #2c3e50 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  text-decoration: none !important;
  text-transform: none !important;
  transition: background 0.15s, color 0.15s !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt_options a:hover {
  background: #f5f7fa !important;
  color: #c4a35a !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt_options a.gt-current {
  display: none !important;
}

.xy-header-lang-switcher .gt_float_switcher .gt_options::-webkit-scrollbar {
  width: 4px;
}
.xy-header-lang-switcher .gt_float_switcher .gt_options::-webkit-scrollbar-thumb {
  background: #c4a35a;
}

@media (max-width: 900px) {
  /* Mobile: hide member in header utils — drawer gets .nav__member-mobile via synergi-home.js */
  .header .xy-member-nav,
  .header__extra > li.xy-member-nav,
  ul.xy-header-extra-nav > li.xy-member-nav {
    display: none !important;
  }

  .xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang {
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
  }
  .xy-header-lang-switcher .gt_float_switcher .gt-selected .gt-current-lang span.gt-lang-code {
    max-width: 4.5em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .xy-header-lang-switcher .gt_float_switcher .gt_options {
    width: min(300px, calc(100vw - 20px)) !important;
    right: -8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
