/* ============================================================
   账号系统样式 —— 登录/注册页
   ============================================================ */

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
}

/* ---------- 提示条 ---------- */
.auth-alert {
  width: 100%;
  max-width: 420px;
  margin-bottom: 18px;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.6;
}

.auth-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .auth-alert-error {
    background: #2a1717;
    border-color: #5b2222;
    color: #fca5a5;
  }
}

/* ---------- 卡片 ---------- */
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 30px 26px;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 26px;
  text-align: center;
}

.auth-sub {
  margin: 0 0 24px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14.5px;
}

/* ---------- GitHub 按钮 ---------- */
.btn-github {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #24292f;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-github:hover { opacity: .88; }

@media (prefers-color-scheme: dark) {
  .btn-github { background: #f0f2f5; color: #14161a; }
}

/* ---------- 分割线 ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-soft);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- 表单 ---------- */
.auth-field {
  display: block;
  margin-bottom: 16px;
}

.auth-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-hint {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.auth-error {
  margin-bottom: 14px;
  padding: 9px 13px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  .auth-error {
    background: #2a1717;
    border-color: #5b2222;
    color: #fca5a5;
  }
}

.auth-submit {
  width: 100%;
  padding: 11px;
  font-size: 15px;
}
.auth-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.auth-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-soft);
}
.auth-switch a {
  font-weight: 600;
}

/* ---------- 顶栏用户区 ---------- */
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  min-width: 0;
}

.nav-user-link {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
  min-width: 0;
}
.nav-user-link:hover { color: var(--accent); text-decoration: none; }

.nav-user-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 管理员入口 */
.nav-admin-link {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.nav-admin-link:hover {
  text-decoration: none;
  border-color: var(--accent);
}

/* 文字兜底头像（无图时显示用户名首字母） */
.nav-avatar-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* 关键：固定尺寸 + 溢出隐藏，任何尺寸的源图都不会破坏布局 */
.nav-avatar {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  display: block;
}

.nav-logout {
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.nav-logout:hover { color: var(--accent); text-decoration: underline; }

/* ---------- 绑定确认提示 ---------- */
.bind-notice {
  margin-bottom: 20px;
  padding: 12px 15px;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  background: #fffbeb;
  font-size: 14px;
  line-height: 1.65;
  color: #92400e;
}

.bind-notice p {
  margin: 0 0 8px;
}
.bind-notice p:last-child {
  margin-bottom: 0;
}

.bind-notice-alt {
  font-size: 13px;
  opacity: .85;
}

@media (prefers-color-scheme: dark) {
  .bind-notice {
    background: #2a2010;
    border-color: #78500f;
    color: #fcd34d;
  }
}

/* ---------- GitHub 身份条 ---------- */
.gh-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.gh-identity img {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.gh-identity-text {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  min-width: 0;
}

.gh-label {
  font-size: 12px;
  color: var(--text-soft);
}

.gh-identity-text strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 头像区 ---------- */
.avatar-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
}

.avatar-preview {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 64px;
  flex: 0 0 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-soft);
}

.avatar-info {
  flex: 1;
  min-width: 0;
}

.avatar-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 16px;
}

.avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avatar-form {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.avatar-form input[type="url"] {
  width: 100%;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.avatar-form input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
}

.avatar-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.avatar-form .auth-hint { margin-top: 8px; }
.avatar-form .auth-error { margin-top: 10px; }

@media (prefers-color-scheme: dark) {
  .avatar-fallback { color: var(--text-soft); }
}

/* ---------- 账号页字段列表 ---------- */
.profile-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  margin: 0 0 26px;
  font-size: 15px;
}

.profile-list dt {
  color: var(--text-soft);
  font-weight: 600;
}

.profile-list dd {
  margin: 0;
  word-break: break-all;
}

/* ---------- 密码区 ---------- */
.pw-zone {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.pw-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 16px;
}

.pw-desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}

.pw-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.pw-ok {
  margin-bottom: 12px;
  padding: 9px 13px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  .pw-ok {
    background: #14301d;
    border-color: #22543d;
    color: #6ee7a0;
  }
}

/* ---------- 注销危险区 ---------- */
.danger-zone {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.danger-title {
  margin: 0 0 6px;
  font-size: 16px;
  color: #dc2626;
}

.danger-desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}

.btn-danger-outline {
  border: 1px solid #fca5a5;
  background: none;
  color: #dc2626;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-outline:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.btn-danger {
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #fff;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }

.delete-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  background: #fef2f2;
}

.delete-warn {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #991b1b;
}

.delete-form .auth-error { margin-bottom: 12px; }

.danger-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (prefers-color-scheme: dark) {
  .danger-title { color: #fca5a5; }
  .btn-danger-outline { border-color: #7f1d1d; color: #fca5a5; }
  .btn-danger-outline:hover { background: #2a1717; }
  .btn-danger { background: #b91c1c; border-color: #b91c1c; }
  .delete-form {
    background: #2a1717;
    border-color: #7f1d1d;
  }
  .delete-warn { color: #fca5a5; }
}

@media (max-width: 520px) {
  .auth-box { padding: 26px 22px 22px; border: none; }
  .nav-user { width: 100%; justify-content: center; }
}

/* ============================================================
   评论区（登录后可见）
   ============================================================ */

.comments-title {
  font-size: 22px;
  margin: 44px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.comments-count {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 15px;
}

.comments-empty,
.comments-login-hint {
  color: var(--text-soft);
  font-size: 15px;
}

.comments-list {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 14px 16px;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 14px;
}

.comment-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.comment-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.comment-author { font-weight: 700; }

.comment-time {
  color: var(--text-soft);
  font-size: 12.5px;
}

/* 删除自己评论的按钮 */
.comment-delete {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s, color .15s;
}

.comment-item:hover .comment-delete,
.comment-delete:focus {
  opacity: 1;
}

.comment-delete:hover {
  color: #dc2626;
  text-decoration: underline;
}

.comment-delete:disabled {
  opacity: .4;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  /* 触屏没有 hover，删除按钮常显 */
  .comment-delete { opacity: 1; }
}

.comment-body {
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}

.comment-form {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 16px;
}

.comment-form-head {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.comment-form-error {
  margin-right: auto;
  font-size: 13.5px;
  color: #dc2626;
}

@media (prefers-color-scheme: dark) {
  .comment-form-error { color: #fca5a5; }
}
