/* =====================================================================
   Multi-language picker (top-left of home screen)
   Covers 18 languages via Google Translate + native KO/EN
   ===================================================================== */

/* Use the ID selector to out-specific the master
   "#screen-home > :not(.home-bg) { position: relative; z-index: 2; }" rule
   in style.css. Without this, .home-hero (z=2, sibling) was rendering its
   AI badge ON TOP of the 18-language dropdown.
   Moved down to top: 50px so the picker sits BELOW the XP bar
   ("의학생 LV.1 / 0 XP") instead of covering the level-text on the left. */
#lang-picker-wrap.lang-picker-wrap,
.lang-picker-wrap {
  position: absolute;
  top: 50px;
  left: 14px;
  z-index: 9999;
  font-family: inherit;
}

.lang-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0d3880;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(13, 56, 128, 0.25);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  transition: all 0.18s;
}
.lang-picker-btn:hover {
  background: #fff;
  border-color: rgba(13, 56, 128, 0.45);
  box-shadow: 0 6px 18px rgba(13, 56, 128, 0.22);
  transform: translateY(-1px);
}
.lang-picker-btn:active { transform: scale(0.98); }

.lang-picker-caret {
  font-size: 0.6rem;
  color: #94a3b8;
  margin-left: 3px;
}

.lang-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px;
  background: #ffffff;
  border: 1px solid rgba(13, 56, 128, 0.15);
  border-radius: 14px;
  /* Stronger shadow + explicit z-index so the menu sits on top of every
     other hero element (AI badge, credential bar, doctor SVG, etc.) */
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(13, 56, 128, 0.08);
  z-index: 10000;
  display: none;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
}
.lang-picker-menu.open {
  display: flex;
  animation: langPickerFadeIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes langPickerFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lang-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: background 0.12s;
}
.lang-picker-item:hover {
  background: rgba(13, 56, 128, 0.08);
}
.lang-picker-item.active {
  background: rgba(13, 56, 128, 0.12);
  color: #0d3880;
}
.lang-picker-item-flag {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
}
.lang-picker-item-name {
  flex: 1;
  min-width: 0;
}
.lang-picker-item-badge {
  font-size: 0.6rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.lang-picker-item-check {
  font-size: 0.95rem;
  color: #10b981;
  font-weight: 800;
}

/* Hide Google Translate's default banner/tooltip */
.goog-te-banner-frame,
.skiptranslate {
  display: none !important;
  visibility: hidden !important;
}
body { top: 0 !important; position: static !important; }

.goog-te-gadget { display: none !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight {
  background: transparent !important;
  box-shadow: none !important;
}

/* Google Translate adds title="..." attrs that show big tooltips — disable */
[style*="z-index: 2000000000"] { display: none !important; }

/* Toast for language change */
.lang-toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #0d3880, #00b8f0);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 184, 240, 0.42);
  z-index: 10000;
  max-width: calc(100% - 40px);
  text-align: center;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.35s;
  font-family: 'Inter', 'Noto Serif KR', sans-serif;
  white-space: nowrap;
}
.lang-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .lang-picker-wrap {
    top: 46px;  /* still below the XP bar on mobile */
    left: 10px;
  }
  .lang-picker-btn {
    padding: 6px 10px;
    font-size: 0.76rem;
  }
  .lang-picker-menu {
    min-width: 220px;
    max-height: 70vh;
  }
  .lang-picker-item {
    padding: 9px 11px;
    font-size: 0.88rem;
  }
  .lang-toast {
    font-size: 0.8rem;
    padding: 10px 16px;
  }
}
