/* =========================
   Apple-like UI / Glass (Full)
   ========================= */

/* 基础重置 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

:root{
  --bg-1:#0b1020;
  --bg-2:#0b1230;

  --text:#f5f7fb;
  --muted: rgba(245,247,251,.72);
  --muted2: rgba(245,247,251,.55);

  --card: rgba(255,255,255,.07);
  --card2: rgba(255,255,255,.10);

  --stroke: rgba(255,255,255,.14);
  --stroke2: rgba(255,255,255,.22);

  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --shadow2: 0 10px 30px rgba(0,0,0,.32);

  --radius: 18px;
  --radius2: 22px;

  --accent: 110, 231, 183;   /* mint */
  --accent2: 99, 102, 241;   /* indigo */
}

body{
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  color: var(--text);
  line-height: 1.6;

  background:
    radial-gradient(900px 420px at 12% 8%, rgba(var(--accent2), .35) 0%, rgba(0,0,0,0) 60%),
    radial-gradient(900px 420px at 88% 18%, rgba(var(--accent), .28) 0%, rgba(0,0,0,0) 58%),
    radial-gradient(700px 360px at 40% 92%, rgba(138, 43, 226, .22) 0%, rgba(0,0,0,0) 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 70%, #070a14 100%);

  /* 防止长页面滚动时背景“断隔/重复拼接” */
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-color: #070a14;
}

/* 容器：更居中更有呼吸感 */
.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 44px 18px 96px;
}

/* 顶部 Header：更像 Apple Landing */
.header{
  text-align: center;
  margin: 0 auto 34px;
  padding: 10px 14px 28px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.header h1{
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 780;
  letter-spacing: -0.8px;
  line-height: 1.08;
  margin: 0 auto 12px;
  max-width: 920px;

  background: linear-gradient(180deg,
    rgba(255,255,255,.98) 0%,
    rgba(255,255,255,.72) 60%,
    rgba(255,255,255,.96) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  text-shadow: 0 14px 50px rgba(0,0,0,.35);
}

.sub{
  display: block;
  max-width: 860px;
  margin: 0 auto;
  font-size: 0.98rem;
  color: var(--muted);
  letter-spacing: .2px;
}

/* 主体 */
.main{ width: 100%; }

/* 列表 */
.member-list{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 卡片：玻璃 + 更规整 */
.member-card{
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 12px;

  background: linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.06) 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius2);
  overflow: hidden;

  box-shadow: var(--shadow2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}

.member-card:hover{
  transform: translateY(-2px);
  border-color: var(--stroke2);
  background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.07) 100%);
  box-shadow: var(--shadow);
}

/* 左侧头像区 */
.member-avatar-wrap{
  width: 116px;
  display: grid;
  place-items: center;
  padding: 16px 10px;
  cursor: pointer;
  user-select: none;

  border-right: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(200px 120px at 50% 20%, rgba(255,255,255,.10) 0%, rgba(0,0,0,0) 65%);
}

