/* 登录界面样式 */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/*
 * 已缓存 token 时：在 checkAuth /auth/me 完成前即隐藏主登录层，避免整页跳转时「闪登录框」。
 * auth-paint-guard.js 与 Auth.setAuthTokenCachedClass 会维护 html.auth-token-cached。
 */
html.auth-token-cached #login-overlay {
  display: none !important;
}

.login-modal {
  background: white;
  padding: 40px;
  border-radius: 12px;
  width: 400px;
  max-width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-modal h2 {
  margin-bottom: 24px;
  color: #0f172a;
  font-size: 24px;
  text-align: center;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid #e2e8f0;
}

.login-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
  transition: all 0.2s;
}

.login-tab.active {
  color: #0f766e;
  border-bottom-color: #0f766e;
  font-weight: 600;
}

.login-form {
  display: none;
}

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

.login-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.login-form input:focus {
  outline: none;
  border-color: #0f766e;
}

.login-form button {
  width: 100%;
  padding: 12px;
  background: #0f766e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-form button:hover {
  background: #0d9488;
}

.login-form button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.login-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 8px;
  display: none;
}

.user-info {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info span {
  font-size: 14px;
  color: #475569;
}

.user-info button {
  padding: 6px 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.user-info button:hover {
  background: #dc2626;
}
#login-overlay.home-auth-overlay .google-login-button {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  padding: 0 18px;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d7dee7;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

#login-overlay.home-auth-overlay .google-login-button:hover {
  border-color: #aab8c8;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

#login-overlay.home-auth-overlay .google-login-button:focus-visible {
  outline: 3px solid rgba(14, 165, 233, 0.2);
  outline-offset: 2px;
  border-color: #0ea5e9;
}

.google-login-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
}

.google-login-hint {
  margin: 8px 0 0;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.login-role-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

#login-overlay.home-auth-overlay .login-form .login-role-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 10px;
  color: #526174;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  box-shadow: none;
  text-align: left;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

#login-overlay.home-auth-overlay .login-form .login-role-option:hover {
  color: #0f766e;
  background: #f4fbfa;
  border-color: #b6d7d2;
  box-shadow: none;
}

#login-overlay.home-auth-overlay .login-form .login-role-option.active {
  color: #0f766e;
  background: #effaf8;
  border-color: #5eead4;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.08);
}

.login-role-option svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 1.8;
}

.login-role-option > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.login-role-option strong {
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.login-role-option small {
  overflow: hidden;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #94a3b8;
  font-size: 12px;
  margin: 20px 0 18px;
}

.home-auth-divider::before,
.home-auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid #e2e8f0;
}

.home-auth-field {
  margin-bottom: 14px;
}

#login-overlay.home-auth-overlay .home-auth-field input {
  min-height: 48px;
  box-sizing: border-box;
  margin-bottom: 0;
  padding: 0 14px;
  border-color: #d8e0e8;
  border-radius: 10px;
  color: #0f172a;
  background: #ffffff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

#login-overlay.home-auth-overlay .home-auth-field input::placeholder {
  color: #a0aec0;
}

#login-overlay.home-auth-overlay .home-auth-field input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

#login-overlay.home-auth-overlay .login-form .credential-login-button {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 10px;
  background: #0f766e;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

#login-overlay.home-auth-overlay .login-form .credential-login-button:hover {
  background: #115e59;
}

.home-auth-mode-link {
  margin: 16px 0 0;
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

#login-overlay.home-auth-overlay .login-form .home-auth-mode-link .login-tab {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  color: #0f766e;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}

#login-overlay.home-auth-overlay .login-form .home-auth-mode-link .login-tab:hover {
  color: #115e59;
  background: transparent;
  text-decoration: underline;
}

@media (max-width: 768px) {
  #login-overlay.home-auth-overlay .google-login-button {
    min-height: 48px;
  }

  .google-login-hint {
    margin-top: 7px;
  }
}

@media (max-width: 420px) {
  .login-role-switcher {
    gap: 6px;
  }

  #login-overlay.home-auth-overlay .login-form .login-role-option {
    min-height: 56px;
    padding: 8px;
  }

  .login-role-option svg {
    display: none;
  }
}
