/* ===================================
   Atlas Nation Gateway - Styles
   =================================== */

/* === BASE & VARIABLES === */
:root {
  color-scheme: dark;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0b0d10;
  overflow: hidden;
}

/* === LANGUAGE SWITCHER === */
.lang-switcher {
  position: fixed;
  left: 18px;
  bottom: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
  align-items: flex-end;
}

.lang-trigger {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.lang-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.lang-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.lang-trigger:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

.lang-menu {
  position: absolute;
  left: 0;
  bottom: 42px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(12, 16, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lang-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-option {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.lang-option.is-active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

.flag-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
}

/* === LAYOUT === */
.container {
  display: flex;
  min-height: 100dvh;
  width: 100%;
}

.split {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-decoration: none;
  color: white;
  transition: flex 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease;
  position: relative;
  overflow: hidden;
  padding: 56px 18px;
  /* Entrance animation */
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.split-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.split:nth-child(1) {
  animation-delay: 0.1s;
}

.split:nth-child(2) {
  animation-delay: 0.25s;
}

.split:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.35);
  outline-offset: -3px;
}

.left {
  background-color: #141414;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.left h1 {
  color: #e5a00d;
}

.left:hover {
  flex: 1.25;
  background-color: #0c0c0c;
  box-shadow: inset 0 0 80px rgba(229, 160, 13, 0.08), 0 0 40px rgba(229, 160, 13, 0.05);
}

.right {
  background-color: #1a1c24;
}

.right h1 {
  color: #a78bfa;
}

.right:hover {
  flex: 1.25;
  background-color: #12141a;
  box-shadow: inset 0 0 80px rgba(167, 139, 250, 0.08), 0 0 40px rgba(167, 139, 250, 0.05);
}

/* === LOTTIE ANIMATIONS === */
.lottie {
  width: 140px;
  height: 140px;
  margin-bottom: 14px;
  opacity: 0.95;
  overflow: hidden;
  /* Soft fade on edges */
  mask-image: radial-gradient(ellipse 70% 70% at center, black 50%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at center, black 50%, transparent 100%);
}

/* Plex looks bigger WITHOUT changing layout */
.lottie-plex {
  transform: scale(1.2857); /* 180/140 */
  transform-origin: center;
  /* Clip right edge to hide buggy pixels */
  clip-path: inset(0 4px 0 0);
  /* IMPORTANT: tighten the Plex-to-text spacing to match Overseerr visually */
  margin-bottom: 6px;
}

/* === TYPOGRAPHY === */
h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  will-change: transform;
}

p {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  opacity: 0.85;
  margin-top: 12px;
  font-weight: 300;
}

.panel-icon {
  width: 1em;
  height: 1em;
  opacity: 0.9;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3em;
  position: relative;
  top: -0.18em;
}

.panel-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* === LETTER SCATTER ANIMATION === */
.scatter-letter {
  display: inline;
  /* No default transition - keeps magnetic effect responsive */
}

.scatter-letter.scattered {
  display: inline-block;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
  will-change: transform, opacity;
}

/* Slow-motion phase - letters slow down dramatically mid-air */
.scatter-letter.scattered.slow-motion {
  transition: transform 1.2s cubic-bezier(0.05, 0.5, 0.3, 1), opacity 1.2s ease-out;
}

.scatter-letter.reassembling {
  display: inline-block;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
  will-change: transform, opacity;
}

.panel-icon.scattered {
  transition: transform 0.12s ease-out, opacity 0.12s ease-out;
}

.panel-icon.scattered.slow-motion {
  transition: transform 1.2s cubic-bezier(0.05, 0.5, 0.3, 1), opacity 1.2s ease-out;
}

.panel-icon.reassembling {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

h1.being-pounced {
  position: relative;
}

/* === STATUS INDICATOR === */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 10px;
  margin: 6px -10px 0;
  border-radius: 20px;
  transition: background-color 0.25s ease;
  position: relative;
  cursor: default;
}

.status-indicator:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: currentColor;
  position: relative;
}

.status-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: currentColor;
  transform: translate(-50%, -50%);
  animation: breathingRing 2s ease-out infinite;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Status colors - Traffic light */
.status-indicator.is-online {
  color: #22c55e;
}
.status-indicator.is-offline {
  color: #ef4444;
}
.status-indicator.is-checking {
  color: #eab308;
}

/* Custom tooltip */
.status-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  pointer-events: none;
}

.status-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(15, 15, 15, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator:hover .status-tooltip {
  opacity: 1;
  visibility: visible;
}

/* ===================================
   KEYFRAME ANIMATIONS
   =================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes breathingRing {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* ===================================
   RESPONSIVE STYLES
   =================================== */

@media (max-width: 768px) {
  .lang-switcher {
    left: 12px;
    bottom: 10px;
  }

  .flag-icon {
    width: 18px;
    height: 18px;
  }

  .lang-trigger {
    width: 32px;
    height: 32px;
  }

  .lang-option {
    width: 30px;
    height: 30px;
  }

  .panel-icon {
    top: -0.08em;
  }

  .container {
    flex-direction: column;
  }

  .left {
    border-right: none;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  }

  .split:hover {
    flex: 1;
  }


  .lottie {
    width: 110px;
    height: 110px;
    margin-bottom: 4px;
  }

  .lottie-plex {
    transform: scale(1.2727);
    margin-bottom: 4px;
  }

  .status-indicator {
    margin-top: 12px;
  }

  .status-dot {
    width: 8px;
    height: 8px;
  }

  /* Disable entrance animation slide on mobile to prevent overflow issues */
  .split {
    animation: fadeIn 0.6s ease forwards;
  }

  .status-label {
    font-size: 0.65rem;
  }

  #overseerrTitle {
    white-space: nowrap;
    letter-spacing: 0.18em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .split {
    transition: none;
    animation: none;
    opacity: 1;
  }

  .status-dot::before {
    animation: none;
  }

  .status-indicator {
    transition: none;
  }

}
