/* === 基础样式 (通用) === */
#ai-popup-container {
    position: absolute;
    z-index: 9999;
    background-color: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 15px;
    width: 340px;
    font-size: 0.95em;
    display: none;
    color: var(--md-default-fg-color);
    transition: all 0.2s ease;
}

/* 按钮组 */
.ai-btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-btn {
    flex: 1;
    background-color: var(--md-primary-fg-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-btn:active { transform: scale(0.98); }

/* 结果显示区 */
#ai-result-area {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--md-default-fg-color--lightest);
    font-size: 14px;
    line-height: 1.6;
    max-height: 40vh; /* 防止内容过长 */
    overflow-y: auto;
}

/* 加载动画文字 */
.ai-loading {
    color: var(--md-primary-fg-color);
    font-style: italic;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* === 移动端适配 (核心代码) === */
@media screen and (max-width: 768px) {
    #ai-popup-container {
        /* 强制固定在底部 */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0; /* 只有上面有圆角 */
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        padding-bottom: 30px; /* 适配 iPhone 底部横条 */
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* 增加一个关闭按钮，因为手机点击空白处不够直观 */
    #ai-close-btn {
        display: block !important;
        position: absolute;
        top: 10px;
        right: 15px;
        background: none;
        border: none;
        font-size: 20px;
        color: #999;
    }
}

/* PC端隐藏关闭按钮 */
#ai-close-btn { display: none; }