/* ======================================================================
   ĐỊNH DẠNG NÚT GOOGLE DỊCH THEO THEME LIQUID GLASS (NÚT TRÒN)
   ====================================================================== */

#google_translate_wrapper {
  position: fixed;
  top: 20px;
  right: 80px; /* Đặt sang góc phải trên cùng cho gọn gàng */
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#google_translate_wrapper:hover {
  transform: translateY(-2px); /* Hiệu ứng nảy lên nhẹ nhàng */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* LỚP NỀN KÍNH MỜ (LIQUID GLASS) */
#google_translate_wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-glass),
    var(--secondary-glass)
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: -2;
}

/* ĐƯỜNG ÁNH SÁNG CHẠY VIỀN (LIQUID GLASS BORDER) */
#google_translate_wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(
    from var(--angle),
    transparent 70%,
    var(--primary) 80%,
    var(--primary) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: rotateLight 4s linear infinite;
  z-index: -1;
}

.translate-icon {
  width: 80%; /* Phóng to icon quả địa cầu trên máy tính */
  height: 80%;
  stroke: #ffffff;
  z-index: 1; /* Nổi icon lên trên nền kính */
  pointer-events: none; /* Bỏ chặn click qua icon để bấm trúng thanh chọn */
  filter: drop-shadow(1px 1px 3px rgba(255, 252, 252, 0.5));
}

/* Khung chứa chọn ngôn ngữ của Google */
#google_translate_element {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  border-radius: 50%;
  overflow: hidden; /* Không để thanh select lòi ra ngoài */
}

/* Ẩn thanh Banner, Tooltip và các thành phần thừa của Google Translate */
.goog-te-banner-frame.skiptranslate,
.skiptranslate > iframe.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.VIpgJd-Zvi9od-aZ2wEe-wOHMyf,
.VIpgJd-Zvi9od-ORHb-OEVmcd,
iframe.goog-te-banner-frame,
body > div.skiptranslate {
  display: none !important;
}

/* Ép thẻ html và body không bị dịch chuyển xuống dưới, vô hiệu hóa highlight chữ */
html,
body {
  top: 0px !important;
  margin-top: 0px !important;
  padding-top: 0px !important;
}
.goog-text-highlight {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Ẩn chữ thừa và text "Powered by Google" */
#google_translate_element,
#google_translate_element span,
#google_translate_element div {
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

/* Ẩn triệt để hình ảnh, link Logo của Google (chữ đen) */
#google_translate_element a,
#google_translate_element img,
#google_translate_element svg,
.goog-logo-link {
  display: none !important;
}

/* LÀM TÀNG HÌNH THANH CHỌN NGÔN NGỮ (CHỈ CÒN ICON TRÒN) */
#google_translate_element select {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0.0001 !important; /* Làm tàng hình nhưng vẫn bấm được */
  color: transparent !important; /* Đảm bảo chữ "Dịch" đang chọn không bị lộ */
  cursor: pointer !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  z-index: 10 !important;
}

/* Menu danh sách thả xuống có nền tối, chữ trắng cho hợp theme */
#google_translate_element select option {
  color: #e5e5e5 !important; /* Màu chữ trắng ngà, dễ đọc */
  background-color: #282c34 !important; /* Nền xám đen, giống màu code editor */
  font-family: "Noto Sans", sans-serif !important;
  font-size: 14px !important;
}

/* Tự động thu gọn khoảng cách trên điện thoại di động */
@media screen and (max-width: 767px) {
  #google_translate_wrapper {
    top: 15px;
    right: 75px; /* Kéo nút thụt sang trái để né nút Lượt Truy Cập */
    width: 45px; /* Giữ khung nút bự để dễ bấm chạm */
    height: 45px;
  }
  .translate-icon {
    width: 80%; /* Đồng bộ icon chiếm 80% diện tích nút trên điện thoại */
    height: 80%;
  }
}
