/* ===================================================================
   Auth pages (Sign in / Register) — dark shell, matches dashboard
   =================================================================== */

.auth-page {
  background: var(--pl-dark);
  min-height: calc(100vh - 72px);
  padding: var(--space-6) var(--space-4) var(--space-12);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.auth-page__inner {
  width: 100%;
  max-width: 440px;
}

.auth-page__inner--wide {
  max-width: 520px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--pl-font);
  font-size: var(--pl-text-xs);
  font-weight: var(--pl-font-weight-semi);
  color: var(--pl-blue);
  text-decoration: none;
  margin-bottom: var(--space-5);
  transition: color var(--duration-normal);
}
.auth-back:hover {
  color: var(--pl-white);
}

.auth-card {
  background: var(--pl-mid);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-lg);
}

.auth-card__title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  color: var(--pl-white);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-card__subtitle {
  font-family: var(--pl-font);
  font-size: var(--pl-text-sm);
  color: var(--pl-text-muted-dark);
  text-align: center;
  margin-bottom: var(--space-6);
  line-height: 1.5;
}

.auth-card .text-muted {
  color: var(--pl-text-muted-dark) !important;
}
.auth-card small.text-danger,
.auth-card #password-strong-msg {
  display: block;
  color: var(--pl-red) !important;
  font-size: var(--pl-text-xxs);
  margin-top: 6px;
}

.auth-card .pl-alert {
  margin-bottom: var(--space-4);
  font-size: var(--pl-text-sm);
}
.auth-card .pl-alert--success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--pl-green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.auth-card .pl-alert--danger {
  background: var(--pl-red-light);
  color: var(--pl-red);
  border: 1px solid rgba(255, 77, 79, 0.2);
}
.auth-card .pl-alert--info {
  background: var(--pl-blue-light);
  color: var(--pl-blue);
  border: 1px solid rgba(111, 173, 219, 0.25);
}

/* Map Django message tag "error" to danger styling */
.auth-card .pl-alert--error {
  background: var(--pl-red-light);
  color: var(--pl-red);
  border: 1px solid rgba(255, 77, 79, 0.25);
}

.auth-card .pl-alert--warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.auth-field {
  margin-bottom: var(--space-4);
}

.auth-label {
  display: block;
  font-family: var(--pl-font);
  font-size: var(--pl-text-xs);
  font-weight: var(--pl-font-weight-semi);
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 8px;
}

.auth-input,
.auth-card .form-control {
  font-family: var(--pl-font);
  font-size: var(--pl-text-sm);
  color: var(--pl-white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal), background var(--duration-normal);
}
.auth-input::placeholder,
.auth-card .form-control::placeholder {
  color: var(--pl-text-muted-dark);
}
.auth-input:focus,
.auth-card .form-control:focus {
  outline: none;
  border-color: var(--pl-orange);
  box-shadow: 0 0 0 3px rgba(236, 100, 29, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--pl-white);
}

.auth-password-wrap {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--pl-border-subtle);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: box-shadow var(--duration-normal), border-color var(--duration-normal);
}
.auth-password-wrap:focus-within {
  border-color: var(--pl-orange);
  box-shadow: 0 0 0 3px rgba(236, 100, 29, 0.2);
}
.auth-password-wrap .form-control {
  border: none;
  border-radius: 0;
  background: transparent;
  flex: 1;
  min-width: 0;
}
.auth-password-wrap .form-control:focus {
  box-shadow: none;
}

.auth-password-toggle {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-left: 1px solid var(--pl-border-subtle);
  color: var(--pl-text-muted-dark);
  cursor: pointer;
  transition: background var(--duration-normal), color var(--duration-normal);
}
.auth-password-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pl-white);
}

.auth-forgot {
  display: inline-block;
  margin-top: var(--space-2);
  font-family: var(--pl-font);
  font-size: var(--pl-text-xs);
  font-weight: var(--pl-font-weight-semi);
  color: var(--pl-orange);
  text-decoration: none;
}
.auth-forgot:hover {
  color: var(--pl-white);
}

