/**
 * 文件: css/auth.css (用户认证)
 * 说明: 登录/注册弹窗、导航入口、用户下拉菜单样式，沿用宣纸底色与朱砂主色
 */

.x6r-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(51, 48, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.x6r-auth-overlay[hidden] {
  display: none;
}

.x6r-auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-color, #f9f5ea);
  border: 1px solid rgba(135, 45, 45, 0.25);
  border-radius: 12px;
  padding: 28px 24px 24px;
  box-shadow: 0 12px 40px rgba(51, 48, 46, 0.25);
}

.x6r-auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-color, #33302e);
  opacity: 0.6;
  cursor: pointer;
}

.x6r-auth-title {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--primary-color, #872d2d);
  text-align: center;
  letter-spacing: 2px;
}

.x6r-auth-note {
  margin: -8px 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-color, #33302e);
  opacity: 0.72;
}

.x6r-auth-note[hidden] {
  display: none;
}

.x6r-auth-msg {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.x6r-auth-msg.is-error {
  background: rgba(180, 66, 48, 0.1);
  color: #b44230;
  border: 1px solid rgba(180, 66, 48, 0.3);
}

.x6r-auth-msg.is-ok {
  background: rgba(104, 142, 38, 0.1);
  color: #688e26;
  border: 1px solid rgba(104, 142, 38, 0.3);
}

.x6r-auth-view input:not([type="checkbox"]) {
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  height: 44px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid rgba(51, 48, 46, 0.25);
  border-radius: 8px;
  background: #fff;
  color: var(--text-color, #33302e);
  font-size: 14px;
}

.x6r-auth-field-note {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-color, #33302e);
  opacity: 0.72;
}

.x6r-auth-view input:not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--primary-color, #872d2d);
  box-shadow: 0 0 0 2px rgba(135, 45, 45, 0.12);
}

.x6r-auth-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.x6r-auth-code-row[hidden],
.x6r-captcha-status[hidden] {
  display: none;
}

.x6r-captcha-status {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(104, 142, 38, 0.22);
  border-radius: 8px;
  background: rgba(104, 142, 38, 0.06);
  color: #567622;
  font-size: 13px;
  line-height: 1.6;
}

.x6r-auth-view .x6r-auth-code-row input {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: none;
  margin-bottom: 0;
}

.x6r-auth-code-btn {
  box-sizing: border-box;
  flex: 0 0 112px;
  width: 112px;
  height: 44px;
  padding: 0 6px;
  border: 1px solid var(--primary-color, #872d2d);
  border-radius: 8px;
  background: transparent;
  color: var(--primary-color, #872d2d);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.x6r-auth-code-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.x6r-auth-submit {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: var(--button-bg, #872d2d);
  color: #fff;
  font-size: 15px;
  letter-spacing: 2px;
  cursor: pointer;
}

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

.x6r-auth-links {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 0;
}

.x6r-auth-links button {
  flex: 1;
  border: none;
  background: none;
  padding: 0;
  color: var(--primary-color, #872d2d);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.x6r-auth-links button:hover {
  text-decoration: underline;
}

.x6r-auth-links button.is-current {
  color: var(--text-color, #33302e);
  opacity: 0.45;
  cursor: default;
  text-decoration: none;
}

/* 注册同意勾选行。链接必须放在 label 外：iOS 点到含链接的 label 不会勾选。 */
.x6r-auth-agree {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 2px 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-color, #33302e);
  opacity: 0.9;
}

.x6r-auth-agree-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-right: 2px;
  cursor: pointer;
}

.x6r-auth-agree input[type="checkbox"] {
  /* iOS 在 flex 行里会把勾选框压成 0 宽，必须写死尺寸。 */
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary-color, #872d2d);
}

.x6r-auth-agree a {
  color: var(--primary-color, #872d2d);
  cursor: pointer;
}

.x6r-auth-agree input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

/* 导航入口 */
.x6r-auth-nav {
  position: relative;
  display: flex;
  align-items: center;
  list-style: none;
}

.x6r-auth-nav-btn {
  padding: 8px 16px;
  border: 1px solid var(--primary-color, #872d2d);
  border-radius: 20px;
  background: transparent;
  color: var(--primary-color, #872d2d);
  font-size: 14px;
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x6r-auth-nav-btn:hover {
  background: var(--primary-color, #872d2d);
  color: #fff;
}

.x6r-auth-dropdown {
  /* 用 fixed 摆脱 .menu-bar 的 overflow:hidden 裁剪，位置由 JS 按按钮坐标计算 */
  position: fixed;
  min-width: 140px;
  background: var(--bg-color, #f9f5ea);
  border: 1px solid rgba(135, 45, 45, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(51, 48, 46, 0.18);
  overflow: hidden;
  z-index: 10001;
}

.x6r-auth-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-color, #33302e);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.x6r-auth-dropdown button:hover {
  background: var(--secondary-color, #f3ecd8);
  color: var(--primary-color, #872d2d);
}

.x6r-auth-nav-mobile .x6r-auth-logout {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.75;
}

/* 抵消站点全局 button 样式（margin/ripple/hover位移）对认证组件的干扰 */
.x6r-auth-card button,
.x6r-auth-nav button,
.x6r-auth-dropdown button {
  margin: 0;
}

.x6r-auth-card button:hover,
.x6r-auth-nav-btn:hover,
.x6r-auth-dropdown button:hover {
  transform: none;
  box-shadow: none;
}

.x6r-auth-card button::after,
.x6r-auth-nav-btn::after,
.x6r-auth-dropdown button::after {
  display: none;
}

.x6r-auth-submit:hover {
  background-color: var(--button-bg, #872d2d);
  opacity: 0.92;
}

.x6r-auth-code-btn:hover {
  background-color: rgba(135, 45, 45, 0.08);
}

.x6r-auth-close:hover {
  background: none;
  opacity: 1;
}

/* 注册密码实时提示 */
.x6r-pwd-hint {
  margin: -6px 0 10px;
  font-size: 12px;
  line-height: 1.5;
  padding: 0 4px;
}

.x6r-pwd-hint.is-ok {
  color: #688e26;
}

.x6r-pwd-hint.is-bad {
  color: #b44230;
}

/* 图形验证码 */
.x6r-captcha-img {
  box-sizing: border-box;
  flex: 0 0 112px;
  width: 112px;
  height: 44px;
  object-fit: contain;
  border: 1px solid rgba(51, 48, 46, 0.25);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.x6r-captcha-img[aria-disabled="true"] {
  cursor: default;
  opacity: 0.55;
}

/* VIP 角标与会员中心 */
.x6r-vip-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 8px;
  background: linear-gradient(135deg, #b8894d, #d4af6a);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  vertical-align: middle;
}

.x6r-vip-status {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--secondary-color, #f3ecd8);
  color: var(--text-color, #33302e);
  font-size: 14px;
  text-align: center;
}

.x6r-vip-status.is-vip {
  background: linear-gradient(135deg, rgba(184, 137, 77, 0.15), rgba(212, 175, 106, 0.2));
  border: 1px solid rgba(184, 137, 77, 0.5);
  color: #8a6d2f;
  font-weight: bold;
}

.x6r-vip-quota {
  margin: -6px 0 14px;
  text-align: center;
  font-size: 13px;
  color: var(--primary-color, #872d2d);
}

.x6r-vip-perks {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text-color, #33302e);
  font-size: 14px;
  line-height: 2;
}

.x6r-vip-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  opacity: 0.85;
}

.x6r-vip-note a {
  color: var(--primary-color, #872d2d);
}

/* 轻提示 */
.x6r-auth-toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 24px;
  background: var(--text-color, #33302e);
  color: var(--bg-color, #f9f5ea);
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10002;
  pointer-events: none;
}

.x6r-auth-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .x6r-auth-overlay {
    padding: 10px;
    /* 键盘弹出时弹窗靠上，避免输入框被遮住 */
    align-items: flex-start;
    padding-top: 8vh;
  }

  .x6r-auth-card {
    max-width: 100%;
    padding: 22px 16px 18px;
    border-radius: 10px;
  }

  .x6r-auth-title {
    font-size: 18px;
    margin-bottom: 14px;
  }

  /* 16px 防止 iOS Safari 聚焦时自动放大页面 */
  .x6r-auth-view input:not([type="checkbox"]) {
    font-size: 16px;
    padding: 0 12px;
    margin-bottom: 10px;
  }

  .x6r-auth-code-row {
    gap: 6px;
    margin-bottom: 10px;
  }

  .x6r-auth-code-btn {
    padding: 0 4px;
    font-size: 12px;
  }

  .x6r-auth-submit {
    font-size: 16px;
  }

  .x6r-auth-links {
    font-size: 12px;
  }
}

/* 超窄屏（≤360px）：验证码行改为上下排列，输入框不再被挤压 */
@media (max-width: 360px) {
  .x6r-auth-code-row {
    flex-direction: column;
    align-items: stretch;
  }

  .x6r-captcha-img,
  .x6r-auth-code-btn {
    flex-basis: auto;
    width: 100%;
  }
}
