/* Login — Shiny loading_video.mp4 background + modern glass form */

body.app-locked {
  overflow: hidden;
}

.app-root--locked {
  visibility: hidden;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.login-intro {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 9998;
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
}

/* Background video (same asset as Shiny mod_login.R) */
.login-intro-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.login-intro-video::-webkit-media-controls,
.login-intro-video::-webkit-media-controls-enclosure,
.login-intro-video::-webkit-media-controls-panel,
.login-intro-video::-webkit-media-controls-play-button,
.login-intro-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.login-intro-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(191, 87, 0, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, rgba(8, 8, 10, 0.35) 0%, rgba(8, 8, 10, 0.72) 100%);
  pointer-events: none;
}

.login-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease-in-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  width: 100%;
  padding: 24px 16px 48px;
  box-sizing: border-box;
  z-index: 2;
}

.login-card {
  width: min(100%, 400px);
  padding: 32px 28px 28px;
  border-radius: 20px;
  background: rgba(12, 12, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(191, 87, 0, 0.08) inset;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.login-title {
  font-family: "Outfit", "DM Sans", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, #ffffff 0%, #f5d4b8 42%, #bf5700 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.35));
}

.login-subtitle {
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 26px;
  text-align: center;
  letter-spacing: 0.01em;
}

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

.login-form.hidden {
  display: none;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  color: #f8f8f8;
  background: rgba(0, 0, 0, 0.35);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.login-input::placeholder {
  color: rgba(255, 255, 255, 0.32);
  font-weight: 400;
}

.login-input:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.42);
}

.login-input:focus {
  outline: none;
  border-color: rgba(191, 87, 0, 0.75);
  background: rgba(0, 0, 0, 0.5);
  box-shadow:
    0 0 0 3px rgba(191, 87, 0, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.25);
}

.login-password-wrap {
  position: relative;
  width: 100%;
}

.login-password-wrap .login-input {
  padding-right: 48px;
}

.login-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.login-password-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.login-password-toggle::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.85);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E")
    center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.login-password-toggle.login-password-toggle--visible::before {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E")
    center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.login-submit-wrap {
  position: relative;
  width: 100%;
  margin-top: 4px;
}

.login-submit-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 12px;
  font-family: "Outfit", "DM Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #1a1a1a 0%, #bf5700 55%, #d4711a 100%);
  box-shadow:
    0 4px 20px rgba(191, 87, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.login-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 8px 28px rgba(191, 87, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.15) inset;
  filter: brightness(1.06);
}

.login-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-btn-disabled,
.login-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.login-spinner {
  display: none;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  animation: login-spin 0.7s linear infinite;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.login-spinner.active {
  display: block;
}

@keyframes login-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.login-message {
  width: 100%;
  margin: 16px 0 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffb577;
}

.login-message--error {
  color: #ffb577;
}

.login-message--ok {
  color: #9ae6b0;
}

.login-register-hint {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
  margin: 0 0 4px;
  line-height: 1.45;
}

.login-alt-action {
  margin: 4px 0 0;
  text-align: center;
}

.login-link-btn {
  border: none;
  background: none;
  color: #f0b88a;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.login-link-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .login-card {
    padding: 26px 20px 22px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-intro-video {
    display: none;
  }

  .login-intro-scrim {
    background: linear-gradient(180deg, #1a120c 0%, #0a0a0a 100%);
  }
}
