/* ============================================================
   BOT COMUNALE / FiveM — Login «Municipio Hub»
   Città notturna · terminale RP · cyan + viola
============================================================ */

.comunale-login-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.comunale-login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(34, 211, 238, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 85% 15%, rgba(167, 139, 250, 0.12) 0%, transparent 45%),
    linear-gradient(165deg, #050810 0%, #0a1018 40%, #070a10 100%);
  animation: comunaleAmbienceShift 12s ease-in-out infinite alternate;
}

@keyframes comunaleAmbienceShift {
  from { filter: brightness(1); }
  to { filter: brightness(1.06); }
}

/* Atmosfera */
.comunale-login-ambience {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.comunale-login-grid {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 55%;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: center bottom;
  mask-image: linear-gradient(to top, black 20%, transparent 85%);
  animation: comunaleGridPulse 8s ease-in-out infinite;
}

.comunale-login-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.35), transparent);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.25);
  animation: comunaleScanDown 7s linear infinite;
  opacity: 0.5;
}

.comunale-skyline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28%;
  background:
    linear-gradient(to top, rgba(7, 10, 16, 0.95), transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath fill='%23121824' d='M0 120V80h40V50h30v30h50V40h40v80h35V60h45v60h40V30h50v90h40V70h55v50h35V45h40v75h50V55h45v65h40V35h60v85h40V65h50v55h40V25h70v95h40V75h45v45h50V50h40v70h55V40h65v80h40V60h50v60h40V20h80v100H0z'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
  opacity: 0.85;
}

.comunale-window {
  position: absolute;
  bottom: 12%;
  width: 3px;
  height: 5px;
  background: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
  animation: comunaleWindowFlicker 4s ease-in-out infinite;
}

.comunale-window:nth-child(4) { left: 18%; animation-delay: 0s; }
.comunale-window:nth-child(5) { left: 32%; animation-delay: 1.2s; }
.comunale-window:nth-child(6) { left: 48%; animation-delay: 2.4s; }
.comunale-window:nth-child(7) { left: 62%; animation-delay: 0.8s; }
.comunale-window:nth-child(8) { left: 78%; animation-delay: 3.1s; }

.comunale-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
  opacity: 0;
  animation: comunaleParticleFloat 9s ease-in infinite;
}

.comunale-particle:nth-child(9) { left: 12%; animation-delay: 0s; }
.comunale-particle:nth-child(10) { left: 28%; animation-delay: 2s; animation-duration: 11s; }
.comunale-particle:nth-child(11) { left: 55%; animation-delay: 4.5s; }
.comunale-particle:nth-child(12) { left: 72%; animation-delay: 1.5s; animation-duration: 8s; }
.comunale-particle:nth-child(13) { left: 88%; animation-delay: 6s; animation-duration: 10s; }

.comunale-particle--purple {
  background: #a78bfa;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
}

.comunale-particle--purple:nth-child(14) { left: 22%; animation-delay: 3s; }
.comunale-particle--purple:nth-child(15) { left: 65%; animation-delay: 5.5s; animation-duration: 12s; }

/* Shell */
.comunale-login-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  animation: comunaleShellIn 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.comunale-login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: rgba(18, 24, 36, 0.72);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow), 0 0 60px rgba(34, 211, 238, 0.06);
}

.comunale-login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 0% 100%, rgba(34, 211, 238, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(167, 139, 250, 0.1) 0%, transparent 50%);
  pointer-events: none;
  animation: comunaleHeroGlow 9s ease-in-out infinite alternate;
}

.comunale-login-hero > * {
  position: relative;
  z-index: 1;
}

.comunale-login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.06);
  animation: comunaleFadeUp 0.7s ease 0.1s both;
}

.comunale-login-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
  animation: comunaleLivePulse 2s ease-in-out infinite;
}

.comunale-login-hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.85rem, 4.2vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  animation: comunaleFadeUp 0.8s ease 0.2s both;
}

