/**
 * TelccFree — Global Language Selector (premium flags + Google Translate)
 * flag-icons loaded via <link> in HTML (no @import).
 */

:root {
  --telc-fb-blue: #1877f2;
  --telc-fb-blue-soft: rgba(24, 119, 242, 0.1);
  --telc-lang-radius-trigger: 1rem;
  --telc-lang-radius-menu: 1.5rem;
}

/* ── Hide default Google Translate UI ── */
.goog-te-banner-frame,
.skiptranslate,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-menu-value span:nth-child(2),
.goog-te-gadget-icon {
  display: none !important;
}

body {
  top: 0 !important;
}

#google_translate_element,
.goog-te-gadget {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
}

html.translated-ltr,
html.translated-rtl {
  margin-top: 0 !important;
}

.telc-lang-selector {
  position: relative;
  display: inline-flex;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  z-index: 2100;
}

.telc-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 2px solid var(--telc-fb-blue);
  border-radius: var(--telc-lang-radius-trigger);
  background: #f3f4f6;
  color: #1a1a2e;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.08);
  white-space: nowrap;
}

.telc-lang-trigger:hover,
.telc-lang-trigger:focus-visible {
  background: #eef2ff;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  transform: translateY(-4px);
  border-color: var(--telc-fb-blue);
  outline: none;
}

.telc-lang-trigger:active {
  transition-duration: 100ms;
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.telc-lang-trigger[aria-expanded="true"] {
  background: var(--telc-fb-blue-soft);
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.2);
}

.telc-lang-label {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telc-lang-chevron {
  font-size: 11px;
  color: var(--telc-fb-blue);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.telc-lang-trigger[aria-expanded="true"] .telc-lang-chevron {
  transform: rotate(180deg);
}

/* ── Premium circular flag badges ── */
.telc-flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid rgba(24, 119, 242, 0.22);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  background: #fff;
  position: relative;
}

.telc-flag-badge--menu {
  width: 26px;
  height: 26px;
}

.telc-flag-badge .fi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  border-radius: 9999px;
}

.telc-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: min(280px, calc(100vw - 24px));
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(24, 119, 242, 0.14);
  border-radius: var(--telc-lang-radius-menu);
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.12),
    0 4px 12px rgba(24, 119, 242, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: all 0.3s ease;
  max-height: min(360px, calc(100vh - 120px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.telc-lang-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.telc-lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: calc(var(--telc-lang-radius-trigger) - 2px);
  background: transparent;
  color: #1a1a2e;
  text-align: start;
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.telc-lang-option:hover,
.telc-lang-option:focus-visible {
  background: #f3f4f6;
  outline: none;
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border: 1px solid rgba(24, 119, 242, 0.35);
}

.telc-lang-option:active {
  transition-duration: 100ms;
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.telc-lang-option.is-active,
.telc-lang-option[aria-selected="true"] {
  background: var(--telc-fb-blue-soft);
  color: #0d47a1;
}

.telc-lang-option-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.telc-lang-native {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  unicode-bidi: plaintext;
}

.telc-lang-sub {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.2;
}

.telc-lang-option.is-active .telc-lang-sub,
.telc-lang-option[aria-selected="true"] .telc-lang-sub {
  color: #2563eb;
}

.telc-lang-option[data-dir="rtl"] .telc-lang-option-text {
  align-items: flex-end;
  text-align: right;
  width: 100%;
}

html.dark .telc-lang-trigger {
  background: #1e293b;
  color: #f1f5f9;
}

html.dark .telc-lang-menu {
  background: #1e293b;
  border-color: #334155;
}

html.dark .telc-lang-option {
  color: #f1f5f9;
}

html.dark .telc-lang-option:hover {
  background: #334155;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow:
    0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1),
    0 0 0 1px rgba(96, 165, 250, 0.22);
}

html.dark .telc-flag-badge {
  border-color: rgba(148, 163, 184, 0.35);
  background: #0f172a;
}

.telc-portal-lang-bar,
.telc-portal-header-utils {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.telc-lang-mount--portal,
.telc-lang-mount--navbar {
  display: inline-flex;
}

.navbar-actions.telc-header-utils {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 720px) {
  .telc-lang-trigger {
    padding: 7px 11px;
    min-height: 36px;
    font-size: 12px;
  }

  .telc-lang-label {
    max-width: 6.5rem;
  }

  .telc-lang-menu {
    min-width: min(260px, calc(100vw - 20px));
  }

  .telc-portal-lang-bar {
    top: 10px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  .telc-lang-label {
    display: none;
  }

  .telc-lang-trigger {
    gap: 6px;
    padding: 8px 10px;
  }
}
