/* 全站账号头像、下拉菜单与登录弹窗 */
.account-widget {
  position: relative;
  flex-shrink: 0;
  margin-left: 8px;
}

.account-widget__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  font: inherit;
  line-height: 1;
}

.account-widget__btn:hover {
  border-color: rgba(126, 232, 200, 0.85);
  box-shadow: 0 0 0 3px rgba(10, 150, 118, 0.25);
}

.account-widget__btn--avatar {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.account-widget__btn--login {
  font-size: 11px;
  font-weight: 600;
}

.account-widget__btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.92;
}

.account-widget--light .account-widget__btn {
  border-color: rgba(10, 150, 118, 0.35);
  background: #f0faf7;
  color: var(--brand-dark, #087a60);
}

.account-widget--light .account-widget__btn:hover {
  border-color: var(--brand, #0a9676);
  box-shadow: 0 0 0 3px rgba(10, 150, 118, 0.15);
}

.account-widget__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  z-index: 1200;
  animation: accountMenuIn 0.16s ease-out;
}

.account-widget__menu[hidden] {
  display: none !important;
}

@keyframes accountMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.account-widget__menu-head {
  padding: 10px 16px 12px;
  border-bottom: 1px solid #eef2f6;
}

.account-widget__menu-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e2a36;
  word-break: break-all;
}

.account-widget__menu-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.account-widget__menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.account-widget__menu-item:hover {
  background: #f0faf7;
  color: #087a60;
}

.account-widget__menu-item--danger {
  color: #b91c1c;
}

.account-widget__menu-item--danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.account-widget__menu-divider {
  height: 1px;
  margin: 6px 0;
  background: #eef2f6;
}

/* 导航栏内嵌（首页 Bootstrap） */
.navbar .account-widget {
  display: flex;
  align-items: center;
  height: 50px;
  margin-left: 4px;
  padding: 0 4px;
}

.navbar-nav > li.nav-account-item {
  display: flex;
  align-items: center;
}

@media (max-width: 767px) {
  .navbar-nav > li.nav-account-item {
    padding: 8px 20px 4px;
  }

  .navbar .account-widget__menu {
    right: auto;
    left: 0;
  }

  .login-backdrop {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    align-items: flex-end;
  }

  .login-dialog {
    padding: 22px 18px 18px;
    width: 100%;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .login-dialog .btn-row {
    flex-direction: column;
  }

  .login-dialog .btn {
    min-height: 44px;
  }
}

/* 教程顶栏 */
.tutorial-header .account-widget {
  margin-left: auto;
}

.tutorial-header .tutorial-back {
  margin-right: 0;
}

.tutorial-header:has(.account-widget) .tutorial-back {
  margin-right: 4px;
}

/* 在线工具顶栏 */
.tools-header .account-widget {
  margin-left: auto;
}

/* 登录弹窗 */
.login-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 28px 26px 24px;
  width: min(400px, 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.login-dialog h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: #1e2a36;
}

.login-hint {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 18px;
  line-height: 1.55;
}

.login-dialog .form-row {
  margin-bottom: 14px;
}

.login-dialog .form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
  color: #475569;
}

.login-dialog .form-row input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dde4ec;
  border-radius: 8px;
  font-size: 14px;
}

.login-dialog .form-row input:focus {
  outline: none;
  border-color: #0a9676;
  box-shadow: 0 0 0 3px rgba(10, 150, 118, 0.15);
}

.login-dialog .btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.login-dialog .btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.login-dialog .btn-primary {
  background: #0a9676;
  color: #fff;
}

.login-dialog .btn-primary:hover {
  background: #087a60;
}

.login-dialog .btn-secondary {
  background: #f1f5f9;
  color: #334155;
}

.login-dialog .error-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: #b91c1c;
}

#simasstLoginModal[hidden] {
  display: none !important;
}
