/* ========================================
   登录/注册覆盖层样式
   ======================================== */

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: authSlideIn 0.3s ease-out;
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo img {
  border-radius: 12px;
  margin-bottom: 8px;
}

.auth-logo h2 {
  margin: 8px 0 0;
  font-size: 20px;
  color: #333;
  font-weight: 600;
}

/* ---- 标签页 ---- */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  font-size: 15px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s, border-bottom 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.auth-tab.active {
  color: #4A90D9;
  border-bottom-color: #4A90D9;
  font-weight: 600;
}

.auth-tab:hover {
  color: #4A90D9;
}

/* ---- 表单 ---- */
.auth-form {
  display: none;
}

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

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  outline: none;
}

.auth-field input:focus,
.auth-field select:focus {
  border-color: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.auth-field input::placeholder {
  color: #bbb;
}

.auth-field select {
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-color: #fff;
}

/* ---- 错误提示 ---- */
.auth-error {
  color: #e74c3c;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

/* ---- 提交按钮 ---- */
.auth-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
}

.auth-submit:hover {
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
}

.auth-submit:active {
  transform: scale(0.98);
}

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

/* ---- 底部 ---- */
.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #999;
}

/* ---- 顶栏用户菜单 ---- */
.user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 14px 4px 4px;
  border-radius: 30px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.12);
  transition: all 0.2s ease;
}

.user-menu:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-right: 8px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.user-menu-name {
  display: none;  /* 隐藏账号编号文字（如 dyt110），只保留头像+下拉 */
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-arrow {
  font-size: 9px;
  color: #9ca3af;
  margin-left: 6px;
  transition: transform 0.2s;
}

.user-menu.open .user-menu-arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  min-width: 200px;
  padding: 8px;
  display: none;
  z-index: 9999;
  animation: dropIn 0.18s ease-out;
}

.user-dropdown.open {
  display: block;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 8px;
}

.user-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}

.user-dropdown-item .icon {
  margin-right: 10px;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 6px 4px;
}

.user-dropdown-item.danger {
  color: #ef4444;
}
.user-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

/* ---- 同步状态指示 ---- */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: 8px;
}

.sync-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}

.sync-indicator .dot.synced { background: #2ecc71; }
.sync-indicator .dot.syncing { background: #f39c12; animation: syncPulse 1s infinite; }
.sync-indicator .dot.error { background: #e74c3c; }
.sync-indicator .dot.offline { background: #999; }

@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- 响应式 ---- */
@media (max-width: 480px) {
  .auth-card {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .auth-logo h2 {
    font-size: 18px;
  }
}
