/* Floating language widget (chat-style) */

.hs-lang-float {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 240;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
  font-family: var(--font, system-ui, sans-serif);
  pointer-events: none;
}

.hs-lang-float > * {
  pointer-events: auto;
}

/* After first pick: hide FAB until opened from footer */
.hs-lang-float.is-dismissed:not(.is-open) .hs-lang-float-fab,
.hs-lang-float.is-dismissed:not(.is-open) .hs-lang-float-panel {
  display: none;
}

.hs-lang-float-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.15rem;
  padding: 0.55rem 0.95rem 0.55rem 0.7rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, #10b981 0%, #059669 55%, #047857 100%);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(5, 150, 105, 0.38), 0 2px 8px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.hs-lang-float-fab:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 32px rgba(5, 150, 105, 0.45), 0 2px 8px rgba(15, 23, 42, 0.14);
}

.hs-lang-float-fab:focus-visible {
  outline: 2px solid #047857;
  outline-offset: 3px;
}

.hs-lang-float-fab-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.hs-lang-float-fab-label {
  letter-spacing: 0.02em;
}

.hs-lang-float-panel {
  width: min(20.5rem, calc(100vw - 1.5rem));
  background: #fff;
  border: 1px solid var(--hs-border, #d8ebe2);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16), 0 4px 14px rgba(5, 150, 105, 0.08);
  overflow: hidden;
  transform-origin: bottom right;
  animation: hsLangFloatIn 0.22s ease;
}

.hs-lang-float-panel[hidden] {
  display: none !important;
}

@keyframes hsLangFloatIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hs-lang-float-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 0.95rem 0.75rem;
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 100%);
  border-bottom: 1px solid rgba(5, 150, 105, 0.12);
}

.hs-lang-float-head-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.hs-lang-float-head-text strong {
  font-size: 0.98rem;
  color: #0f1f17;
}

.hs-lang-float-head-text span {
  font-size: 0.8rem;
  color: var(--hs-muted, #5b6f66);
  line-height: 1.35;
}

.hs-lang-float-x {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--hs-border, #d8ebe2);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.hs-lang-float-x:hover {
  color: #047857;
  border-color: #059669;
  background: #ecfdf5;
}

.hs-lang-float-list {
  display: flex;
  flex-direction: column;
  max-height: min(50vh, 20rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.4rem;
}

.hs-lang-float-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  text-decoration: none;
  color: #0f1f17;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.12s ease;
}

.hs-lang-float-item:hover {
  background: #ecfdf5;
  text-decoration: none;
}

.hs-lang-float-item.is-active {
  background: #d1fae5;
  color: #047857;
}

.hs-lang-float-flag {
  font-size: 1.2rem;
  line-height: 1;
}

.hs-lang-float-name {
  min-width: 0;
}

.hs-lang-float-code {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

/* Footer reopen control */
.hs-footer-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.2rem 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  opacity: 0.9;
}

.hs-footer-lang-btn:hover {
  color: #059669;
  text-decoration: underline;
  opacity: 1;
}

.hs-footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

/* Keep above cookie bar if present */
@media (max-width: 520px) {
  .hs-lang-float {
    right: 0.75rem;
    bottom: 0.75rem;
  }
  .hs-lang-float-fab {
    min-height: 2.9rem;
    padding: 0.5rem 0.85rem 0.5rem 0.65rem;
  }
  /* Lift a bit if cookie banner might cover */
  body:has(.hs-cookie-banner:not([hidden])) .hs-lang-float {
    bottom: max(5.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.5rem));
  }
}
