:root {
  --bg-primary: #090d16;
  --bg-card: rgba(15, 23, 42, 0.82);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-glow: rgba(99, 102, 241, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Cairo', 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(30, 41, 59, 0.45), #090d16 75%);
}

.bg-grid {
  position: absolute;
  inset: -40px;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.85) 20%, transparent 82%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.85) 20%, transparent 82%);
  animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(48px, 48px, 0); }
}

#bg-voting-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.36;
  animation: orbFloat 14s ease-in-out infinite alternate;
}

.orb-1 {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: -120px;
  right: -90px;
}

.orb-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  bottom: -120px;
  left: -90px;
  animation-delay: -5s;
}

.orb-3 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.2;
  animation-delay: -9s;
}

@keyframes orbFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(28px, -24px, 0) scale(1.12); }
}

/* Live Animated Poll Bars on Left & Right */
.bg-live-bars {
  position: absolute;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 28px;
  height: 220px;
  opacity: 0.28;
}

.bars-left {
  left: 2%;
}

.bars-right {
  right: 2%;
}

.v-bar {
  width: 24px;
  height: 45%;
  border-radius: 10px 10px 0 0;
  transform-origin: bottom;
  animation: barWave var(--dur, 4s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 20px currentColor;
}

.bar-a { background: linear-gradient(to top, rgba(244, 63, 94, 0.15), #f43f5e); color: rgba(244, 63, 94, 0.45); }
.bar-b { background: linear-gradient(to top, rgba(14, 165, 233, 0.15), #0ea5e9); color: rgba(14, 165, 233, 0.45); }
.bar-c { background: linear-gradient(to top, rgba(245, 158, 11, 0.15), #f59e0b); color: rgba(245, 158, 11, 0.45); }
.bar-d { background: linear-gradient(to top, rgba(16, 185, 129, 0.15), #10b981); color: rgba(16, 185, 129, 0.45); }
.bar-p { background: linear-gradient(to top, rgba(99, 102, 241, 0.15), #6366f1); color: rgba(99, 102, 241, 0.45); }

@keyframes barWave {
  0% { height: 22%; opacity: 0.55; }
  50% { height: 85%; opacity: 1; }
  100% { height: 38%; opacity: 0.7; }
}

/* Floating Quiz/Vote Tokens */
.floating-tokens {
  position: absolute;
  inset: 0;
}

.f-token {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', 'Cairo', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.24;
  animation: tokenFloat var(--fdur, 10s) ease-in-out infinite alternate;
  animation-delay: var(--fdelay, 0s);
}

.tok-a { background: rgba(244, 63, 94, 0.16); color: #fda4af; border-color: rgba(244, 63, 94, 0.35); }
.tok-b { background: rgba(14, 165, 233, 0.16); color: #7dd3fc; border-color: rgba(14, 165, 233, 0.35); }
.tok-c { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.tok-d { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); }
.tok-q { background: rgba(99, 102, 241, 0.18); color: #c7d2fe; border-color: rgba(99, 102, 241, 0.38); }
.tok-check { background: rgba(16, 185, 129, 0.18); color: #34d399; border-color: rgba(16, 185, 129, 0.4); }

@keyframes tokenFloat {
  0% { transform: translate3d(0, 0, 0) rotate(-6deg); }
  50% { transform: translate3d(12px, -22px, 0) rotate(6deg); }
  100% { transform: translate3d(-10px, 14px, 0) rotate(-4deg); }
}

@media (max-width: 768px) {
  .bg-live-bars {
    height: 130px;
    gap: 8px;
    opacity: 0.18;
  }
  .v-bar {
    width: 14px;
  }
  .f-token {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    opacity: 0.16;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grid, .glow-orb, .v-bar, .f-token {
    animation: none !important;
  }
}

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  animation: cardAppear 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981, #6366f1);
}

.login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
}

.login-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  background: #ffffff;
  padding: 5px;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.logos-divider {
  width: 1px;
  height: 44px;
  background: rgba(255, 255, 255, 0.14);
}

.login-heading {
  text-align: center;
  margin-bottom: 24px;
}

.institution-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 0;
}

.login-heading h1 {
  font-size: 1.65rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
}

.login-heading p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 18px;
  animation: shakeError 0.35s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  right: 14px;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.8;
}

.input-box input {
  width: 100%;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 13px 44px 13px 44px;
  color: #ffffff;
  font-family: 'Outfit', 'Cairo', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s ease;
}

.input-box input::placeholder {
  color: var(--text-dim);
  font-family: 'Cairo', sans-serif;
  text-align: right;
}

.input-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(2, 6, 23, 0.85);
}

.btn-toggle-pass {
  position: absolute;
  left: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 4px 6px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.btn-toggle-pass:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.captcha-image-wrap {
  flex: 1;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  overflow: hidden;
}

.captcha-image-wrap img {
  display: block;
  width: 100%;
  max-width: 210px;
  height: 54px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.btn-refresh-captcha {
  width: 52px;
  height: 62px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  border-radius: 12px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-refresh-captcha:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--primary);
  transform: rotate(30deg);
}

.captcha-input-box input {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 700;
}

.btn-login-submit {
  margin-top: 6px;
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-login-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.55);
}

.btn-login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.link-audience {
  font-size: 0.88rem;
  font-weight: 700;
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.2s;
}

.link-audience:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px 22px;
  }
  .login-heading h1 {
    font-size: 1.4rem;
  }
}

