/* ============================================================
 * 97-profile.css —— 个人资料弹窗布局
 *
 * 之前的问题：
 *   ① HTML 用 class="modal small"，而宽度规则写在 .modal.profile-modal
 *      → 类名对不上 → 宽度规则从未生效，弹窗只有 380px 宽
 *   ② 隐身模式那个开关没有自己的样式，浏览器默认渲染成一个蓝色方块
 *
 * 现在：宽度 560px，性别/生日并排，开关是自己画的 iOS 风格拨动开关。
 * ============================================================ */

.modal.profile-modal {
  width: 560px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px 24px 18px;
}

.modal.profile-modal h3 {
  margin: 0 0 18px;
  font-size: 18px;
}

/* ---------- 头像 + 按钮那一排 ---------- */
.modal.profile-modal .profile-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line, #eceff3);
}

.modal.profile-modal .profile-avatar {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-soft, #f3f5f7);
  font-size: 32px;
}

.modal.profile-modal .profile-avatar .avatar {
  width: 84px;
  height: 84px;
  font-size: 34px;
}

.modal.profile-modal .profile-upload {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.modal.profile-modal .profile-upload .tip {
  flex: 1 0 100%;
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted, #7b8794);
}

/* ---------- 表单字段 ---------- */
.modal.profile-modal .field {
  display: block;
  margin-bottom: 14px;
}

.modal.profile-modal .field > span:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted, #5b6875);
}

.modal.profile-modal input[type='text'],
.modal.profile-modal input[type='date'],
.modal.profile-modal select,
.modal.profile-modal textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--line, #dde3ea);
  border-radius: 8px;
  background: var(--panel, #fff);
  color: inherit;
}

.modal.profile-modal textarea {
  min-height: 78px;
  resize: vertical;
  font-family: inherit;
}

.modal.profile-modal input:focus,
.modal.profile-modal select:focus,
.modal.profile-modal textarea:focus {
  outline: none;
  border-color: var(--brand, #2f6fed);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}

/* ---------- 性别 / 生日 并排两列 ---------- */
.modal.profile-modal .field-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
}

/* ============================================================
 * 隐身模式开关：自己画一个 iOS 风格的拨动开关
 *
 * 之前没有样式，浏览器默认把 <input type=checkbox> 渲染成一个
 * 蓝色方块，看着像坏掉了（截图里那根蓝条）。
 * 做法：把原生 checkbox 藏起来（但保持可聚焦、可键盘操作），
 *       用 ::before / ::after 画轨道和圆点。
 * ============================================================ */
.modal.profile-modal .switch.profile-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text, #2b3440);
}

/* 藏原生框（不是 display:none，否则键盘和读屏都废了） */
.modal.profile-modal .switch.profile-switch input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  border: none;
  border-radius: 12px;
  background: #d3d9e0;
  cursor: pointer;
  transition: background .18s ease;
  outline-offset: 2px;
}

/* 小圆点 */
.modal.profile-modal .switch.profile-switch input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .18s ease;
}

/* 打开状态：变绿 + 圆点滑到右边 */
.modal.profile-modal .switch.profile-switch input[type='checkbox']:checked {
  background: var(--brand, #2f6fed);
}
.modal.profile-modal .switch.profile-switch input[type='checkbox']:checked::after {
  transform: translateX(18px);
}

.modal.profile-modal .switch.profile-switch input[type='checkbox']:focus-visible {
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .25);
}

/* 关掉时的文字颜色淡一点 */
.modal.profile-modal .switch.profile-switch input[type='checkbox']:not(:checked) + span {
  color: var(--muted, #6b7280);
}

/* ---------- 底部按钮 ---------- */
.modal.profile-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #eceff3);
}

/* ---------- 窄屏：单列 ---------- */
@media (max-width: 560px) {
  .modal.profile-modal {
    width: calc(100vw - 20px);
    padding: 18px 16px 14px;
  }
  .modal.profile-modal .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .modal.profile-modal .profile-row {
    gap: 12px;
  }
}
