/* ============================================================
   GOODLADY FINANCE — Language Switcher Widget v1.0
   Positioned bottom-left, stacked above #gl-a11y-widget.
   Matches the visual style of accessibility-modes.css.
   ============================================================ */

/* ── Widget container ──────────────────────────────────────── */
#gl-lang-widget {
  position: fixed;
  bottom: 86px; /* 30px (a11y base) + 44px (a11y button) + 12px gap */
  left: 20px;
  z-index: 99998; /* Just below a11y widget */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: "Inter", "Outfit", sans-serif;
}

/* ── Globe toggle button ────────────────────────────────────── */
#gl-lang-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a5f5f; /* Deep teal — distinct from gold a11y button */
  border: 2px solid rgba(197, 160, 89, 0.5);
  color: #c5a059;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(26, 95, 95, 0.3);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

#gl-lang-toggle:hover,
#gl-lang-toggle:focus {
  background: #236e6e;
  border-color: #c5a059;
  outline: 3px solid #c5a059;
  outline-offset: 2px;
  transform: scale(1.08);
}

/* ── Panel ──────────────────────────────────────────────────── */
#gl-lang-panel {
  display: none;
  flex-direction: column;
  background: rgba(10, 25, 30, 0.97);
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 14px;
  overflow: hidden;
  width: 230px;
  max-height: 420px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  animation: gl-lang-slide-in 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  /* Opens upward anchored to left */
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
}

#gl-lang-panel.is-open {
  display: flex;
}

@keyframes gl-lang-slide-in {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Panel header + search ──────────────────────────────────── */
.gl-lang-panel-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.gl-lang-panel-header h4 {
  color: #c5a059 !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  margin: 0 0 10px 0 !important;
  padding: 0 !important;
  border: none !important;
}

#gl-lang-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.3);
  border-radius: 8px;
  padding: 7px 10px;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#gl-lang-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#gl-lang-search:focus {
  border-color: #c5a059;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Language list ──────────────────────────────────────────── */
#gl-lang-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(197, 160, 89, 0.3) transparent;
}

#gl-lang-list::-webkit-scrollbar {
  width: 4px;
}

#gl-lang-list::-webkit-scrollbar-track {
  background: transparent;
}

#gl-lang-list::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.3);
  border-radius: 2px;
}

#gl-lang-list li {
  padding: 8px 14px;
  color: #cbd5e1;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  user-select: none;
}

#gl-lang-list li:hover,
#gl-lang-list li:focus {
  background: rgba(197, 160, 89, 0.12);
  color: #fff;
  outline: none;
}

#gl-lang-list li.is-active {
  background: rgba(197, 160, 89, 0.18);
  color: #c5a059;
  font-weight: 600;
}

#gl-lang-list li.is-active::before {
  content: '✓ ';
  font-weight: 700;
}

/* Empty state when search has no results */
#gl-lang-list:empty::after {
  content: 'No languages found';
  display: block;
  padding: 16px 14px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
  text-align: center;
}

/* ── Google Translate overrides ─────────────────────────────── */
/* Hide Google's default toolbar banner — we handle UI ourselves */
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover {
  display: none !important;
  visibility: hidden !important;
}

.goog-te-spinner-pos {
  display: none !important;
}

body {
  top: 0 !important; /* Prevent GT pushing page down */
}

/* ── Colour mode overrides ──────────────────────────────────── */
[data-a11y-mode="black"] #gl-lang-toggle {
  background: #004444;
  border-color: #ffdd00;
  color: #ffdd00;
}

[data-a11y-mode="white"] #gl-lang-toggle {
  background: #005577;
  border-color: #0055cc;
  color: #fff;
}

[data-a11y-mode="black"] #gl-lang-panel {
  background: #0a0a0a;
  border-color: #ffdd00;
}

[data-a11y-mode="white"] #gl-lang-panel {
  background: #ffffff;
  border-color: #0055cc;
}

[data-a11y-mode="white"] #gl-lang-list li {
  color: #1a1a1a;
}

[data-a11y-mode="white"] #gl-lang-search {
  background: #f0f0f0;
  color: #000;
  border-color: rgba(0, 85, 204, 0.4);
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #gl-lang-widget {
    bottom: 144px; /* 88px (a11y base) + 44px (a11y button) + 12px gap */
    left: 12px;
  }

  #gl-lang-panel {
    width: 210px;
    max-height: 340px;
  }
}

/* ── Navbar-mount overrides ─────────────────────────────────── */
/* Applied when widget is inside #nav-utility-group */
#gl-lang-widget[data-mount="navbar"] {
  position: static;
  bottom: unset;
  left: unset;
  z-index: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
}

#gl-lang-widget[data-mount="navbar"] #gl-lang-toggle {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  box-shadow: none;
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.15);
}

#gl-lang-widget[data-mount="navbar"] #gl-lang-panel {
  /* Drop DOWN from navbar, anchored right */
  position: absolute;
  top: calc(100% + 8px);
  bottom: unset;
  left: auto;
  right: 0;
  z-index: 99999;
  width: 240px;
  max-height: 380px;
}