.member-avatar{
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  display: block;

  border: 2px solid rgba(255,255,255,.25);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.member-card:hover .member-avatar{
  transform: scale(1.03);
  border-color: rgba(var(--accent2), .55);
  box-shadow: 0 12px 28px rgba(var(--accent2), .18), 0 10px 24px rgba(0,0,0,.35);
}

/* 右侧内容区 */
.member-body{
  flex: 1;
  min-width: 0;
  padding: 16px 18px 16px 0;
}

.member-name{
  font-size: 1.18rem;
  font-weight: 740;
  letter-spacing: -0.2px;
  margin-bottom: 8px;
  color: rgba(255,255,255,.96);
}

.member-profile{
  font-size: 0.92rem;
  color: var(--muted2);
  letter-spacing: .15px;
  margin-bottom: 12px;
}

/* 游客新增事迹按钮区 */
.member-actions{
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 10px;
}

/* 个人事迹容器 */
.member-achievements{
  margin-top: 6px;
  margin-bottom: 12px;
}

/* 事迹卡片 */
.achievement-item{
  margin-bottom: 10px;
  padding: 12px 12px;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;

  overflow: hidden;
}

.achievement-rich{
  color: rgba(245,247,251,.82);
  line-height: 1.75;
  font-size: .96rem;
}

.achievement-rich img,
.achievement-item img{
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: 12px;
  margin: 10px 0;
  display: block;
  object-fit: contain;
}

.achievement-rich video,
.achievement-item video{
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: 12px;
  margin: 10px 0;
  display: block;
  object-fit: contain;
}

/* ✅ 折叠：只隐藏个人事迹（个人资料仍显示） */
.member-card.collapsed .member-achievements{
  display: none;
}

.member-card.collapsed .member-actions{
  display: none;
}

/* 折叠时更紧凑 */
.member-card.collapsed .member-body{
  padding-top: 14px;
}

/* 编辑按钮：像 iOS 小胶囊 */
.btn-edit{
  appearance: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.90);

  padding: 9px 14px;
  border-radius: 999px;

  font-size: 0.92rem;
  font-weight: 680;
  letter-spacing: .15px;
  cursor: pointer;

  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.btn-edit:hover{
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.28);
  transform: translateY(-1px);
}

/* loading/empty */
.loading, .empty{
  text-align: center;
  color: rgba(245,247,251,.55);
  padding: 56px 10px;
  font-size: 1rem;
  letter-spacing: .2px;
}

/* 弹窗 */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content{
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;

  background: rgba(20, 24, 40, .70);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  padding: 26px;

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  box-shadow: var(--shadow);
}

.modal-large{ max-width: 760px; }

.modal-content h3{
  font-size: 1.25rem;
  font-weight: 760;
  letter-spacing: -0.2px;
  margin-bottom: 18px;
}

/* 表单 */
.field{ margin-bottom: 14px; }
.field label{
  display: block;
  margin-bottom: 8px;
  color: rgba(245,247,251,.72);
  font-size: .92rem;
  font-weight: 640;
}

.field input,
.field textarea,
.field select{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  outline: none;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus{
  border-color: rgba(var(--accent2), .55);
  box-shadow: 0 0 0 4px rgba(var(--accent2), .12);
  background: rgba(255,255,255,.09);
}

.field-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-group{
  margin-top: 16px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}

.field-group h4{
  font-size: 1.05rem;
  font-weight: 760;
  margin-bottom: 12px;
}

/* ✅ 你 index.php 里把按钮放到底部了：这里补齐样式 */
.achievement-footer{
  display: flex;
  justify-content: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
}

.achievement-footer .btn-add-achievement{
  width: 100%;
}

/* ✅ 让“添加事迹”在弹窗里永远在视野内（更像 iOS） */
.modal-content .achievement-footer{
  position: sticky;
  bottom: 0;
  background: rgba(20, 24, 40, .78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding-bottom: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

/* 富文本编辑器 */
.rich-editor{
  min-height: 150px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
  outline: none;
}

.rich-editor:focus{
  border-color: rgba(var(--accent2), .55);
  box-shadow: 0 0 0 4px rgba(var(--accent2), .12);
}

.rich-editor img,
.rich-editor video{
  max-width: 100%;
  border-radius: 12px;
  margin: 10px 0;
  display: block;
}

/* 工具栏 */
.rich-editor-toolbar{
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.10);
}

.toolbar-btn{
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.86);
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.toolbar-btn:hover{
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
}

.btn-remove-achievement{
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .14);
  color: rgba(254, 202, 202, .95);
  cursor: pointer;
}

.btn-add-achievement{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent), .35);
  background: rgba(var(--accent), .12);
  color: rgba(167, 243, 208, .95);
  cursor: pointer;
}

/* modal actions */
.actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.btn-cancel{
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  color: rgba(245,247,251,.75);
  cursor: pointer;
}

.btn-cancel:hover{
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
}

