/* ========== ZUZU 伴学助手样式 ========== */

/* 遮罩层 */
.zu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 10009; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.zu-overlay.zu-open { opacity: 1; pointer-events: auto; }

/* 聊天面板 */
.zu-chat-panel {
    position: fixed; left: 290px; top: 50%; width: 910px; height: 90vh; max-height: 950px; 
    background: rgba(22, 33, 62, 0.96); backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 243, 255, 0.3); border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.15);
    z-index: 10010; display: flex; flex-direction: column;
    transform: translateY(-50%) scale(0.3); opacity: 0; pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.zu-chat-panel.zu-open {
    transform: translateY(-50%) scale(1); opacity: 1; pointer-events: auto;
}
.zu-chat-panel.zu-open::before {
    content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 22px; background: linear-gradient(45deg, #00f3ff, #a855f7, #00f3ff);
    z-index: -1; animation: zu-glow-scan 1.5s ease-out; opacity: 0;
}
@keyframes zu-glow-scan {
    0% { opacity: 0.8; filter: blur(10px); }
    100% { opacity: 0; filter: blur(0); }
}

/* 头部 */
.zu-chat-header {
    padding: 14px 20px 6px; display: flex; justify-content: space-between;
    align-items: flex-start; color: #00f3ff; font-weight: bold; font-size: 16px;
}
.zu-header-left { display: flex; align-items: center; gap: 10px; }
.zu-header-logo { width: 32px; height: 32px; }
.zu-header-subtitle { font-size: 12px; color: #888; font-weight: normal; margin-top: 2px; }
.zu-header-actions { display: flex; align-items: center; gap: 6px; }

.zu-btn-clear-header {
    background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: #aaa; padding: 4px 8px; border-radius: 14px; font-size: 14px;
    cursor: pointer; transition: all 0.2s;
}
.zu-btn-clear-header:hover { color: #fff; border-color: #fff; }

.zu-btn-login {
    background: rgba(0, 243, 255, 0.15); border: 1px solid rgba(0, 243, 255, 0.3);
    color: #00f3ff; padding: 4px 10px; border-radius: 14px; font-size: 12px;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.zu-btn-login:hover { background: rgba(0, 243, 255, 0.25); }

.zu-chat-close {
    background: none; border: none; color: #aaa; font-size: 22px;
    cursor: pointer; padding: 0 2px; transition: color 0.2s;
}
.zu-chat-close:hover { color: #ff4444; }

/* 预设问题 */
.zu-preset-questions {
    padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-wrap: wrap; gap: 8px;
}
.zu-preset-tag {
    background: rgba(0, 243, 255, 0.1); border: 1px solid rgba(0, 243, 255, 0.25);
    color: #00f3ff; padding: 6px 12px; border-radius: 20px; font-size: 13px;
    cursor: pointer; transition: all 0.2s;
}
.zu-preset-tag:hover { background: rgba(0, 243, 255, 0.25); border-color: #00f3ff; }

/* 消息区域 */
.zu-chat-messages {
    flex: 1; min-height: 420px; max-height: 990px; overflow-y: auto;
    padding: 16px; display: block;
}
.zu-chat-messages::-webkit-scrollbar { width: 5px; }
.zu-chat-messages::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 10px; }
.zu-chat-messages::-webkit-scrollbar-thumb { background: rgba(0, 243, 255, 0.3); border-radius: 10px; }

.zu-msg-label { font-size: 11px; color: #00f3ff; margin-bottom: 3px; font-weight: bold; }
.zu-msg-label.zu-label-user { text-align: right; color: #a855f7; }

.zu-msg { padding: 10px 14px; border-radius: 16px; max-width: 85%; font-size: 14px; line-height: 1.6; }
.zu-msg-user-wrap { display: block; margin-bottom: 12px; text-align: right; }
.zu-msg-user { display: inline-block; background: rgba(0, 243, 255, 0.2); color: #fff; word-break: break-word; white-space: normal; max-width: 85%; }
.zu-msg-ai-wrap { align-self: flex-start; display: flex; flex-direction: column; width: auto; max-width: 100%; }
.zu-msg-ai { background: rgba(255,255,255,0.06); color: #ccc; white-space: pre-wrap; word-break: break-word; max-width: 85%; display: inline-block; }

/* 投票按钮 */
.zu-vote-btns { display: flex; gap: 8px; margin-top: 4px; }
.zu-vote-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.15);
    color: #888; padding: 3px 8px; border-radius: 12px; font-size: 12px;
    cursor: pointer; transition: all 0.2s;
}
.zu-vote-btn:hover { border-color: #00f3ff; color: #00f3ff; }
.zu-vote-btn.zu-voted { border-color: #00f3ff; color: #00f3ff; background: rgba(0, 243, 255, 0.15); }

/* 思考中动画 */
.zu-thinking {
    align-self: flex-start; display: flex; align-items: center; gap: 6px;
    color: #888; font-size: 13px; padding: 8px 14px;
}
.zu-thinking .zu-dot {
    width: 6px; height: 6px; background: #00f3ff; border-radius: 50%;
    animation: zu-dot-bounce 1.4s infinite ease-in-out both;
}
.zu-thinking .zu-dot:nth-child(1) { animation-delay: -0.32s; }
.zu-thinking .zu-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes zu-dot-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 输入区域 */
.zu-chat-input-area {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; gap: 8px;
}
.zu-chat-input-area input {
    flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; padding: 10px 14px; border-radius: 25px; outline: none; font-size: 14px;
}
.zu-chat-input-area button {
    background: linear-gradient(135deg, #00f3ff, #a855f7);
    border: none; color: #fff; padding: 10px 14px; border-radius: 25px;
    cursor: pointer; font-weight: bold; font-size: 13px;
}

/* ===== 亮色模式适配 ===== */
body.light-mode .zu-chat-panel {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}
body.light-mode .zu-chat-header { color: #0088cc; }
body.light-mode .zu-header-subtitle { color: #666; }
body.light-mode .zu-btn-clear-header { border-color: rgba(0, 0, 0, 0.15); color: #666; }
body.light-mode .zu-btn-clear-header:hover { color: #333; border-color: #333; }
body.light-mode .zu-preset-questions { border-bottom-color: rgba(0, 0, 0, 0.06); }
body.light-mode .zu-preset-tag {
    background: rgba(0, 136, 204, 0.08); border-color: rgba(0, 136, 204, 0.2); color: #0088cc;
}
body.light-mode .zu-preset-tag:hover { background: rgba(0, 136, 204, 0.15); border-color: #0088cc; }
body.light-mode .zu-chat-messages::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.03); }
body.light-mode .zu-msg-label { color: #0088cc; }
body.light-mode .zu-msg-label.zu-label-user { color: #7b3fb8; }
body.light-mode .zu-msg-user { background: rgba(0, 136, 204, 0.1); color: #1a1a1a; }
body.light-mode .zu-msg-ai { background: rgba(0, 0, 0, 0.04); color: #1a1a1a; }
body.light-mode .zu-vote-btn { border-color: rgba(0, 0, 0, 0.15); color: #666; }
body.light-mode .zu-thinking { color: #666; }
body.light-mode .zu-chat-input-area { border-top-color: rgba(0, 0, 0, 0.1); }
body.light-mode .zu-chat-input-area input {
    background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.15); color: #1a1a1a;
}

/* ===== 手机端适配 ===== */
/* ===== 手机端适配 ===== */
@media (max-width: 768px) {
    .zu-chat-panel {
        left: 0 !important;
        top: 0 !important;                   /* 去掉顶部留白，从屏幕顶部开始 */
        bottom: auto !important;
        width: 100vw !important;
        height: 100vh !important;            /* fallback，兼容旧版浏览器 */
        height: 100dvh !important;           /* 动态视口高度，自动适配苹果底部地址栏 */
        max-height: none !important;
        border-radius: 0 !important;         /* 手机端全屏，无需圆角 */
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    .zu-chat-panel.zu-open { 
        transform: translateY(0) !important; 
    }
    
    .zu-chat-messages { 
        min-height: 200px; 
        max-height: none; 
    }
    
    /* 预设问题：露出2.5个问题高度，底部渐变遮罩暗示可滚动 */
    .zu-preset-questions {
        max-height: 90px;                    /* 约2.5个问题标签的高度 */
        overflow-y: auto;                    /* 允许滚动 */
        gap: 4px;
        padding-bottom: 2px;
        position: relative;
    }
    .zu-preset-questions::after {
        content: '';
        position: absolute;
        bottom: 0; left: 0; right: 0;
        height: 15px;
        background: linear-gradient(to top, rgba(22,33,62,0.6), transparent);
        pointer-events: none;                /* 不阻挡点击 */
    }
    .zu-preset-tag { 
        font-size: 12px; 
        padding: 4px 8px; 
    }
    
    /* 输入区域 */
    .zu-chat-input-area {
        padding: 8px 10px; 
        gap: 6px;
        align-items: center;
    }
    .zu-chat-input-area input {
        font-size: 16px !important;          /* 防止iOS自动缩放 */
        padding: 10px 12px;
        flex: 1;
        min-width: 0;                        /* 防止输入框撑破父容器 */
    }
    
    /* 清屏按钮：图标+文字，扁长形 */
    .zu-btn-clear {
        width: 44px; 
        min-width: 44px;
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
        justify-content: center;
    }
    .zu-btn-clear i { 
        font-size: 14px; 
        margin-right: 2px; 
    }
    
    /* 发送按钮：显示文字，扁长形 */
    #zuChatSend {
        width: auto; 
        min-width: 52px;
        padding: 10px 14px;
        font-size: 14px;
        white-space: nowrap;
    }
        /* 关闭按钮：加大，加圆形边框，醒目易点 */
    .zu-chat-close {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.3);
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0,0,0,0.3);
        color: #fff;
    }
    
    /* 手机端隐藏遮罩层（全屏弹窗已无需遮罩） */
    .zu-overlay {
        display: none !important;
    }
}