/* —— Language switcher —— */

/* Slot in page chrome (preferred) */
.lang-switch-slot {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.45rem 0.28rem 0.55rem;
  border-radius: 999px;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.78rem;
  line-height: 1.2;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Integrated in topbar / headers */
.lang-switch--inline {
  position: static;
  z-index: auto;
  background: rgba(8, 16, 36, 0.65);
  border: 1px solid rgba(0, 212, 255, 0.18);
  color: #cbd5e1;
  box-shadow: none;
  min-height: 2.35rem;
}

/* Map topbar: match .stat visual weight */
.top-stats .lang-switch--inline,
.topbar .lang-switch--inline {
  background: rgba(8, 16, 36, 0.65);
  border: 1px solid rgba(0, 212, 255, 0.12);
  padding: 0.4rem 0.65rem;
}

/* Fallback floating (pages without a slot) */
.lang-switch--float {
  position: fixed;
  z-index: 80;
  top: max(0.55rem, env(safe-area-inset-top));
  right: max(0.55rem, env(safe-area-inset-right));
  background: rgba(8, 16, 34, 0.9);
  border: 1px solid rgba(0, 212, 255, 0.22);
  color: #cbd5e1;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* News light theme */
body.news-page .lang-switch--inline,
body.news-page .lang-switch--float {
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.lang-switch-label {
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
  white-space: nowrap;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background-color: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0.15rem 1rem 0.15rem 0.1rem;
  cursor: pointer;
  max-width: 8.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
}

.lang-select:focus {
  outline: 2px solid rgba(14, 165, 233, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

.lang-select option {
  color: #0f172a;
  background: #fff;
}

html[dir="rtl"] .lang-switch--float {
  right: auto;
  left: max(0.55rem, env(safe-area-inset-left));
}

html[dir="rtl"] .lang-select {
  padding: 0.15rem 0.1rem 0.15rem 1rem;
  background-position: left 0 center;
}

.news-lang-note {
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-size: 0.88rem;
}

/* Live header: place slot next to clock pill */
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.title-row .title-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Fleet hero nav */
.hero-nav .lang-switch-slot {
  margin-left: auto;
}

@media (max-width: 760px) {
  .lang-switch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }

  .top-stats .lang-switch--inline,
  .topbar .lang-switch--inline {
    padding: 0.3rem 0.5rem;
    min-height: auto;
  }

  .lang-select {
    max-width: 6.5rem;
    font-size: 0.75rem;
  }

  /* Never cover the Madrid clock: keep inside flex, allow wrap */
  .top-stats {
    max-width: 100%;
  }
}
