/* ═══════════════════════════════════════════════
   lang-switcher.css — ES ↔ PT Flag Toggle Widget
   Furtive Apk / Hermesia Project
   ═══════════════════════════════════════════════ */

/* ── Wrapper ── */
.lang-switcher-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  flex-shrink: 0;
}

/* ── Row: flag + toggle + flag ── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.lang-switcher:hover {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

/* ── Flag emojis ── */
.lang-flag {
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Active / inactive visual weight */
.lang-flag-es {
  opacity: 1;
  transform: scale(1.1);
}
.lang-flag-pt {
  opacity: 0.45;
  transform: scale(0.9);
}

/* When PT is active (checkbox is checked) → invert */
.lang-switcher:has(.lang-switcher-checkbox:checked) .lang-flag-es {
  opacity: 0.45;
  transform: scale(0.9);
}
.lang-switcher:has(.lang-switcher-checkbox:checked) .lang-flag-pt {
  opacity: 1;
  transform: scale(1.1);
}

/* ── Toggle track ── */
.lang-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.lang-toggle input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

/* Track */
.lang-thumb {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #d9242a 0%, #ffcc00 100%); /* ES colors */
  transition: background 0.35s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
}

/* Thumb ball */
.lang-thumb::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease;
}

/* Checked → PT colors and thumb slides right */
.lang-toggle input:checked + .lang-thumb {
  background: linear-gradient(135deg, #009C3B 0%, #FFDF00 50%, #009C3B 100%); /* BR colors */
}
.lang-toggle input:checked + .lang-thumb::after {
  transform: translateX(18px);
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

/* Focus ring for accessibility */
.lang-toggle input:focus-visible + .lang-thumb {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════
   Placement overrides per page layout
   ══════════════════════════════════════════════ */

/* index.html — inside nav <ul> */
nav .lang-switcher-wrap {
  margin-left: 8px;
  margin-right: 4px;
}

/* game.html & profile.html — inside .right-side */
.right-side .lang-switcher-wrap {
  margin-right: 10px;
}

/* transferencias.html — inside header */
.header .lang-switcher-wrap {
  margin-left: auto;
  margin-right: 12px;
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
  .lang-flag {
    font-size: 1.1rem;
  }
  .lang-toggle {
    width: 34px;
    height: 18px;
  }
  .lang-thumb::after {
    width: 12px;
    height: 12px;
  }
  .lang-toggle input:checked + .lang-thumb::after {
    transform: translateX(16px);
  }
  .lang-switcher {
    padding: 3px 8px;
    gap: 5px;
  }
}

/* ══════════════════════════════════════════════
   Ninja Hero Flag Switcher
   ══════════════════════════════════════════════ */

.lang-switcher-ninja {
  position: relative;
  width: 260px;
  height: 90px;
  border-radius: 50px;
  overflow: hidden;
  touch-action: none;
  box-shadow:
    0 0 0 2px rgba(0, 255, 80, 0.4),
    0 8px 32px rgba(0, 0, 0, 0.7);
  user-select: none;
  cursor: grab;
}
.lang-switcher-ninja:active { cursor: grabbing; }

.lang-switcher-ninja .flag-bottom {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.lang-switcher-ninja .flag-top {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  will-change: clip-path;
}

.lang-switcher-ninja .ninja-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 44%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  will-change: left;
}

.lang-switcher-ninja .ninja-wrap img {
  height: 118%;
  width: auto;
  object-fit: contain;
}

@media (max-width: 400px) {
  .lang-switcher-ninja {
    width: 200px;
    height: 70px;
  }
}

/* ── Swipe Hint Arrow ── */
.ninja-swipe-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: ninjaHintBounce 0.7s ease-in-out 0.4s 2, ninjaHintFade 0.4s ease-out 1.8s forwards;
  opacity: 1;
}

.ninja-swipe-hint svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 6px rgba(0,255,80,0.9));
}

.ninja-swipe-hint span {
  font-size: 10px;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(0,255,80,0.9);
  white-space: nowrap;
}

@keyframes ninjaHintBounce {
  0%, 100% { transform: translate(-50%, -50%) translateX(0);   opacity: 1; }
  50%       { transform: translate(-50%, -50%) translateX(18px); opacity: 1; }
}

@keyframes ninjaHintFade {
  to { opacity: 0; }
}
