/* Site Switcher — Infinity-themed dropdown */

.site-switcher {
  --sw-accent-a: #00d4ff;
  --sw-accent-b: #7b61ff;
  --sw-accent-c: #ff6ec7;
  --sw-bg: rgba(255, 255, 255, 0.92);
  --sw-bg-2: rgba(247, 249, 252, 0.96);
  --sw-border: rgba(0, 0, 0, 0.08);
  --sw-fg: #0d0f14;
  --sw-fg-soft: #5a6e85;
  --sw-shadow: 0 20px 60px rgba(0, 40, 120, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  --sw-glow: 0 0 24px rgba(0, 168, 255, 0.35);
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10000;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] .site-switcher,
.site-switcher--dark {
  --sw-bg: rgba(14, 19, 34, 0.94);
  --sw-bg-2: rgba(20, 26, 46, 0.98);
  --sw-border: rgba(255, 255, 255, 0.1);
  --sw-fg: #e6edf5;
  --sw-fg-soft: #8ea3bc;
  --sw-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 4px 20px rgba(0, 0, 0, 0.3);
  --sw-glow: 0 0 28px rgba(0, 212, 255, 0.22);
}

.site-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border: 1.5px solid var(--sw-border);
  border-radius: 999px;
  background: var(--sw-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--sw-fg);
  cursor: pointer;
  box-shadow: var(--sw-shadow);
  transition: border-color 0.2s, box-shadow 0.25s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.site-switcher__trigger::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, var(--sw-accent-a), var(--sw-accent-b), var(--sw-accent-c), var(--sw-accent-a));
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s;
  animation: sw-spin 4s linear infinite;
}

.site-switcher__trigger:hover,
.site-switcher__trigger[aria-expanded="true"] {
  border-color: transparent;
  box-shadow: var(--sw-shadow), var(--sw-glow);
  transform: translateY(-1px);
}

.site-switcher__trigger:hover::before,
.site-switcher__trigger[aria-expanded="true"]::before {
  opacity: 1;
}

.site-switcher__trigger::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: inherit;
  background: var(--sw-bg);
  z-index: -1;
}

@keyframes sw-spin {
  to { transform: rotate(360deg); }
}

.site-switcher__infinity {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(123, 97, 255, 0.15));
  flex-shrink: 0;
}

.site-switcher__infinity svg {
  width: 20px;
  height: 20px;
  animation: sw-pulse 2.4s ease-in-out infinite;
}

.site-switcher__infinity path {
  stroke: url(#sw-infinity-grad);
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
}

@keyframes sw-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

.site-switcher__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-switcher__chevron {
  width: 14px;
  height: 14px;
  color: var(--sw-fg-soft);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.site-switcher__trigger[aria-expanded="true"] .site-switcher__chevron {
  transform: rotate(180deg);
}

.site-switcher__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(340px, calc(100vw - 32px));
  border: 1px solid var(--sw-border);
  border-radius: 20px;
  background: var(--sw-bg-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--sw-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top left;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.site-switcher__panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.site-switcher__panel-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  overflow: hidden;
}

.site-switcher__panel-bg svg {
  position: absolute;
  width: 280px;
  height: 140px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: sw-drift 12s ease-in-out infinite alternate;
}

@keyframes sw-drift {
  from { transform: translate(-50%, -50%) rotate(-4deg) scale(1); }
  to { transform: translate(-48%, -52%) rotate(4deg) scale(1.05); }
}

.site-switcher__header {
  position: relative;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--sw-border);
}

.site-switcher__title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sw-fg-soft);
  margin-bottom: 2px;
}

.site-switcher__subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sw-fg);
}

.site-switcher__list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(420px, calc(100vh - 120px));
  overflow-y: auto;
}

.site-switcher__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--sw-fg);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  font-family: inherit;
}

.site-switcher__item:hover,
.site-switcher__item:focus-visible,
.site-switcher__item[data-active-index="true"] {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(123, 97, 255, 0.08));
  border-color: rgba(0, 168, 255, 0.2);
  transform: translateX(2px);
  outline: none;
}

.site-switcher__item--current {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(123, 97, 255, 0.1));
  border-color: rgba(0, 168, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(0, 168, 255, 0.08);
}

.site-switcher__item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(0, 212, 255, 0.18), rgba(123, 97, 255, 0.14));
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--sw-accent-a);
}

.site-switcher__item--current .site-switcher__item-icon {
  background: linear-gradient(145deg, var(--sw-accent-a), var(--sw-accent-b));
  color: #fff;
}

.site-switcher__item-body {
  flex: 1;
  min-width: 0;
}

.site-switcher__item-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.site-switcher__item-tagline {
  display: block;
  font-size: 0.72rem;
  color: var(--sw-fg-soft);
  line-height: 1.3;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-switcher__item-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sw-accent-a);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
}

.site-switcher__item--current .site-switcher__item-check {
  opacity: 1;
  transform: scale(1);
}

.site-switcher__footer {
  position: relative;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--sw-border);
  font-size: 0.68rem;
  color: var(--sw-fg-soft);
  text-align: center;
  letter-spacing: 0.03em;
}

@media (max-width: 640px) {
  .site-switcher {
    top: 10px;
    left: 10px;
  }

  .site-switcher__label {
    display: none;
  }

  .site-switcher__trigger {
    padding: 8px;
  }
}
