/* ============================================
   NekoChat · 通讯录 / 好友 / 群聊 / 扫码
   ============================================ */

/* ---------- 通讯录页 ---------- */
.page-contacts { display: none; }
.page-contacts.active { display: flex; flex-direction: column; }

/* 顶部快捷操作条 */
.contact-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  flex-shrink: 0;
}

.contact-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 8px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .18s ease;
}

.contact-action:active {
  transform: scale(.97);
}

.contact-action .ico {
  width: 22px;
  height: 22px;
  color: #3d8fd8;
  stroke-width: 2;
}

.contact-action.primary {
  background: linear-gradient(135deg, #4aa3ff, #2b7fe0);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 16px rgba(43, 127, 224, .24);
}

.contact-action.primary .ico {
  color: #fff;
}

/* 分区标题 */
.contact-section {
  padding: 0 16px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.contact-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .4px;
}

.contact-section .count {
  font-size: 12px;
  color: var(--text-faint);
}

/* 列表 */
.contact-list {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background .16s ease, transform .12s ease;
  width: 100%;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.contact-row:active {
  background: #f3f9ff;
  transform: scale(.99);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #8fd0ff, #4aa3ff);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(74, 163, 255, .16);
}

.contact-avatar.group {
  border-radius: 14px;
  background: linear-gradient(135deg, #a7d8ff, #62b0f5);
}

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

.contact-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  color: #c5d9ec;
  flex-shrink: 0;
}

.contact-arrow .ico {
  width: 18px;
  height: 18px;
}

/* 好友申请红点 */
.badge-dot {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

/* 待处理申请卡片 */
.request-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #ffe0b2;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(245, 166, 35, .1);
}

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

.req-btn {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease;
}

.req-btn:active { transform: scale(.95); }

.req-btn.accept {
  background: linear-gradient(135deg, #4aa3ff, #2b7fe0);
  color: #fff;
  box-shadow: 0 3px 10px rgba(43, 127, 224, .22);
}

.req-btn.reject {
  background: #f2f7fd;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ============================================
   弹窗内表单
   ============================================ */
.sheet-field {
  margin-bottom: 16px;
}

.sheet-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.sheet-field input[type="text"],
.sheet-field input[type="search"] {
  width: 100%;
  height: 46px;
  padding: 0 15px;
  border-radius: 12px;
  background: #f5f9ff;
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .18s ease, box-shadow .18s ease;
  -webkit-appearance: none;
}

.sheet-field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74, 163, 255, .13);
  outline: none;
}

/* 搜索结果行 */
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #f8fbfe;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.search-result .contact-info { flex: 1; }

.sr-btn {
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #4aa3ff, #2b7fe0);
  color: #fff;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .12s ease;
}

.sr-btn:active { transform: scale(.95); }

.sr-btn.done {
  background: #eef6ff;
  color: #9db4cc;
  cursor: default;
}

/* 好友多选 */
.pick-list {
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: -4px 0 16px;
}

.pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease;
}

.pick-row:active { background: #f3f9ff; }

.pick-check {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid #cddff0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .16s ease;
}

.pick-row.selected .pick-check {
  background: linear-gradient(135deg, #4aa3ff, #2b7fe0);
  border-color: transparent;
}

.pick-check .ico {
  width: 14px;
  height: 14px;
  color: #fff;
  stroke-width: 3;
  opacity: 0;
}

.pick-row.selected .pick-check .ico {
  opacity: 1;
}

/* ============================================
   扫码
   ============================================ */
.scan-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 340px;
  border-radius: 18px;
  overflow: hidden;
  background: #0d1b2a;
  margin-bottom: 16px;
}

.scan-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 14%;
  border: 3px solid rgba(74, 163, 255, .9);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(8, 20, 34, .5);
  pointer-events: none;
}

.scan-frame::before,
.scan-frame::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 4px solid #4aa3ff;
}

.scan-frame::before {
  top: -4px; left: -4px;
  border-right: none; border-bottom: none;
  border-radius: 10px 0 0 0;
}

.scan-frame::after {
  bottom: -4px; right: -4px;
  border-left: none; border-top: none;
  border-radius: 0 0 10px 0;
}

.scan-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* 二维码展示 */
.qr-wrap {
  text-align: center;
  padding: 8px 0 4px;
}

.qr-canvas-box {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.qr-canvas-box canvas {
  display: block;
  width: 200px;
  height: 200px;
}

.qr-code-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--accent-hover);
  font-family: ui-monospace, monospace;
  margin-bottom: 8px;
  user-select: all;
}

.qr-tip {
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

/* 分段切换 */
.seg-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #f0f6fd;
  border-radius: 12px;
  margin-bottom: 16px;
}

.seg-tab {
  flex: 1;
  padding: 9px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: all .16s ease;
}

.seg-tab.active {
  background: #fff;
  color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(74, 163, 255, .14);
}

/* ============================================
   桌面端
   ============================================ */
@media (min-width: 1024px) {
  .contact-actions,
  .contact-section,
  .contact-list {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .contact-actions { padding: 20px 28px 14px; }
  .contact-section { padding: 0 28px; }
  .contact-list { padding: 0 28px 28px; }
}
