/* ===== Auth Modal Overlay ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 14, 26, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Auth Modal Card ===== */
.auth-modal {
  display: flex;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  max-width: 820px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12), 0 0 60px rgba(41, 121, 255, 0.06);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s ease;
  position: relative;
}

.auth-overlay.active .auth-modal {
  transform: translateY(0) scale(1);
}

/* ===== Left Brand Panel ===== */
.auth-brand {
  width: 340px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #1565C0 0%, #2979FF 60%, #42A5F5 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 36px;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -20%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.auth-brand-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.auth-brand-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.auth-brand-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  opacity: 0.85;
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-brand-features {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.auth-brand-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.auth-brand-feature-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

/* ===== Right Form Panel ===== */
.auth-form-panel {
  flex: 1;
  padding: 44px 40px 36px;
  display: flex;
  flex-direction: column;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: rgba(45, 55, 72, 0.5);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  z-index: 2;
}

.auth-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

/* ===== Tab Switcher ===== */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-bottom: 2px solid rgba(41, 121, 255, 0.08);
}

.auth-tab {
  padding: 10px 0;
  margin-right: 28px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.25s ease;
  font-family: var(--font-family);
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.auth-tab.active {
  color: var(--accent);
  font-weight: 600;
}

.auth-tab.active::after {
  transform: scaleX(1);
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* ===== Form Styles ===== */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: authFadeIn 0.3s ease-out;
}

.auth-form.active {
  display: flex;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid rgba(41, 121, 255, 0.12);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: rgba(41, 121, 255, 0.02);
  transition: all 0.25s ease;
  outline: none;
}

.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.08);
}

.auth-input:focus ~ .auth-input-icon,
.auth-input:focus + .auth-input-icon {
  color: var(--accent);
}

.auth-input-wrapper:focus-within .auth-input-icon {
  color: var(--accent);
}

/* Password toggle */
.auth-pwd-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.2s ease;
}

.auth-pwd-toggle:hover {
  color: var(--text-secondary);
}

/* Verification code input group */
.auth-code-group {
  display: flex;
  gap: 10px;
}

.auth-code-group .auth-input-wrapper {
  flex: 1;
}

.auth-code-btn {
  flex-shrink: 0;
  padding: 0 18px;
  border-radius: 10px;
  border: 1.5px solid rgba(41, 121, 255, 0.2);
  background: rgba(41, 121, 255, 0.04);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
  min-width: 108px;
}

.auth-code-btn:hover:not(:disabled) {
  background: rgba(41, 121, 255, 0.1);
  border-color: rgba(41, 121, 255, 0.3);
}

.auth-code-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Submit Button ===== */
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 24px;
  border-radius: 10px;
  border: none;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(41, 121, 255, 0.25);
  transition: all 0.25s ease;
  margin-top: 4px;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(41, 121, 255, 0.35);
}

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

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== Agreement Checkbox ===== */
.auth-agreement {
  margin-top: -4px;
}

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-checkbox-icon {
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(41, 121, 255, 0.25);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: 1px;
}

.auth-checkbox input:checked + .auth-checkbox-icon {
  background: var(--accent);
  border-color: var(--accent);
}

.auth-checkbox input:checked + .auth-checkbox-icon::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.auth-checkbox-text {
  flex: 1;
}

.auth-checkbox-text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

/* ===== Footer Links ===== */
.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-footer a:hover {
  color: var(--accent-light);
}

/* ===== Form Error / Hint ===== */
.auth-hint {
  font-size: 0.78rem;
  color: #e53e3e;
  margin-top: -4px;
  min-height: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.auth-hint.success {
  color: #38a169 !important;
}

.auth-hint:empty {
  display: none;
}

.auth-input.error {
  border-color: rgba(229, 62, 62, 0.4);
  background: rgba(229, 62, 62, 0.02);
}

.auth-input.success {
  border-color: rgba(56, 161, 105, 0.4);
}

/* ===== Password Strength ===== */
.auth-pwd-strength {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.auth-pwd-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(41, 121, 255, 0.1);
  transition: background 0.3s ease;
}

.auth-pwd-bar.weak { background: #e53e3e; }
.auth-pwd-bar.medium { background: #f6ad55; }
.auth-pwd-bar.strong { background: #38a169; }

.auth-pwd-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Loading Spinner on Button ===== */
.auth-submit .auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  display: none;
}

.auth-submit.loading .auth-spinner {
  display: block;
}

.auth-submit.loading .auth-submit-text {
  display: none;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .auth-brand {
    display: none;
  }

  .auth-modal {
    max-width: 420px;
    border-radius: 16px;
  }

  .auth-form-panel {
    padding: 32px 24px 28px;
  }

  .auth-tabs {
    margin-bottom: 24px;
  }

  .auth-tab {
    font-size: 0.92rem;
    margin-right: 20px;
  }

  .auth-code-btn {
    min-width: 96px;
    font-size: 0.78rem;
    padding: 0 14px;
  }
}

@media (max-width: 480px) {
  .auth-form-panel {
    padding: 28px 20px 24px;
  }

  .auth-input {
    padding: 11px 12px 11px 38px;
    font-size: 0.88rem;
  }

  .auth-submit {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

/* ===== Toast ===== */
.auth-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: #38a169;
  color: #fff;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: var(--font-family);
  box-shadow: 0 4px 20px rgba(56, 161, 105, 0.3);
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.auth-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
