/* 云台手机端原型 */

:root {
  --brand-blue: #1677ff;
  --brand-red: #e60012;
  --text: #1f1f1f;
  --text-2: #8c8c8c;
  --border: #f0f0f0;
  --bg: #fff;
  --bg-gray: #f5f5f5;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 56px;
  --phone-w: 390px;
  --phone-h: 844px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: "PingFang SC", "SF Pro Text", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #dfe3ea;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  border: none;
  background: none;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ===== 手机外框（桌面预览） ===== */
.phone-shell {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.phone-frame {
  width: min(100vw, var(--phone-w));
  height: min(100dvh - 32px, var(--phone-h));
  background: var(--bg);
  border-radius: 28px;
  box-shadow:
    0 0 0 10px #1a1a1a,
    0 0 0 12px #333,
    0 24px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (max-width: 430px) {
  .phone-shell {
    padding: 0;
    background: var(--bg);
  }

  .phone-frame {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ===== 状态栏 ===== */
.status-bar {
  height: 44px;
  padding: 14px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #fff;
  z-index: 5;
}

.status-time {
  font-size: 15px;
  font-weight: 600;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-signal,
.status-wifi {
  width: 16px;
  height: 10px;
  background: #111;
  border-radius: 1px;
  opacity: 0.85;
}

.status-wifi {
  width: 14px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.status-battery {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 5px;
  border: 1.5px solid #111;
  border-radius: 4px;
}

/* ===== 页面容器 ===== */
.page {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: #fff;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom));
}

.page.is-active {
  display: flex;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #333;
}

.icon-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

/* ===== 消息页 ===== */
.msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 8px 16px;
  flex-shrink: 0;
}

.org-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 600;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-header-actions {
  display: flex;
  gap: 2px;
}

.msg-search-row {
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.msg-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 8px;
  background: var(--bg-gray);
  border-radius: 18px;
}

.search-ai-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-search input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  outline: none;
  background: transparent;
}

.msg-search input::placeholder {
  color: #bbb;
}

.msg-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 8px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.msg-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  position: relative;
  flex-shrink: 0;
  padding: 8px 10px;
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.filter-chip.is-active {
  color: var(--brand-blue);
  font-weight: 600;
}

.filter-chip.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 24px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--brand-blue);
}

.filter-chip.has-dot::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-red);
}

.filter-trash {
  margin-left: auto;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.msg-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.msg-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  align-items: flex-start;
}

.msg-item:active {
  background: #fafafa;
}

.msg-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  background: #91caff;
}

.msg-avatar.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #eee;
  padding: 1px;
}

.msg-avatar.grid span {
  background: #adc6ff;
  font-size: 0;
}

.msg-avatar.notice {
  background: linear-gradient(145deg, #ffd666, #faad14);
  font-size: 18px;
}

.msg-avatar.system {
  background: linear-gradient(145deg, #69b1ff, #1677ff);
}

.msg-body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.msg-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.msg-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.msg-tag {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f0f0f0;
  color: #888;
}

.msg-tag.dept {
  background: #f6ffed;
  color: #52c41a;
}

.msg-time {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12px;
  color: #bbb;
}

.msg-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-unread {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--brand-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

/* ===== 翼小咖页 ===== */
.page-yxk {
  background: #fff;
}

.yxk-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 4px;
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}

.yxk-nav-left,
.yxk-nav-right {
  display: flex;
  align-items: center;
  width: 80px;
}

.yxk-nav-right {
  justify-content: flex-end;
}

.yxk-nav-title {
  font-size: 17px;
  font-weight: 600;
}

.yxk-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  flex-shrink: 0;
}

.yxk-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 20px 12px;
  -webkit-overflow-scrolling: touch;
}

.yxk-welcome {
  padding-top: 28px;
}

.yxk-hi {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand-red);
  line-height: 1.35;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.yxk-hi-word {
  position: relative;
  margin-right: 4px;
}

.yxk-hi-spark {
  font-size: 12px;
  color: #ff85a2;
  margin: 0 2px 10px 0;
  align-self: flex-start;
}

.yxk-ask {
  margin-top: 6px;
  font-size: 14px;
  color: #666;
}

.yxk-try {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.yxk-try-label {
  font-size: 13px;
  color: #999;
}

.yxk-refresh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #999;
}

.yxk-suggests {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.yxk-suggest {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid #eee;
  border-radius: 12px;
  background: #fafafa;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

.yxk-suggest:active {
  background: #fff1f0;
  border-color: #ffccc7;
  color: var(--brand-red);
}

.yxk-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}

.yxk-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.yxk-bubble.user {
  align-self: flex-end;
  background: #fff1f0;
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.yxk-bubble.ai {
  align-self: flex-start;
  background: #f5f5f5;
  border-bottom-left-radius: 4px;
}

.yxk-modes {
  display: flex;
  gap: 8px;
  padding: 8px 12px 6px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.yxk-modes::-webkit-scrollbar {
  display: none;
}

.yxk-mode {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  font-size: 12px;
  color: #555;
  background: #fff;
}

.yxk-mode.is-active {
  border-color: var(--brand-red);
  color: var(--brand-red);
  background: #fff7f7;
}

.yxk-input-wrap {
  padding: 6px 12px 10px;
  flex-shrink: 0;
  background: #fff;
}

.yxk-input-box {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px 8px 6px 14px;
  border: 1px solid #eee;
  border-radius: 22px;
  background: #fafafa;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.yxk-input-box input {
  flex: 1;
  min-width: 0;
  outline: none;
  font-size: 14px;
  background: transparent;
}

.yxk-input-box input::placeholder {
  color: #bbb;
}

.yxk-input-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #888;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== 占位页 ===== */
.page-placeholder .placeholder-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-2);
  padding: 24px;
  text-align: center;
}

.placeholder-title {
  font-size: 18px;
  font-weight: 600;
  color: #666;
}

.placeholder-desc {
  font-size: 13px;
}

/* ===== 底部 Tab ===== */
.tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: stretch;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 20;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #999;
  padding-top: 4px;
}

.tab-item.is-active {
  color: var(--brand-blue);
}

.tab-item[data-tab="yxk"].is-active {
  color: var(--brand-red);
}

.tab-icon {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon-yxk img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.tab-ai-badge {
  position: absolute;
  top: -3px;
  right: -8px;
  min-width: 16px;
  height: 12px;
  padding: 0 2px;
  border-radius: 6px;
  background: var(--brand-red);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
  box-shadow: 0 0 0 1.5px #fff;
}

.tab-badge {
  position: absolute;
  top: -4px;
  right: -12px;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--brand-red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.tab-label {
  font-size: 10px;
  line-height: 1.2;
}

.tab-item.is-active .tab-label {
  font-weight: 600;
}
