/* ============================================================
   Helpme 个人中心样式（酷黑蓝紫风格，与 style.css 统一）
   ============================================================ */

.user-container {
  max-width: 980px;
  padding-top: 48px;
  padding-bottom: 80px;
}

/* ---------- 未登录：登录/注册卡片 ---------- */
.auth-card {
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-card);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* hidden 属性切换时须真正隐藏（.auth-form 的 display:flex 会覆盖 hidden，必须显式声明） */
.auth-form[hidden] {
  display: none;
}

.auth-form input,
.publish-form input,
.publish-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-form input:focus,
.publish-form input:focus,
.publish-form textarea:focus {
  border-color: rgba(99, 102, 241, 0.65);
}

.auth-form input::placeholder,
.publish-form input::placeholder,
.publish-form textarea::placeholder {
  color: var(--text-muted);
}

.auth-form .btn {
  margin-top: 6px;
}

.auth-tip {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-error {
  min-height: 18px;
  font-size: 13px;
  color: #f87171;
  text-align: center;
}

/* ---------- 已登录：用户信息卡 ---------- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(168, 85, 247, 0.10));
  border: 1px solid rgba(99, 102, 241, 0.30);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.avatar-edit {
  border: none;
  background: none;
  color: var(--accent-1);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
}

.avatar-edit:hover {
  text-decoration: underline;
}

.avatar-tip {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 4px 0 12px;
}

.avatar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.avatar-upload {
  cursor: pointer;
}

.profile-info {
  flex: 1;
}

.profile-info h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.role-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.role-badge.role-admin {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.30), rgba(168, 85, 247, 0.28));
  color: #fff;
  border-color: transparent;
}

/* ---------- 面板卡片 ---------- */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head h3 {
  font-size: 17px;
}

.panel-count {
  font-size: 13px;
  color: var(--text-muted);
}

.empty-tip {
  padding: 26px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- 收藏列表 ---------- */
.fav-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.fav-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.fav-item-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
}

.fav-item-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.fav-item-body {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: none;
  white-space: pre-wrap;
}

.fav-item-body.open { display: block; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-sm:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.6);
}

.btn-sm.btn-danger:hover {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.6);
}

.fav-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- 作业 ---------- */
.publish-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 6px;
}

.publish-form .form-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}

.publish-form textarea {
  min-height: 90px;
  resize: vertical;
}

.publish-form .btn {
  align-self: flex-start;
}

.asg-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.asg-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.asg-item-title {
  font-size: 15px;
  font-weight: 700;
}

.asg-deadline {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.asg-deadline.expired { color: #f87171; }

.asg-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 12px;
}

.asg-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.asg-status.submitted {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}

.asg-status.expired {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.submit-box {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.submit-box textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  resize: vertical;
  outline: none;
}

.submit-box textarea:focus { border-color: rgba(99, 102, 241, 0.65); }

.submit-box .submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.submit-box .submit-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .publish-form .form-row {
    grid-template-columns: 1fr;
  }
  .profile-card {
    flex-wrap: wrap;
  }
}

/* ---------- 注册：手机号 + 验证码 ---------- */
.code-row {
  display: flex;
  gap: 10px;
}

.code-row input {
  flex: 1;
  min-width: 0;
}

.code-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 10px 14px;
}

.code-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ---------- 注册：头像选择 ---------- */
.avatar-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avatar-label {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.avatar-option {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-option:hover {
  border-color: rgba(99, 102, 241, 0.65);
  transform: translateY(-2px);
}

.avatar-option.active {
  border-color: var(--accent-1);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(168, 85, 247, 0.24));
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

/* ---------- 测试模式验证码提示 ---------- */
.dev-code {
  font-size: 13px;
  color: #fbbf24;
  text-align: center;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px dashed rgba(251, 191, 36, 0.45);
}

.dev-code[hidden] {
  display: none;
}

/* ---------- 个人中心：手机号 ---------- */
.profile-phone {
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.profile-stats {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.profile-stats b {
  color: #fde68a;
  font-weight: 700;
}

/* ---------- 个人中心：错题集（按科目分组） ---------- */
.panel-foot {
  margin-top: 14px;
  text-align: center;
}

.mk-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.mk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  font-weight: 600;
}

.mk-count {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.mk-head {
  cursor: pointer;
  user-select: none;
}

.mk-head:hover {
  background: rgba(255, 255, 255, 0.07);
}

.mk-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mk-caret {
  display: inline-block;
  width: 14px;
  color: var(--accent-1);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.mk-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.mk-pager .btn-sm {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.mk-pager .btn-sm:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(99, 102, 241, 0.6);
}

.mk-pager .btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mk-page {
  font-size: 12.5px;
  color: var(--text-muted);
}

.mk-body {
  padding: 12px 14px;
}

.mk-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.mk-item:last-child {
  border-bottom: none;
}

.mk-q {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 6px;
}

.mk-opt {
  display: flex;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  color: var(--text-secondary);
}

.mk-opt.ans {
  color: #86efac;
}

.mk-opt.user {
  color: #fca5a5;
}

.mk-line {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.mk-line b.u {
  color: #fca5a5;
}

.mk-line b.r {
  color: #86efac;
}

.mk-explain {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
}
