/**
 * V3.0 增强样式
 * PWA安装提示、Toast通知、动画效果
 */

/* PWA安装提示 */
.pwa-install-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 320px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.pwa-install-banner .icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.pwa-install-banner .content {
    flex: 1;
}

.pwa-install-banner .title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.pwa-install-banner .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.pwa-install-banner .actions {
    display: flex;
    gap: 8px;
}

.pwa-install-banner button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-install-banner .btn-install {
    background: var(--primary);
    color: #fff;
    border: none;
}

.pwa-install-banner .btn-install:hover {
    background: var(--primary-dark);
}

.pwa-install-banner .btn-dismiss {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Toast通知 */
.v3-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.v3-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.v3-toast.success {
    background: rgba(82, 196, 26, 0.9);
}

.v3-toast.error {
    background: rgba(255, 77, 79, 0.9);
}

.v3-toast.warning {
    background: rgba(250, 173, 20, 0.9);
}

/* 消息发送中动画 */
.message-sending {
    opacity: 0.7;
}

.message-sending::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* 进度条 */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.progress-overlay.show {
    display: flex;
}

.progress-box {
    background: var(--bg-page);
    border-radius: 12px;
    padding: 24px 32px;
    min-width: 280px;
    text-align: center;
}

.progress-box .title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 16px;
}

.progress-box .bar {
    height: 6px;
    background: var(--bg-body);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-box .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-box .percent {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 文件拖放区域 */
.drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 163, 127, 0.1);
    border: 2px dashed var(--primary);
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.drop-zone.active {
    display: flex;
}

.drop-zone .hint {
    font-size: 16px;
    color: var(--primary);
    font-weight: 500;
}

/* 多模态消息样式 */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-body .message-attachments {
    margin: -4px;
    margin-bottom: 4px;
}

.message-body .message-text {
    margin-top: 8px;
}

.message-attachment {
    display: inline-block;
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    margin: 4px;
    vertical-align: top;
}

.message-attachment:hover {
    transform: scale(1.02);
}

.message-attachment img,
.message-attachment video {
    display: block;
    width: 100%;
    height: auto;
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
}

/* 视频播放按钮 */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-play-overlay::after {
    content: "▶";
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
}

/* 意图识别标签 */
.intent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(24, 144, 255, 0.1);
    color: #1890ff;
    margin-bottom: 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .pwa-install-banner {
        left: 16px;
        right: 16px;
        transform: translateY(100px);
        min-width: auto;
    }
    
    .pwa-install-banner.show {
        transform: translateY(0);
    }
    
    .progress-box {
        margin: 0 20px;
        min-width: auto;
    }
    
    .message-attachment {
        max-width: 150px;
        max-height: 120px;
    }
}
