/* FELTUS Extraction Lab login — full-bleed provided image with real form overlay */

.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  gap: 16px;
  background: #020617;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}

.auth-loading[hidden] {
  display: none !important;
}

.auth-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(56, 189, 248, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #020617;
}

.login-image-wrapper {
  position: relative;
  display: block;
  width: min(100vw, 100vh * 1.777);
  height: min(100vh, 100vw / 1.777);
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
}

.login-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Desktop form overlay inside the image's white panel */
.login-form-overlay {
  position: absolute;
  top: 22%;
  left: 46%;
  right: 14%;
  bottom: 18%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 8px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  color: #0f172a;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card-header h2 {
  font: 600 26px/1.15 'Space Grotesk', sans-serif;
  margin: 0 0 6px;
  color: #0f172a;
}

.auth-card-header p {
  margin: 0;
  color: #475569;
  font-size: 14px;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.field-group input {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field-group input::placeholder {
  color: #94a3b8;
}

.field-group input:focus {
  outline: none;
  border-color: var(--l-primary, #2563eb);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 34px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.password-toggle:hover,
.password-toggle:focus {
  background: #e5e7eb;
  color: #334155;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--l-primary, #2563eb);
  outline-offset: -2px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

/* Error message */
.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
}

.auth-error::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.auth-error[hidden] {
  display: none !important;
}

/* Submit button */
.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 22px;
  margin-top: 2px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  filter: brightness(1.05);
}

.auth-submit:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.auth-submit:disabled {
  opacity: 0.75;
  cursor: wait;
  transform: none;
}

.auth-submit .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit .spinner {
    animation: none;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-submit .arrow {
  width: 16px;
  height: 16px;
}

.auth-submit .button-text,
.auth-submit .spinner,
.auth-submit .arrow {
  flex: none;
}

/* Footer */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  text-align: center;
}

.auth-security {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

.auth-security svg {
  width: 12px;
  height: 12px;
  color: #10b981;
}

.auth-support {
  margin: 0;
  color: #64748b;
  font-size: 11px;
}

.auth-support a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.auth-support a:hover {
  text-decoration: underline;
}

/* Mobile fallback */
@media (max-width: 900px) {
  .login-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow: auto;
  }

  .login-image {
    max-width: 100%;
    max-height: 36vh;
    width: auto;
    object-fit: contain;
  }

  .login-form-overlay {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    flex: 1 0 auto;
    background: #020617;
  }

  .auth-card {
    max-width: none;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  }
}

@media (max-width: 420px) {
  .login-form-overlay {
    padding: 16px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .auth-card-header h2 {
    font-size: 22px;
  }

  .field-group input {
    padding: 12px 13px;
  }
}