.btn-primary{
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 760;
  color: rgba(255,255,255,.96);
  background: linear-gradient(135deg, rgba(var(--accent2), .92) 0%, rgba(139, 92, 246, .92) 100%);
  box-shadow: 0 10px 28px rgba(var(--accent2), .22);
  transition: transform .18s ease, filter .18s ease;
}

.btn-primary:hover{
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* 上传按钮 */
.btn-upload{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.86);
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.btn-upload:hover{
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
}

/* 右下角新增按钮：更 iOS */
.btn-add-member{
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.95);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 18px 55px rgba(0,0,0,.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  transition: transform .18s ease, background .18s ease;
  z-index: 999;
  display: grid;
  place-items: center;
}

.btn-add-member:hover{
  transform: translateY(-2px) scale(1.02);
  background: rgba(255,255,255,.14);
}

/* =========================
   Admin UI
   ========================= */
.admin-wrap .back{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(245,247,251,.82);
  text-decoration: none;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.admin-wrap .back:hover{ background: rgba(255,255,255,.10); }

.admin-actions{
  display:flex;
  justify-content:flex-end;
  margin: 14px 0 16px;
}

.btn-add{
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.92);
  background: linear-gradient(180deg, rgba(var(--accent), .22) 0%, rgba(var(--accent2), .20) 100%);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
  transition: transform .18s ease, filter .18s ease;
}
.btn-add:hover{ filter: brightness(1.06); transform: translateY(-1px); }

.admin-table-wrap{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius2);
  overflow: hidden;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.admin-table{
  width: 100%;
  border-collapse: collapse;
}
.admin-table th, .admin-table td{
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: middle;
}
.admin-table th{
  text-align: left;
  font-weight: 760;
  color: rgba(245,247,251,.80);
  background: rgba(255,255,255,.05);
}
.admin-table tr:hover td{ background: rgba(255,255,255,.035); }
.admin-table tr:last-child td{ border-bottom: none; }

.avatar-cell img{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.20);
}

.btn-del{
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,120,120,.35);
  background: rgba(255, 70, 70, .12);
  color: rgba(255, 190, 190, .95);
  cursor: pointer;
  margin-left: 8px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.btn-del:hover{
  background: rgba(255, 70, 70, .18);
  border-color: rgba(255,120,120,.55);
  transform: translateY(-1px);
}

/* Cropper 弹窗置顶 */
#avatar-crop-modal{ z-index: 10000 !important; position: fixed !important; }
#avatar-crop-modal .modal-content{ z-index: 10001; position: relative; max-width: 640px; }

/* 图片查看弹窗 */
.image-viewer-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.75);
  padding: 20px;
}
.image-viewer-modal img{
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.image-viewer-close{
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.image-viewer-close:hover{
  background: rgba(255,255,255,.25);
}

@media (max-width: 720px){
  .image-viewer-close{
    top: calc(28px + env(safe-area-inset-top, 0px));
  }
}

/* 响应式 */
@media (max-width: 720px){
  .wrap{ padding: 30px 14px 90px; }
  .header{ padding-bottom: 22px; }
  .member-avatar-wrap{ width: 98px; }
  .member-avatar{ width: 70px; height: 70px; }
  .member-body{ padding-right: 14px; }
  .field-row{ grid-template-columns: 1fr; }
}

/* 个人事迹文字：超过 5 行折叠 + 展示全部 */
.achievement-text-wrap{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  word-break: break-word;
  max-height: calc(1.75em * 5); /* 非 line-clamp 浏览器的兜底 */
}
.achievement-item.is-expanded .achievement-text-wrap{
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  max-height: none;
}
.ach-expand-btn{
  margin-top: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.86);
  cursor: pointer;
  justify-content: center;
}
.ach-expand-btn:active{
  transform: scale(.99);
}
/* ===== 图片预览：移动端允许放大/滚动 ===== */
#img-modal-stage{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

@media (max-width: 720px){
  #img-modal .modal-content{
    max-width: 96vw !important;
  }
  #img-modal-img{
    max-width: none;     /* 允许放大显示 */
    width: auto;
    height: auto;
    transform-origin: center center;
  }
}

