* {
  box-sizing: border-box;
}

body.login-inst {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  min-height: 100vh;
  background: #000;
  color: #fff;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-video-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  z-index: -999 !important;
  pointer-events: none;
}

/* Hide video on mobile, show image instead */
@media (max-width: 768px) {
  .login-video-bg {
    display: none !important;
  }
  
  .login-image-bg {
    display: block !important;
    position: fixed !important;
  }
  
  /* Ensure login container stays centered on mobile */
  body.login-inst {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Reduce login form width by 15% and vertical padding by 15% */
  .login-inst__container {
    width: min(357px, 78.2vw) !important; /* 420px * 0.85 = 357px, 92vw * 0.85 = 78.2vw */
    padding-top: 40.8px !important; /* 48px * 0.85 = 40.8px */
    padding-bottom: 40.8px !important;
    /* Keep horizontal padding as is */
  }
  
  /* Reduce Student Portal title to 80% */
  .login-inst__title {
    font-size: 1.4rem !important; /* 1.75rem * 0.8 = 1.4rem */
  }
}

.login-image-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  z-index: -999 !important;
  pointer-events: none;
  overflow: hidden;
}

.login-image-bg img {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  z-index: -999 !important;
  pointer-events: none;
}

body.login-inst::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: -998 !important;
  pointer-events: none;
}

body.login-inst > *:not(.login-video-bg):not(.login-image-bg) {
  position: relative;
  z-index: 999999999999999999999999999 !important;
}

.login-inst__container {
  width: min(420px, 92vw);
  background: rgba(20, 20, 20, 0.3) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 20px;
  padding: 48px 44px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  transition: all 0.3s ease;
  position: relative !important;
  z-index: 999999999999999999999999999 !important;
  margin: 0 auto !important;
}

.login-inst__logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-inst__logo img {
  max-width: 220px;
  height: auto;
}

.login-inst__title {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.015em;
  color: #fff;
  text-align: center;
  font-weight: 600;
}

.login-inst__error {
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 12px;
  color: #fca5a5;
  text-align: center;
  font-weight: 600;
}

.login-inst__form {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

.login-inst__form input[type="text"],
.login-inst__form input[type="password"] {
  width: 100%;
  padding: 15px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.login-inst__form input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.login-inst__form input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.login-inst__password {
  position: relative;
  display: flex;
  align-items: center;
}

.login-inst__toggle {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}

.login-inst__toggle:hover {
  color: #ccc;
}

.login-inst__button {
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  height: 40px;
  justify-content: center;
  position: relative;
  width: 100px;
  cursor: pointer;
  margin: 0 auto;
  padding: 0;
  transition: all 0.3s ease;
}

.login-inst__button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.login-button__text {
  color: white;
  position: absolute;
  transition: opacity 300ms;
  user-select: none;
  -moz-user-select: none;
  font-weight: 600;
  font-size: 13px;
}

.fingerprint {
  left: 50%;
  opacity: 0;
  position: absolute;
  stroke: #777;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 1ms;
  width: 75px;
  height: 75px;
}

.fingerprint-active {
  stroke: #fff;
}

.fingerprint-out {
  opacity: 1;
}

.fingerprint .odd {
  stroke-dasharray: 0px 50px;
  stroke-dashoffset: 1px;
  transition: stroke-dasharray 1ms;
}

.fingerprint .even {
  stroke-dasharray: 50px 50px;
  stroke-dashoffset: -41px;
  transition: stroke-dashoffset 1ms;
}

.ok {
  opacity: 0;
  width: 50px;
  height: 50px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.login-inst__button.active {
  animation: 6s Container;
}

.login-inst__button.active[data-submitted="true"] .login-button__text {
  opacity: 0 !important;
  display: none !important;
}

/* Don't hide button with CSS - let JavaScript handle it after animation completes */

.login-inst__button.active .login-button__text {
  opacity: 0 !important;
  animation: 6s Text forwards;
  pointer-events: none;
}

.login-inst__button.active .fingerprint {
  opacity: 1;
  transition: opacity 300ms 200ms;
}

.login-inst__button.active .fingerprint-base .odd {
  stroke-dasharray: 50px 50px;
  transition: stroke-dasharray 800ms 100ms;
}

.login-inst__button.active .fingerprint-base .even {
  stroke-dashoffset: 0px;
  transition: stroke-dashoffset 800ms;
}

.login-inst__button.active .fingerprint-active .odd {
  stroke-dasharray: 50px 50px;
  transition: stroke-dasharray 2000ms 1500ms;
}

.login-inst__button.active .fingerprint-active .even {
  stroke-dashoffset: 0px;
  transition: stroke-dashoffset 2000ms 1300ms;
}

.login-inst__button.active .fingerprint-out {
  opacity: 0;
  transition: opacity 300ms 4100ms;
}

.login-inst__button.active .ok {
  opacity: 1;
  animation: 6s Ok forwards;
}

@keyframes Container {
  0% { width: 100px; height: 40px; }
  6% { width: 75px; height: 75px; }
  71% { transform: scale(1); }
  75% { transform: scale(1.2); }
  77% { transform: scale(1); }
  94% { width: 75px; height: 75px; }
  100% { width: 100px; height: 40px; }
}

@keyframes Text {
  0% { opacity: 1; transform: scale(1); }
  6% { opacity: 0; transform: scale(0.5); }
  94% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(0.5); }
}

@keyframes Ok {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  70% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  77% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  92% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  96% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

@media (max-width: 540px) {
  body.login-inst {
    padding: 16px;
  }
  .login-inst__container {
    padding: 36px 28px;
  }
}
