/*
  Azrak Fediverse Switcher
  Shared across Pixelfed/Lemmy/Mastodon via reverse-proxy injection.
*/

:root {
  --azrak-switcher-width: 280px;
  --azrak-switcher-tab: 48px;
  --azrak-switcher-radius: 14px;
  --azrak-switcher-z: 2147483647;
}

#azrak-fediverse-switcher {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: var(--azrak-switcher-z);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: #e5e7eb;
}

#azrak-fediverse-switcher * { box-sizing: border-box; }

/* Container */
#azrak-fediverse-switcher {
  display: flex;
  align-items: stretch;
  gap: 0;
  transition: transform 220ms ease;
}

/* Closed state: slide so only the handle tab remains visible */
#azrak-fediverse-switcher:not(.azrak-open) {
  transform: translateY(-50%) translateX(calc(100% - var(--azrak-switcher-tab)));
}

/* Left-side mode */
#azrak-fediverse-switcher.azrak-left {
  right: auto;
  left: 0;
  flex-direction: row-reverse;
}

#azrak-fediverse-switcher.azrak-left:not(.azrak-open) {
  transform: translateY(-50%) translateX(calc(-100% + var(--azrak-switcher-tab)));
}

#azrak-fediverse-switcher.azrak-dragging {
  transition: none;
  cursor: grabbing;
}

/* Handle */
#azrak-fediverse-switcher .azrak-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--azrak-switcher-tab);
  height: 132px;
  cursor: pointer;
  user-select: none;
  /* Explicit colors to avoid site CSS overriding button text to black */
  background: rgba(15, 23, 42, 0.98);
  color: #f9fafb !important;
  -webkit-text-fill-color: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-right: none;
  border-top-left-radius: var(--azrak-switcher-radius);
  border-bottom-left-radius: var(--azrak-switcher-radius);
  box-shadow: -8px 0 24px rgba(0,0,0,0.35);
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-shadow: 0 1px 0 rgba(0,0,0,0.65);
}

#azrak-fediverse-switcher.azrak-left .azrak-handle {
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--azrak-switcher-radius);
  border-bottom-right-radius: var(--azrak-switcher-radius);
  box-shadow: 8px 0 24px rgba(0,0,0,0.35);
}

/* Panel */
.azrak-panel {
  width: var(--azrak-switcher-width);
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-right: none;
  border-top-left-radius: var(--azrak-switcher-radius);
  border-bottom-left-radius: var(--azrak-switcher-radius);
  padding: 14px 14px 12px;
  box-shadow: -10px 0 28px rgba(0,0,0,0.45);
}

#azrak-fediverse-switcher.azrak-left .azrak-panel {
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--azrak-switcher-radius);
  border-bottom-right-radius: var(--azrak-switcher-radius);
  box-shadow: 10px 0 28px rgba(0,0,0,0.45);
}

.azrak-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.azrak-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.azrak-subtitle {
  font-size: 12px;
  opacity: 0.78;
  margin: 0;
}

.azrak-links {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.azrak-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
  color: #e5e7eb;
  text-decoration: none;
  font-size: 13px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.azrak-links a:hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.65);
  border-color: rgba(148, 163, 184, 0.35);
}

.azrak-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  flex: 0 0 auto;
}

.azrak-indicator {
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #fb7185);
  opacity: 0;
  transition: transform 200ms ease, width 200ms ease, opacity 200ms ease;
}

@media (max-width: 520px) {
  :root { --azrak-switcher-width: 240px; }
}
