/* =========================================================
   Job switch CTA — "Find Jobs Abroad" (index.php) and
   "Find Local Jobs" (foreign_jobs.php).

   Two placements of the same link:
   - .jn-switch--toolbar : compact pill inside the sticky filter
                           toolbar, shown above 900px.
   - .jn-switch--mobile  : full-width card directly below the toolbar,
                           shown at 900px and below (kept out of the
                           sticky bar so it doesn't eat scroll space).
   ========================================================= */

.jn-switch {
  --jn-brand: #135873;
  --jn-brand-2: #1f8fb5;
  --jn-accent: #f4b63f;
  --jn-icon-bg: linear-gradient(135deg, var(--jn-brand) 0%, var(--jn-brand-2) 100%);

  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

/* Local variant: Sri Lanka flag maroon + saffron accents */
.jn-switch--local {
  --jn-accent: #f7b718;
  --jn-icon-bg: linear-gradient(135deg, #8d153a 0%, #b8325a 100%);
}

.jn-switch:focus-visible {
  outline: 3px solid var(--jn-accent);
  outline-offset: 2px;
}

.jn-switch__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--jn-icon-bg);
  color: #fff;
  position: relative;
}

/* Soft pulsing ring around the icon to draw the eye */
.jn-switch__icon::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--jn-accent);
  opacity: 0;
  animation: jn-switch-pulse 2.6s ease-out infinite;
}

.jn-switch__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
  text-align: left;
}

.jn-switch__title {
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .1px;
}

.jn-switch__sub {
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jn-switch__arrow {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--jn-accent);
  color: #0f3950;
  transition: transform .2s ease;
}

.jn-switch:hover .jn-switch__arrow,
.jn-switch:focus-visible .jn-switch__arrow {
  transform: translateX(3px);
}

/* Light sweep across the button every few seconds */
.jn-switch::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, .45) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: jn-switch-shine 5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes jn-switch-pulse {
  0%   { transform: scale(.85); opacity: .9; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes jn-switch-shine {
  0%, 60% { left: -60%; }
  100%    { left: 130%; }
}

/* ---------- Toolbar pill (desktop / large tablet) ---------- */
.jn-switch--toolbar {
  flex: 0 0 auto;
  padding: 5px 6px 5px 5px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 4px 14px rgba(5, 40, 60, .28);
}

.jn-switch--toolbar:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(5, 40, 60, .35);
}

.jn-switch--toolbar .jn-switch__icon {
  width: 32px;
  height: 32px;
  font-size: 15px;
}

.jn-switch--toolbar .jn-switch__title {
  font-size: 14px;
  color: var(--jn-brand);
}

.jn-switch--local.jn-switch--toolbar .jn-switch__title {
  color: #8d153a;
}

.jn-switch--toolbar .jn-switch__sub {
  font-size: 11px;
  color: #5b7280;
}

.jn-switch--toolbar .jn-switch__arrow {
  width: 24px;
  height: 24px;
  font-size: 11px;
  margin-left: 4px;
}

.jn-switch--toolbar::before {
  background: linear-gradient(100deg, transparent 0%, rgba(19, 88, 115, .12) 50%, transparent 100%);
}

/* Narrow desktop: keep the pill on one line next to the filters */
@media (max-width: 1000px) {
  .jn-switch--toolbar .jn-switch__sub { display: none; }
}

/* ---------- Mobile card ---------- */
.jn-switch--mobile {
  display: none;
}

@media (max-width: 900px) {
  .jn-switch--toolbar {
    display: none !important;
  }

  .jn-switch--mobile {
    display: flex;
    margin: 10px 10px 12px;
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 16px;
    background: linear-gradient(120deg, #135873 0%, #17698a 55%, #1f8fb5 100%);
    box-shadow: 0 6px 18px rgba(19, 88, 115, .35);
    color: #fff;
  }

  .jn-switch--local.jn-switch--mobile {
    background: linear-gradient(120deg, #135873 0%, #17698a 60%, #1f7f9f 100%);
    padding-left: 18px;
  }

  /* Sri Lanka flag colour strip on the left edge of the local card */
  .jn-switch--local.jn-switch--mobile .jn-switch__flag {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(to bottom, #00534e 0 33%, #f7b718 33% 66%, #8d153a 66% 100%);
  }

  .jn-switch--mobile:active {
    transform: scale(.98);
  }

  .jn-switch--mobile .jn-switch__icon {
    width: 40px;
    height: 40px;
    font-size: 19px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .35);
  }

  .jn-switch--local.jn-switch--mobile .jn-switch__icon {
    background: var(--jn-icon-bg);
    border-color: rgba(255, 255, 255, .5);
  }

  .jn-switch--mobile .jn-switch__text {
    flex: 1 1 auto;
  }

  .jn-switch--mobile .jn-switch__title {
    font-size: 16px;
    color: #fff;
  }

  .jn-switch--mobile .jn-switch__sub {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .85);
    margin-top: 2px;
  }

  .jn-switch--mobile .jn-switch__arrow {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

/* Step the supporting text down so it stays on one line on common phones */
@media (max-width: 380px) {
  .jn-switch--mobile .jn-switch__title { font-size: 15px; }
  .jn-switch--mobile .jn-switch__sub   { font-size: 11.5px; }
}

/* Very narrow phones: let the supporting line wrap rather than cut off */
@media (max-width: 340px) {
  .jn-switch--mobile { gap: 8px; padding: 9px 10px; }
  .jn-switch--local.jn-switch--mobile { padding-left: 16px; }
  .jn-switch--mobile .jn-switch__sub {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .jn-switch--mobile .jn-switch__arrow { width: 26px; height: 26px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .jn-switch,
  .jn-switch__arrow { transition: none; }
  .jn-switch::before,
  .jn-switch__icon::after { animation: none; display: none; }
}

/* Flag strip is only drawn on the mobile local card */
.jn-switch__flag { display: none; }
@media (max-width: 900px) {
  .jn-switch--local.jn-switch--mobile .jn-switch__flag { display: block; }
}
