/* 聊天应用样式 */
#chat-app {
    background: var(--background-color);
}

/* Tab栏 */
.tab-bar {
    display: flex;
    background: var(--surface-color);
    border-bottom: 0.5px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 9;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.tab-icon {
    font-size: 22px;
}

.tab-label {
    font-size: 11px;
    font-weight: 500;
}

/* Tab内容 */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-content.active {
    display: block;
}

/* 聊天列表 */
.chat-list {
    padding: 8px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    background: var(--surface-color);
    border-bottom: 0.5px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:active {
    background: var(--background-color);
}

.chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--success-color);
    border: 2px solid var(--surface-color);
}

.chat-status-badge.offline {
    background: var(--text-tertiary);
}

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

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview.unread {
    color: var(--text-primary);
    font-weight: 500;
}

/* 聊天详情页 */
#chat-detail .header-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    color: var(--success-color);
    font-weight: 500;
}

.chat-status.offline {
    color: var(--text-secondary);
}

/* 消息容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 8px;
    animation: slideInUp 0.3s ease;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.message.char .message-bubble {
    background: var(--surface-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

/* 特殊消息类型 */
.message-transfer {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2) !important;
    color: var(--text-primary) !important;
    border: 1px solid #ffb74d;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transfer-amount {
    font-size: 24px;
    font-weight: 700;
    color: #f57c00;
}

.transfer-note {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 消息工具栏 */
.message-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--blur-bg);
    backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--border-color);
    padding: 12px;
    display: flex;
    gap: 8px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 100;
}

.message-actions.active {
    transform: translateY(0);
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:active {
    transform: scale(0.95);
    background: var(--border-color);
}

.action-btn.danger {
    color: var(--danger-color);
}

/* 聊天输入区域 */
.chat-input-area {
    background: var(--surface-color);
    border-top: 0.5px solid var(--border-color);
    padding: 8px 12px;
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.input-tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.input-tool-btn:active {
    background: var(--background-color);
    transform: scale(0.95);
}

.input-wrapper {
    flex: 1;
    background: var(--background-color);
    border-radius: 18px;
    padding: 8px 12px;
    max-height: 100px;
    overflow-y: auto;
}

.message-input {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    line-height: 1.4;
    max-height: 80px;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.send-btn:active {
    background: #0051D5;
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 回顾列表 */
.review-list {
    padding: 16px;
}

.review-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.review-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.review-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.review-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.review-info {
    flex: 1;
}

.review-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.review-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.review-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 设置列表 */
.settings-list {
    padding: 16px;
}

.settings-item {
    background: var(--surface-color);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.settings-item:active {
    background: var(--background-color);
}

.settings-item-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.settings-item-content {
    flex: 1;
}

.settings-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.settings-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-item-arrow {
    font-size: 20px;
    color: var(--text-tertiary);
}

/* AI输入指示器 */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}
