/* ============================================================
   VegasBet — Language switcher (lang-switch.css)

   Markup: templates/_lang_pill.html (the trigger, in the board
   sidebar, the mobile drawer and the footer) and
   templates/_lang_modal.html (the "Language Change" dialog, once,
   at body level in base.html). Wiring: static/js/lang-switch.js.

   Prefix `lsw-`. The overlay carries its own [hidden] override
   because its display:flex would otherwise beat the UA's
   [hidden] rule — the site-wide cascade footgun.
   ============================================================ */

/* ── Pill (trigger) ─────────────────────────────────────────── */
.lsw-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(124, 58, 237, 0.10);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease,
              box-shadow 0.18s ease, transform 0.18s ease;
}
.lsw-pill:hover,
.lsw-pill:focus-visible {
  background: rgba(124, 58, 237, 0.20);
  border-color: var(--purple);
  box-shadow: 0 0 14px var(--purple-glow);
  outline: none;
}
.lsw-pill:active { transform: translateY(1px); }

.lsw-globe {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color 0.18s ease;
}
.lsw-pill:hover .lsw-globe { color: var(--accent); }

.lsw-pill-label { color: var(--text-secondary); }
.lsw-pill-code  { font-weight: 800; letter-spacing: 0.04em; }

.lsw-flag {
  width: 20px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* Sidebar / drawer variant: a card in the column's own language —
   same border, radius and glow as .sidebar-nav-links. */
.lsw-pill--card {
  display: flex;
  width: 100%;
  justify-content: center;
  padding: 9px 12px;
  border: 1.5px solid #7c3aed;
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3),
              0 0 20px rgba(124, 58, 237, 0.12);
  font-size: 14px;
}
.lsw-pill--card:hover,
.lsw-pill--card:focus-visible {
  background: var(--bg-card-hover);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.45),
              0 0 28px rgba(124, 58, 237, 0.18);
}

/* Footer: the pill is pinned to the right edge of the sections row and
   is NOT a flex item — the three columns keep their centred layout, and
   the pill sits 6px under the divider (its earlier -8px nudge put its top
   edge ON the line; a small drop is what the owner asked for). */
.site-footer .footer-sections { position: relative; }
.site-footer .footer-lang {
  position: absolute;
  top: 6px;
  right: 0;
}
/* The footer's generic hover-scale rule targets every <a>/<button>;
   the pill has its own hover, so pin it. */
.site-footer .lsw-pill:hover,
.site-footer .lsw-pill:focus-visible { transform: none; }
.site-footer .lsw-pill:active { transform: translateY(1px); }

/* ── Dialog ─────────────────────────────────────────────────── */
.lsw-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: lswOverlayIn 0.2s ease both;
}
.lsw-overlay:not([hidden]) { display: flex; }
.lsw-overlay[hidden] { display: none; }

.lsw-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(157, 93, 245, 0.28);
  background: linear-gradient(180deg, #1e1a2b 0%, #151119 100%);
  box-shadow: 0 30px 90px -20px rgba(124, 58, 237, 0.55),
              0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: lswCardIn 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.lsw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  flex-shrink: 0;
}
.lsw-title {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
}
.lsw-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.lsw-close:hover,
.lsw-close:focus-visible {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--purple);
  outline: none;
}
.lsw-close svg { width: 16px; height: 16px; }

.lsw-list {
  list-style: none;
  margin: 0;
  padding: 0 10px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.lsw-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.lsw-item:hover,
.lsw-item:focus-visible {
  background: var(--purple-dim);
  color: var(--text-primary);
  outline: none;
}
.lsw-item.is-current {
  background: rgba(124, 58, 237, 0.16);
  color: var(--text-primary);
}
.lsw-item.is-dim { opacity: 0.45; pointer-events: none; }

.lsw-item-name { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.lsw-item-code { font-weight: 800; color: inherit; }
.lsw-item-native { font-weight: 500; opacity: 0.85; }

.lsw-selected {
  margin-left: auto;
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lsw-spinner {
  display: none;
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lswSpin 0.7s linear infinite;
}
.lsw-item.is-loading .lsw-spinner  { display: block; }
.lsw-item.is-loading .lsw-selected { display: none; }

@keyframes lswOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lswCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes lswSpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lsw-overlay, .lsw-card { animation: none; }
}

@media (max-width: 768px) {
  /* Stacked footer: back into the flow, centred under the columns. */
  .site-footer .footer-lang {
    position: static;
    display: flex;
    justify-content: center;
    width: 100%;
  }
  .lsw-card { max-width: 440px; }
}
