/* 微信扫码登录弹窗与页眉用户区 */

.login-link {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.header-user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.user-menu-trigger {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  max-width: 140px;
}

.user-menu-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 6px;
}

.user-icon {
  width: 24px;
  height: 24px;
  margin-right: 6px;
  flex-shrink: 0;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown-header {
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
}

.user-badge {
  font-size: 12px;
  color: #999;
}

.user-badge.vip {
  color: #b8860b;
  font-weight: 600;
}

.user-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}

.user-dropdown-item:last-child {
  border-bottom: none;
}

.user-dropdown-label {
  color: #666;
}

.user-dropdown-value {
  color: #07358A;
  font-weight: 600;
}

.user-dropdown-vip {
  border-top: 1px solid #eee;
  padding-top: 8px;
  margin-top: 8px;
}

.user-logout-btn {
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  text-align: left;
  color: #e53935;
  cursor: pointer;
  font-size: 14px;
  border-top: 1px solid #eee;
  margin-top: 8px;
}

.user-logout-btn:hover {
  background: #fff5f5;
}

/* 登录弹窗 */
.login-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.login-modal.active {
  display: flex;
}

.login-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.login-modal-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  margin: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.login-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  z-index: 1;
}

.login-modal-header {
  padding: 24px 24px 12px;
  text-align: center;
}

.login-modal-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #333;
}

.login-modal-header p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.login-modal-body {
  padding: 8px 24px 16px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-section {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid #eee;
  border-top-color: #F7D035;
  border-radius: 50%;
  animation: login-spin 0.8s linear infinite;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

.login-status-text {
  font-size: 13px;
  margin-bottom: 12px;
  color: #666;
}

.login-status-text.status-scanned {
  color: #2563eb;
}

.login-status-text.status-expired {
  color: #ea580c;
}

.login-qrcode-img {
  width: 192px;
  height: 192px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fff;
}

.login-refresh-btn,
.login-retry-btn {
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.login-refresh-btn:hover,
.login-retry-btn:hover {
  background: #f5f5f5;
}

.login-error-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.login-error-msg {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

.login-success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  background: #ecfdf5;
  color: #16a34a;
  border-radius: 50%;
  font-size: 28px;
  line-height: 56px;
}

.login-success-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.login-modal-footer {
  padding: 0 24px 20px;
  text-align: center;
}

.login-cancel-btn {
  border: none;
  background: none;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.dark-theme .login-modal-panel {
  background: #2a2a2a;
}

body.dark-theme .login-modal-header h2,
body.dark-theme .login-success-title {
  color: #fff;
}

body.dark-theme .user-dropdown {
  background: #333;
  border: 1px solid #444;
}

body.dark-theme .user-dropdown-header,
body.dark-theme .user-dropdown-vip {
  border-color: #444;
}

body.dark-theme .user-dropdown-item {
  border-color: #444;
}

body.dark-theme .user-dropdown-label {
  color: #999;
}

body.dark-theme .user-dropdown-value {
  color: #fccf00;
}

@media (max-width: 768px) {
  .login-link span,
  .user-menu-trigger span {
    display: none;
  }
}
