﻿/* ================================================================
   NETWORK SHOP — LANGUAGE SWITCHER & MULTI-LANGUAGE STYLES (i18n)
   Languages: Tiếng Việt (vi), English (en), 简体中文 (zh-CN)
   ================================================================ */

/* Hide Google Translate default toolbar, branding and tooltips safely */
.goog-te-banner-frame,
iframe.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  opacity: 0 !important;
}
body {
  top: 0px !important;
  position: static !important;
}
.goog-text-highlight {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
#google_translate_element {
  position: fixed !important;
  bottom: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -9999 !important;
}

/* ================= LANGUAGE SWITCHER COMPONENT ================= */
.nws-lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  user-select: none;
  z-index: 105;
  flex-shrink: 0;
}

/* Desktop & Header Button */
.nws-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 35px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nws-lang-btn:hover,
.nws-lang-switch.open .nws-lang-btn {
  background: rgba(255, 255, 255, 0.22);
  border-color: #e8c85c;
  color: #e8c85c;
}

.nws-lang-btn:focus-visible {
  outline: 2px solid #e8c85c;
  outline-offset: 2px;
}

.nws-lang-flag {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.nws-lang-label {
  letter-spacing: 0.02em;
}

.nws-lang-arrow {
  width: 11px;
  height: 11px;
  transition: transform 0.2s ease;
}

.nws-lang-switch.open .nws-lang-arrow {
  transform: rotate(180deg);
}

/* Scrolled Header adaptation */
header.site.scrolled .nws-lang-btn {
  background: #f6f8fb;
  border-color: #e3e8f0;
  color: #0d1b33;
}

header.site.scrolled .nws-lang-btn:hover,
header.site.scrolled .nws-lang-switch.open .nws-lang-btn {
  background: #f7efd6;
  border-color: #c9a227;
  color: #a8861e;
}

/* Dropdown Menu */
.nws-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 290px;
  max-width: 340px;
  max-height: 440px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 48px -12px rgba(13, 27, 51, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.08);
  padding: 8px 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 150;
  animation: nwsLangFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nws-lang-menu::-webkit-scrollbar {
  width: 5px;
}
.nws-lang-menu::-webkit-scrollbar-track {
  background: transparent;
}
.nws-lang-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
.nws-lang-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.nws-lang-menu-head {
  padding: 6px 12px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b93a7;
  border-bottom: 1px solid #edf2f7;
  margin-bottom: 4px;
}

.nws-lang-group-title {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 6px;
}

@keyframes nwsLangFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nws-lang-switch.open .nws-lang-menu {
  display: flex;
}

/* Option Items */
.nws-lang-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: #16203a;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease;
}

.nws-lang-opt:hover {
  background: #f7efd6;
}

.nws-lang-opt:hover .nws-lang-name {
  color: #8a6a12;
}

.nws-lang-opt-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nws-lang-flag {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  flex-shrink: 0;
}

.nws-lang-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.nws-lang-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1a202c;
  white-space: nowrap;
}

.nws-lang-country {
  font-size: 11px;
  color: #718096;
  margin-top: 1px;
  font-weight: 500;
  white-space: nowrap;
}

.nws-lang-opt.active {
  background: rgba(201, 162, 39, 0.14);
}

.nws-lang-opt.active .nws-lang-name {
  color: #8a6a12;
  font-weight: 800;
}

.nws-lang-opt.active .nws-lang-country {
  color: #8a6a12;
  opacity: 0.85;
}

.nws-lang-check {
  width: 15px;
  height: 15px;
  color: #c9a227;
  flex-shrink: 0;
  opacity: 0;
}

.nws-lang-opt.active .nws-lang-check {
  opacity: 1;
}

/* Mobile Components (Hidden by default on Desktop) */
.nws-mobile-lang {
  display: none !important;
}

.nws-lang-mobile-group {
  display: none !important;
}

/* Desktop header layout hỗ trợ chuyển đổi ngôn ngữ gọn gàng */
@media (min-width: 1181px) {
  .nws-lang-mobile-group {
    display: none !important;
  }
}

@media (max-width: 1180px) {
  .nws-mobile-lang {
    display: inline-flex !important;
    margin-right: 6px;
  }
  .nws-mobile-lang .nws-lang-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  @media (max-width: 600px) {
    .nws-mobile-lang {
      margin-right: 4px;
    }
    .nws-mobile-lang .nws-lang-btn {
      height: 30px;
      padding: 0 7px;
      font-size: 11.5px;
      gap: 4px;
    }
    .nws-mobile-lang .nws-lang-flag {
      font-size: 14px;
    }
    .nws-mobile-lang .nws-lang-menu {
      min-width: 250px;
      max-width: 290px;
      right: -36px;
    }
  }
  
  /* Hide the desktop dropdown that was inserted in nav.main */
  nav.main > .nws-lang-switch {
    display: none !important;
  }
  
  /* In mobile hamburger menu */
  .nws-lang-mobile-group {
    display: block !important;
    padding: 16px 4px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 14px;
  }
  .nws-lang-mobile-title {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    display: block;
  }
  .nws-lang-mobile-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  @media (min-width: 480px) {
    .nws-lang-mobile-pills {
      grid-template-columns: repeat(3, 1fr);
    }
  }
  .nws-lang-pill {
    padding: 8px 6px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  .nws-lang-pill-flag {
    font-size: 18px;
    line-height: 1;
  }
  .nws-lang-pill-name {
    font-size: 12px;
    font-weight: 700;
  }
  .nws-lang-pill-sub {
    font-size: 9.5px;
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .nws-lang-pill.active {
    background: linear-gradient(120deg, #e8c85c, #c9a227);
    color: #201a05;
    border-color: #e8c85c;
  }
  .nws-lang-pill.active .nws-lang-pill-sub {
    color: #201a05;
    opacity: 0.9;
  }
}

/* Floating Language Switcher Badge (Optional corner helper) */
.nws-lang-float {
  position: fixed;
  left: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 85;
}
.nws-lang-float .nws-lang-btn {
  height: 42px;
  padding: 0 16px;
  background: #0d1b33;
  color: #fff;
  border: 1.5px solid rgba(232, 200, 92, 0.5);
  box-shadow: 0 10px 24px -8px rgba(13, 27, 51, 0.65);
}
.nws-lang-float .nws-lang-btn:hover {
  border-color: #e8c85c;
  background: #142a4d;
  color: #e8c85c;
}
.nws-lang-float .nws-lang-menu {
  top: auto;
  bottom: calc(100% + 8px);
  right: auto;
  left: 0;
}
@media (max-width: 600px) {
  .nws-lang-float {
    display: none; /* Mobile header & menu are sufficient */
  }
}