.auth-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.auth-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--pl-orange);
}
.auth-check label {
  font-family: var(--pl-font);
  font-size: var(--pl-text-xs);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.auth-btn {
  font-family: var(--pl-font);
  font-size: var(--pl-text-body);
  font-weight: var(--pl-font-weight-semi);
  width: 100%;
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--pl-orange);
  color: var(--pl-white);
  cursor: pointer;
  transition: background var(--duration-normal), box-shadow var(--duration-normal), opacity var(--duration-normal);
}
.auth-btn:hover:not(:disabled) {
  background: var(--pl-orange-hover);
  box-shadow: var(--shadow-glow-orange);
}
.auth-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-5);
  font-family: var(--pl-font);
  font-size: var(--pl-text-sm);
  color: var(--pl-text-muted-dark);
}

.auth-link {
  font-weight: var(--pl-font-weight-semi);
  color: var(--pl-blue);
  text-decoration: none;
}
.auth-link:hover {
  color: var(--pl-white);
}

/* Password strength (create account) */
.auth-strength {
  margin-top: var(--space-2);
}
#password-strength-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
#password-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.25s ease, background 0.25s ease;
}
#password-strength-text {
  display: block;
  margin-top: 6px;
  font-family: var(--pl-font);
  font-size: var(--pl-text-xxs);
  color: var(--pl-text-muted-dark);
}

/* Resend verification */
.auth-resend {
  font-family: var(--pl-font);
  font-size: var(--pl-text-sm);
  line-height: 1.5;
}
.auth-resend form button {
  background: none;
  border: none;
  padding: 0;
  color: var(--pl-orange);
  font-weight: var(--pl-font-weight-semi);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}
.auth-resend form button:hover {
  color: var(--pl-white);
}

/* Modal — dark */
.auth-modal .modal-content {
  background: var(--pl-mid);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-md);
  color: var(--pl-white);
}
.auth-modal .modal-header {
  border-bottom-color: var(--pl-border-subtle);
  padding: var(--space-4) var(--space-5);
}
.auth-modal .modal-title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: 1.1rem;
}
.auth-modal .btn-close {
  filter: invert(1);
  opacity: 0.6;
}
.auth-modal .modal-body {
  padding: var(--space-5);
}
.auth-modal .modal-footer {
  border-top-color: var(--pl-border-subtle);
  padding: var(--space-4) var(--space-5);
}
.auth-modal .form-label {
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--pl-font);
  font-size: var(--pl-text-xs);
}
.auth-modal .form-control {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pl-border-subtle);
  color: var(--pl-white);
  border-radius: var(--radius-sm);
}
.auth-modal .form-control:focus {
  border-color: var(--pl-orange);
  box-shadow: 0 0 0 3px rgba(236, 100, 29, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--pl-white);
}
.auth-modal .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--pl-border-subtle);
  color: var(--pl-white);
  font-family: var(--pl-font);
}
.auth-modal .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--pl-white);
}
.auth-modal .auth-btn {
  width: auto;
  padding: var(--space-2) var(--space-5);
}

/* Injected alerts in modal (forgot password flow) */
.auth-modal .alert,
.auth-modal .pl-alert {
  border-radius: var(--radius-sm);
  font-family: var(--pl-font);
  font-size: var(--pl-text-sm);
}
.auth-modal .alert-success,
.auth-modal .pl-alert--success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--pl-green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.auth-modal .alert-danger,
.auth-modal .pl-alert--danger {
  background: var(--pl-red-light);
  color: var(--pl-red);
  border: 1px solid rgba(255, 77, 79, 0.2);
}
.auth-modal .btn-primary {
  background: var(--pl-orange);
  border: none;
  color: var(--pl-white);
  font-family: var(--pl-font);
}
.auth-modal .btn-primary:hover {
  background: var(--pl-orange-hover);
}

@media (prefers-reduced-motion: reduce) {
  .auth-btn,
  #password-strength-fill {
    transition: none;
  }
}
