/* ========== 好友页面样式 ========== */

/* 好友列表 */
.friend-list {
  padding: 8px 0;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  cursor: pointer;
  transition: background 0.3s;
  border-bottom: 1px solid var(--divider);
}

.friend-item:active {
  background: var(--bg);
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.friend-name {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.friend-time {
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
}

.friend-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.friend-last-msg {
  font-size: 13px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 8px;
}

.friend-unread {
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* ---- 聊天页面 ---- */
.chat-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 80;
  display: none;
  flex-direction: column;
}

.chat-screen.active {
  display: flex;
}

.chat-header {
  height: 50px;
  background: var(--white);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-back svg {
  width: 22px;
  height: 22px;
}

.chat-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.chat-more {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-secondary);
}

/* 消息列表 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-time-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  padding: 8px 0;
}

.chat-bubble-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.chat-bubble-row.me {
  flex-direction: row-reverse;
}

.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.chat-bubble.other {
  background: var(--white);
  color: var(--text);
  border-top-left-radius: 4px;
}

.chat-bubble.mine {
  background: var(--gradient);
  color: #fff;
  border-top-right-radius: 4px;
}

/* 礼物消息 */
.chat-gift {
  max-width: 70%;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  text-align: center;
}

.chat-gift.mine {
  border-color: var(--primary);
}

.chat-gift-icon {
  font-size: 40px;
  margin-bottom: 6px;
}

.chat-gift-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

.chat-gift.mine .chat-gift-name {
  color: var(--primary);
}

.chat-gift-desc {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* 输入栏 */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: calc(10px + var(--safe-bottom));
}

.chat-gift-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gold);
  font-size: 22px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  height: 40px;
  background: var(--bg);
  border-radius: 20px;
  padding: 0 16px;
  font-size: 14px;
  border: 1px solid var(--border);
}

.chat-input:focus {
  border-color: var(--primary);
}

.chat-send-btn {
  width: 64px;
  height: 40px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- 礼物弹窗 ---- */
.gift-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  z-index: 110;
  display: none;
  animation: slideUp 0.3s ease;
}

.gift-panel.active {
  display: block;
}

.gift-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.gift-panel-title {
  font-size: 16px;
  font-weight: 600;
}

.gift-panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-light);
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.gift-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.gift-item:active,
.gift-item.selected {
  border-color: var(--primary);
  background: var(--wine-red-bg);
}

.gift-item-icon {
  font-size: 36px;
  margin-bottom: 6px;
}

.gift-item-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

.gift-item-price {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
}

.gift-item-desc {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gift-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.gift-send-btn {
  width: 100%;
  height: 44px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.gift-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
