/* =====================================================================
   多企业 IM —— H5 前端样式（Tailwind CSS CDN + 自定义组件层）
   设计基调：企业蓝主色 + MACAW 绿点缀 / 微信式小圆角气泡尖角 /
             移动优先响应式 / 玻璃拟态品牌头 / 卡片圆角 + 轻阴影 / 微交互动效
   ===================================================================== */

/* Tailwind CSS CDN */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

:root {
  /* 主色（企业级商务蓝） */
  --c-primary: #1677FF;
  --c-primary-deep: #0E5FD8;
  --c-primary-light: #4A94FF;

  /* MACAW 品牌绿（点缀色） */
  --c-macaw: #07C160;
  --c-macaw-deep: #059669;

  /* 背景与文字 */
  --c-bg: #F5F7FA;
  --c-surface: #FFFFFF;
  --c-text: #1F2329;
  --c-text-sub: #646A73;
  --c-text-weak: #8F959E;
  --c-line: #EFF1F4;

  /* 功能色 */
  --c-success: #34C724;
  --c-danger: #F54A45;
  --c-warning: #FF8800;

  --radius-card: 14px;
  --radius-bubble: 6px;
  --tabbar-h: 58px;
  --shadow-card: 0 1px 2px rgba(31, 35, 41, .04), 0 6px 18px rgba(31, 35, 41, .06);
  --shadow-soft: 0 2px 10px rgba(15, 34, 67, .06);
  --shadow-pop: 0 10px 40px rgba(15, 34, 67, .16);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------
   语义色 / 任意值工具类（Tailwind 预构建产物不含自定义色与任意值，
   此处补齐，保证页面无需构建即可 100% 呈现设计）
   --------------------------------------------------------------------- */
.bg-bg { background-color: var(--c-bg); }
.text-ink-sub { color: var(--c-text-sub); }
.text-ink-weak { color: var(--c-text-weak); }
.text-primary { color: var(--c-primary); }
.bg-primary { background-color: var(--c-primary); }
.text-danger { color: var(--c-danger); }
.bg-danger { background-color: var(--c-danger); }
.text-success { color: var(--c-success); }
.bg-success { background-color: var(--c-success); }
.border-primary { border-color: var(--c-primary); }
.accent-primary { accent-color: var(--c-primary); }
.hover\:border-primary:hover { border-color: var(--c-primary); }
.hover\:bg-bg:hover { background-color: var(--c-bg); }
.hover\:text-primary:hover { color: var(--c-primary); }

.bg-primary\/10 { background-color: rgba(22, 119, 255, .10); }
.bg-primary\/20 { background-color: rgba(22, 119, 255, .20); }
.hover\:bg-primary\/20:hover { background-color: rgba(22, 119, 255, .20); }

.bg-white\/10 { background-color: rgba(255, 255, 255, .10); }
.bg-white\/15 { background-color: rgba(255, 255, 255, .15); }
.bg-white\/20 { background-color: rgba(255, 255, 255, .20); }
.bg-white\/25 { background-color: rgba(255, 255, 255, .25); }
.bg-white\/30 { background-color: rgba(255, 255, 255, .30); }
.hover\:bg-white\/30:hover { background-color: rgba(255, 255, 255, .30); }
.text-white\/70 { color: rgba(255, 255, 255, .70); }
.text-white\/80 { color: rgba(255, 255, 255, .80); }
.text-white\/90 { color: rgba(255, 255, 255, .90); }
.border-white\/30 { border-color: rgba(255, 255, 255, .30); }

.bg-black\/40 { background-color: rgba(0, 0, 0, .40); }
.bg-black\/45 { background-color: rgba(0, 0, 0, .45); }
.bg-black\/50 { background-color: rgba(0, 0, 0, .50); }
.bg-black\/60 { background-color: rgba(0, 0, 0, .60); }

.text-\[10px\] { font-size: 10px; line-height: 1.4; }
.text-\[11px\] { font-size: 11px; line-height: 1.45; }
.text-\[12px\] { font-size: 12px; line-height: 1.5; }
.text-\[13px\] { font-size: 13px; line-height: 1.5; }
.text-\[14px\] { font-size: 14px; line-height: 1.55; }
.text-\[15px\] { font-size: 15px; line-height: 1.55; }
.text-\[17px\] { font-size: 17px; line-height: 1.45; }
.text-\[18px\] { font-size: 18px; line-height: 1.4; }
.text-\[20px\] { font-size: 20px; line-height: 1.35; }

.max-w-\[70\%\] { max-width: 70%; }
.max-w-\[78\%\] { max-width: 78%; }
.max-w-\[180px\] { max-width: 180px; }
.max-h-\[180px\] { max-height: 180px; }
.max-w-\[400px\] { max-width: 400px; }
.max-w-\[420px\] { max-width: 420px; }
.max-w-\[440px\] { max-width: 440px; }
.max-w-\[460px\] { max-width: 460px; }
.max-h-\[32vh\] { max-height: 32vh; }
.max-h-\[45vh\] { max-height: 45vh; }
.max-h-\[55vh\] { max-height: 55vh; }
.max-h-\[88vh\] { max-height: 88vh; }

.rounded-b-\[28px\] { border-bottom-left-radius: 28px; border-bottom-right-radius: 28px; }
.border-\[\#EFF1F4\] { border-color: #EFF1F4; }

@media (min-width: 768px) {
  .md\:w-\[340px\] { width: 340px; }
}

/* ---------------------------------------------------------------------
   布局
   --------------------------------------------------------------------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--c-bg);
  box-shadow: 0 0 40px rgba(15, 34, 67, .06);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .app-shell { max-width: 100%; min-height: 100vh; }
}

/* 品牌头：蓝绿融合渐变 + 光斑 */
.brand-gradient {
  background: linear-gradient(135deg, #1677FF 0%, #0E5FD8 55%, #0B4FB8 100%);
  position: relative;
  overflow: hidden;
}
.brand-gradient::after {
  content: '';
  position: absolute; inset: -40% -10% auto auto;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(7, 193, 96, .30) 0%, rgba(7, 193, 96, 0) 68%);
  pointer-events: none;
}
.brand-gradient::before {
  content: '';
  position: absolute; left: -30%; bottom: -70%;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.brand-gradient > * { position: relative; z-index: 1; }

.card {
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card-flat {
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--c-line);
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-deep) 100%);
  color: #fff; border-radius: 12px; font-weight: 500;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .28);
}
.btn-primary:active { transform: scale(.97); box-shadow: 0 3px 8px rgba(22, 119, 255, .24); }
.btn-primary:disabled { opacity: .55; box-shadow: none; }

.btn-ghost {
  background: #F2F5FA; color: var(--c-text); border-radius: 12px;
  transition: background .16s ease, transform .16s ease;
}
.btn-ghost:active { transform: scale(.97); background: #E8EEF7; }

.input-line {
  width: 100%; background: #F5F7FA; border: 1px solid transparent;
  border-radius: 12px; padding: 12px 14px; font-size: 15px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.input-line:focus {
  outline: none; background: #fff; border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .12);
}

/* ---------------------------------------------------------------------
   微信式气泡（小圆角 + 尖角）
   --------------------------------------------------------------------- */
.msg-in, .msg-out, .msg-agent {
  position: relative;
  border-radius: var(--radius-bubble);
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
  animation: bubbleIn .2s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }

.msg-in {
  background: #fff;
  border: 1px solid rgba(15, 34, 67, .05);
  box-shadow: 0 1px 2px rgba(15, 34, 67, .05);
}
.msg-in::before {
  content: ''; position: absolute; left: -5px; top: 12px;
  width: 0; height: 0;
  border-right: 6px solid #fff;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.msg-out {
  background: linear-gradient(135deg, #2E86FF 0%, #0E5FD8 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 119, 255, .22);
}
.msg-out::before {
  content: ''; position: absolute; right: -5px; top: 12px;
  width: 0; height: 0;
  border-left: 6px solid #1A7CFF;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.msg-agent {
  background: linear-gradient(135deg, #F0F7FF 0%, #E4F0FF 100%);
  border: 1px solid #CBE1FF;
}
.msg-agent::before {
  content: ''; position: absolute; left: -5px; top: 12px;
  width: 0; height: 0;
  border-right: 6px solid #E9F4FF;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

/* 图片/文件气泡不显示尖角（避免贴边错位） */
.msg-in > img, .msg-out > img, .msg-agent > img { border-radius: 4px; display: block; }
.msg-no-tail::before { display: none !important; }

.badge-unread {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--c-danger); color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; font-weight: 500;
}

.avatar {
  border-radius: 12px; object-fit: cover; background: #E8EEF7;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; letter-spacing: .5px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   底部五按钮导航（聊天 / 通讯录 / MACAW / 发现 / 我的）
   --------------------------------------------------------------------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: stretch;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(15, 34, 67, .06);
  box-shadow: 0 -6px 24px rgba(15, 34, 67, .06);
  padding-bottom: var(--safe-bottom);
  z-index: 40;
}

.tab-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h); padding: 6px 0 4px;
  color: var(--c-text-weak); font-size: 11px; line-height: 1;
  transition: color .18s ease, transform .18s ease;
  user-select: none; -webkit-user-select: none;
}
.tab-item:active { transform: scale(.94); }
.tab-item svg { width: 24px; height: 24px; display: block; }
.tab-item.active { color: var(--c-primary); font-weight: 500; }
.tab-item.active svg { filter: drop-shadow(0 2px 6px rgba(22, 119, 255, .30)); }

/* 中间 MACAW 品牌按钮 */
.tab-macaw {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #EAF3FF, #D9E9FF);
  box-shadow: 0 4px 12px rgba(22, 119, 255, .16);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.tab-macaw img { width: 22px; height: 22px; object-fit: contain; display: block; }
.tab-item.active .tab-macaw {
  background: linear-gradient(135deg, #E3F0FF, #CFE4FF);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, .30), 0 6px 16px rgba(22, 119, 255, .22);
}

/* ---------------------------------------------------------------------
   列表 / 入口行
   --------------------------------------------------------------------- */
.entry-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: #fff; cursor: pointer;
  transition: background .16s ease;
}
.entry-row:active { background: #F2F6FC; }
.entry-icon {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.entry-arrow { color: var(--c-text-weak); flex-shrink: 0; }

/* 群聊卡片（发现页） */
.group-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}
.group-card:active { transform: scale(.985); box-shadow: var(--shadow-soft); }
.group-avatar {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #1677FF, #07C160);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.group-meta { flex: 1; min-width: 0; }
.group-name { font-size: 15px; font-weight: 600; color: var(--c-text); }
.group-sub { font-size: 12px; color: var(--c-text-weak); margin-top: 2px; }

/* 成员选择行 */
.pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; border-bottom: 1px solid var(--c-line); cursor: pointer;
}
.pick-row:last-child { border-bottom: 0; }
.pick-row .pick-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #D1D5DB;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; flex-shrink: 0; transition: all .16s ease;
}
.pick-row.selected .pick-check { background: var(--c-primary); border-color: var(--c-primary); }

/* ---------------------------------------------------------------------
   MACAW 语音助手
   --------------------------------------------------------------------- */
.record-stage {
  background: radial-gradient(circle at 50% 36%, #FFFFFF 0%, #F2F6FC 100%);
  border-radius: 20px;
}
.record-btn {
  width: 168px; height: 168px; border-radius: 50%;
  background: linear-gradient(135deg, #1677FF, #0E5FD8);
  color: #fff; font-size: 16px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 14px 34px rgba(22, 119, 255, .35), inset 0 -6px 0 rgba(0, 0, 0, .08);
  cursor: pointer; user-select: none;
  transition: transform .15s ease, box-shadow .2s ease;
  border: 6px solid #fff;
}
.record-btn:active { transform: scale(.97); }
.record-btn.recording {
  background: linear-gradient(135deg, #F54A45, #B91C1C);
  box-shadow: 0 0 0 0 rgba(245, 74, 69, .55), 0 14px 34px rgba(245, 74, 69, .35);
  animation: recPulse 1.4s infinite;
}
@keyframes recPulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 74, 69, .55), 0 14px 34px rgba(245, 74, 69, .35); }
  70%  { box-shadow: 0 0 0 26px rgba(245, 74, 69, 0), 0 14px 34px rgba(245, 74, 69, .35); }
  100% { box-shadow: 0 0 0 0 rgba(245, 74, 69, 0), 0 14px 34px rgba(245, 74, 69, .35); }
}
.record-icon { width: 52px; height: 52px; }
.record-timer {
  font-variant-numeric: tabular-nums; font-size: 36px; font-weight: 700;
  letter-spacing: 1px; color: var(--c-text);
}
.record-status { font-size: 13px; color: var(--c-text-weak); }

.seg-card {
  background: #fff; border-radius: 12px; padding: 11px 13px; margin-bottom: 8px;
  box-shadow: var(--shadow-soft); border: 1px solid rgba(15, 34, 67, .04);
}
.seg-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--c-text-weak); }
.seg-text { font-size: 14px; color: var(--c-text); margin-top: 5px; line-height: 1.55; white-space: pre-wrap; }
.seg-tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; }
.seg-tag.pending      { background: #FEF3C7; color: #92400E; }
.seg-tag.upload       { background: #DBEAFE; color: #1D4ED8; }
.seg-tag.recognizing  { background: #E0E7FF; color: #3730A3; }
.seg-tag.asr          { background: #DCFCE7; color: #166534; }
.seg-tag.failed       { background: #FEE2E2; color: #B91C1C; }

.summary-card {
  background: linear-gradient(135deg, #ECFEFF 0%, #F0FDF4 100%);
  border: 1px solid #A7F3D0; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, .08);
}
.summary-title { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #065F46; font-weight: 600; }
.summary-title .badge { background: var(--c-macaw-deep); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 5px; }
.summary-body { font-size: 14px; color: #1F2937; margin-top: 8px; line-height: 1.6; }
.summary-body .kp { display: block; margin-top: 10px; }
.summary-body .kp-title { font-size: 12px; color: #047857; font-weight: 600; margin-bottom: 4px; }
.summary-body ul { padding-left: 18px; margin: 0; }
.summary-body li { font-size: 13px; color: #374151; margin: 2px 0; }
.summary-body .todo { color: #B45309; }

/* ---------------------------------------------------------------------
   动效
   --------------------------------------------------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.anim-fade-up { animation: fadeUp .28s cubic-bezier(.22, .61, .36, 1) both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-fade { animation: fadeIn .22s ease both; }

@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.anim-slide-right { animation: slideInRight .26s cubic-bezier(.22, .61, .36, 1) both; }

@keyframes popIn { 0% { opacity: 0; transform: scale(.9); } 60% { transform: scale(1.02); } 100% { opacity: 1; transform: scale(1); } }
.anim-pop { animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1) both; }

/* 振铃脉冲光圈 */
@keyframes ringPulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 119, 255, .45); }
  70% { box-shadow: 0 0 0 26px rgba(22, 119, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 119, 255, 0); }
}
.ring-pulse { animation: ringPulse 1.8s infinite; }

/* 通话中声波律动 */
.wave-bar {
  width: 4px; border-radius: 2px; background: #fff;
  animation: wave 1s ease-in-out infinite;
}
@keyframes wave { 0%, 100% { height: 8px; opacity: .55; } 50% { height: 26px; opacity: 1; } }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, #EEF1F5 25%, #F7F9FC 37%, #EEF1F5 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 消息气泡进入 */
.msg-enter { animation: fadeUp .24s cubic-bezier(.22, .61, .36, 1) both; }

/* 滚动条（PC） */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D6DCE5; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* 连接状态条 */
.net-banner {
  background: #FFF7E6; color: #AD6800; font-size: 12px;
  border-bottom: 1px solid #FFE7BA;
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 96px; z-index: 90;
  background: rgba(31, 35, 41, .92); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  animation: fadeUp .2s ease both;
  max-width: 78%; text-align: center;
}
