/* login.css — page-specific styles for this page only.
   Shared header/footer/buttons/marketing base now live in base.css
   (loaded before this file on every page). */

/* ===== PAGE-SPECIFIC ===== */

/* Forcing min-height:100vh on <main> means it always fills the full
   viewport regardless of content, so the footer sits below the fold
   and requires a scroll to reach. */
main{ flex:1; min-height:100vh; display:flex; flex-direction:column; }

.login-page-wrap {
  /* Extra bottom padding (vs. top) nudges the centered card upward to
     compensate for the header sitting above this box, which otherwise
     pushes it visibly below true screen-center. */
  flex:1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 140px;
  background: #f7f7f8;
}

.login-card {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  padding: 48px 44px 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.login-card h2 {
  font-size: 30px;
  font-weight: 800;
  color: var(--color-text);
  margin: 0 0 10px;
  display: inline-block;
  position: relative;
  padding-bottom: 14px;
}

.login-card h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-blue);
}

.login-divider {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin: 28px 0 24px;
}

/* ===== Flash-message toasts (login/register) =====
   Separate from the alert-modal on purpose: the modal is reserved for
   real failures on *this* submission (form.errors). Success/info/warning
   messages carried over from another view (e.g. "logged out",
   "account created") are not failures and shouldn't look like one. */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  animation: toastSlideIn 0.25s ease;
}

.toast-hide {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
  padding: 0;
}
.toast-close:hover { opacity: 1; }

.toast-success { background: #ecfdf3; color: #046c4e; }
.toast-info    { background: #eff6ff; color: #1d4ed8; }
.toast-warning { background: #fffbeb; color: #92400e; }
.toast-error   { background: #fef2f2; color: #b91c1c; }
.toast-debug   { background: #f3f4f6; color: #374151; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Error popup (login/register) ===== */
.alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: alertFadeIn 0.2s ease;
}

.alert-modal {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  border-radius: 16px;
  padding: 28px 26px 24px;
  text-align: left;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: alertPopIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.alert-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fef2f2;
  color: #dc2626;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.alert-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
  margin: 0 0 12px;
}

.alert-modal-list {
  margin: 0 0 20px;
  padding-left: 18px;
  color: #b91c1c;
  font-size: 13.5px;
  line-height: 1.6;
}

.alert-modal-list li { margin-bottom: 4px; }
.alert-modal-list li:last-child { margin-bottom: 0; }

.alert-modal-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--color-blue);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  padding: 12px 0;
  cursor: pointer;
  transition: background 0.15s ease;
}
.alert-modal-btn:hover { background: var(--color-blue-hover); }

@keyframes alertFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes alertPopIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Style the Django form.as_p output to match the design */
.login-form {
  text-align: left;
}

.login-form p {
  margin: 0 0 18px;
}

.login-form p.has-error input {
  border-color: #dc2626;
}

.login-form label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 14.5px;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--color-blue);
}

.login-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 22px;
  font-size: 13.5px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-weight: 600;
}

.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-blue);
}

.login-forgot {
  color: var(--color-text);
  font-weight: 600;
}

.login-submit-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--color-blue);
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 700;
  padding: 14px 0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-submit-btn:hover {
  background: var(--color-blue-hover);
}

.login-footer-links {
  display: flex;
  justify-content: space-between;
  margin-top: 26px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text);
}

.login-register-row {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.login-register-row a {
  color: var(--color-blue);
  font-weight: 600;
}

/* ===== Sending overlay (forgot password: shown while the reset email is sent) ===== */
.sending-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100; /* above the error popup (1000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 17, 21, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: alertFadeIn 0.2s ease;
}

.sending-overlay[hidden] { display: none; }

.sending-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  padding: 32px 30px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.sending-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3.5px solid var(--color-border);
  border-top-color: var(--color-blue);
  animation: sendingSpin 0.8s linear infinite;
}

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

.sending-overlay-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text);
}

.sending-overlay-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* The button stays visibly "busy" if it's seen behind the overlay */
.login-submit-btn:disabled,
.login-submit-btn:disabled:hover {
  background: var(--color-blue);
  opacity: 0.65;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .sending-spinner { animation-duration: 2.4s; }
}