.comunale-login-hero h1 span {
  background: linear-gradient(135deg, #22d3ee 0%, #a78bfa 55%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.comunale-login-tagline {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 36ch;
  animation: comunaleFadeUp 0.9s ease 0.35s both;
}

.comunale-login-features {
  display: grid;
  gap: 0.75rem;
  animation: comunaleFadeUp 1s ease 0.5s both;
}

.comunale-login-features .feature-item {
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.comunale-login-features .feature-item:hover {
  border-color: rgba(34, 211, 238, 0.22);
  transform: translateX(4px);
}

.comunale-login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.comunale-login-card {
  position: relative;
  width: 100%;
  padding: clamp(1.75rem, 4vw, 2.25rem);
  background: rgba(13, 18, 28, 0.88);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  animation: comunaleCardEnter 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both,
    comunaleCardGlow 7s ease-in-out infinite 0.9s;
}

.comunale-login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 7px);
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.45) 0%,
    rgba(167, 139, 250, 0.15) 40%,
    rgba(34, 211, 238, 0.05) 60%,
    rgba(251, 191, 36, 0.25) 100%
  );
  background-size: 220% 220%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: comunaleBorderShine 10s linear infinite;
  pointer-events: none;
}

.comunale-login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.15), rgba(167, 139, 250, 0.12));
  border: 1px solid rgba(34, 211, 238, 0.2);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.12);
  animation: comunaleLogoFloat 4s ease-in-out infinite;
}

.comunale-login-card h2 {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 1.45rem;
}

.comunale-login-card .muted {
  text-align: center;
  margin-bottom: 1.25rem;
}

.comunale-login-card .btn-discord {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
  animation: comunaleFadeUp 0.8s ease 0.6s both;
}

.comunale-login-card .btn-outline {
  width: 100%;
  justify-content: center;
  margin-top: 0.85rem;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: none;
  animation: comunaleFadeUp 0.8s ease 0.65s both;
}

.comunale-login-card .btn-outline:hover {
  border-color: rgba(34, 211, 238, 0.55);
  color: #e2e8f0;
  background: rgba(34, 211, 238, 0.06);
}

.comunale-login-invite-hint {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  animation: comunaleFadeUp 0.8s ease 0.7s both;
}

.comunale-login-card .alert {
  animation: comunaleFadeUp 0.8s ease 0.45s both;
}

.comunale-login-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  animation: comunaleFadeUp 0.9s ease 0.7s both;
}

/* Keyframes */
@keyframes comunaleGridPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

@keyframes comunaleScanDown {
  0% { top: -2%; opacity: 0; }
  8% { opacity: 0.5; }
  92% { opacity: 0.35; }
  100% { top: 102%; opacity: 0; }
}

@keyframes comunaleWindowFlicker {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
  75% { opacity: 0.65; }
}

@keyframes comunaleParticleFloat {
  0% { transform: translateY(20vh) scale(0); opacity: 0; }
  12% { opacity: 0.9; }
  88% { opacity: 0.4; }
  100% { transform: translateY(-110vh) scale(1); opacity: 0; }
}

@keyframes comunaleShellIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes comunaleHeroGlow {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

@keyframes comunaleFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes comunaleCardEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes comunaleCardGlow {
  0%, 100% { box-shadow: var(--shadow), 0 0 40px rgba(34, 211, 238, 0.06); }
  50% { box-shadow: var(--shadow), 0 0 55px rgba(167, 139, 250, 0.1); }
}

@keyframes comunaleBorderShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes comunaleLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes comunaleLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@media (max-width: 860px) {
  .comunale-login-shell {
    grid-template-columns: 1fr;
  }

  .comunale-login-hero {
    padding: 1.5rem;
  }

  .comunale-login-features {
    display: none;
  }

  .comunale-skyline {
    height: 18%;
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .comunale-login-page,
  .comunale-login-shell,
  .comunale-login-card,
  .comunale-login-logo,
  .comunale-login-grid,
  .comunale-login-scanline,
  .comunale-particle,
  .comunale-window {
    animation: none !important;
  }
}
