/* =========================
   doudo-auth 样式
   登录/注册弹窗 + 头像选择 + 已登录卡片态
   沿用站点像素美术风
========================= */

/* ---- 登录/注册 弹窗遮罩 ---- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-overlay.active { display: flex; }

/* ---- 弹窗主体 ---- */
.auth-modal {
  background: #fff;
  border: 3px solid #333;
  border-radius: 8px;
  padding: 20px 24px 16px;
  width: min(420px, 88vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    8px 8px 0 rgba(0,0,0,.2),
    inset 0 0 0 2px #f0f0f0;
  font-family: "DotGothic16", sans-serif;
}

.auth-modal-title {
  margin: 0 0 14px;
  font-size: 18px;
  color: #222;
  text-align: center;
  letter-spacing: 1px;
}

/* ---- Tab 切换（登录 / 注册）---- */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #ddd;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  font-size: 15px;
  color: #888;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.auth-tab:hover { color: #444; }
.auth-tab.active {
  color: #1e6fd0;
  border-bottom-color: #1e6fd0;
  font-weight: bold;
}

/* ---- 表单字段 ---- */
.auth-field {
  margin-bottom: 12px;
}
.auth-label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}
.auth-input {
  width: 100%;
  padding: 9px 10px;
  border: 2px solid #ccc;
  border-radius: 5px;
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s;
  background: #fafafa;
}
.auth-input:focus { border-color: #1e6fd0; background: #fff; }
.auth-input.error { border-color: #e23b3b; background: #fef0f0; }
.auth-error {
  font-size: 12px;
  color: #e23b3b;
  margin-top: 3px;
  min-height: 16px;
}

/* ---- 按钮 ---- */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: 2px solid #333;
  border-radius: 6px;
  background: #1e6fd0;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .08s;
}
.auth-btn:hover { background: #1657a8; }
.auth-btn:active { transform: scale(.97); }
.auth-btn.secondary {
  background: #fff;
  color: #333;
}
.auth-btn.secondary:hover { background: #f0f0f0; }
.auth-btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-width: 1.5px;
}
.auth-btn-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

/* ---- 忘记密码链接 ---- */
.auth-forgot-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.auth-link {
  background: none;
  border: none;
  color: #1e6fd0;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 4px 8px;
}
.auth-link:hover { color: #1657a8; }

/* ---- 头像选择网格（注册时显示）---- */
.avatar-picker {
  display: none;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #ddd;
}
.avatar-picker.visible { display: block; }
.avatar-picker-label {
  font-size: 13px;
  color: #555;
  margin-bottom: 8px;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.avatar-option {
  aspect-ratio: 1;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  background: #f9f9f9;
  transition: border-color .15s, transform .1s;
  padding: 2px;
}
.avatar-option:hover { border-color: #aaa; transform: scale(1.05); }
.avatar-option.selected {
  border-color: #1e6fd0;
  background: #e8f0fe;
  box-shadow: 0 0 0 2px rgba(30,111,208,.25);
}
.avatar-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* ---- 已登录的 trainer-card 态 ---- */
.trainer-guest,
.trainer-logged-in {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.trainer-card.logged-in .trainer-avatar-wrap {
  cursor: pointer;
  position: relative;
}
.trainer-card.logged-in .trainer-avatar-wrap::after {
  content: "✎";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #1e6fd0;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.trainer-card.logged-in .trainer-avatar-wrap:hover::after { opacity: 1; }

.trainer-username {
  font-size: 15px;
  font-weight: bold;
  color: #222;
  margin: 6px 0 2px;
}
.trainer-logout-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 14px;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.trainer-logout-btn:hover {
  border-color: #e23b3b;
  color: #e23b3b;
}

/* ---- 未登录态：登录按钮 ---- */
.trainer-login-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 22px;
  border: 2px solid #333;
  border-radius: 6px;
  background: linear-gradient(135deg, #7ecbf5, #5ab4e8);
  color: #fff;
  font-size: 14px;
  font-family: "DotGothic16", sans-serif;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  box-shadow: 3px 3px 0 rgba(0,0,0,.15);
}
.trainer-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 4px 4px 0 rgba(0,0,0,.2);
}
.trainer-login-btn:active { transform: scale(.97); }

/* ---- 关闭按钮 ---- */
.auth-close {
  float: right;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.auth-close:hover { color: #333; }

/* ---- 响应式 ---- */
@media (max-width: 600px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .auth-modal { padding: 16px 18px; width: 92vw; }
}
