/* Spark AI助手页面样式 - 科幻未来风设计 */

/* 使用全局主题变量系统，确保与主站一致 */
/* 主题变量已在全局CSS中定义，这里直接使用全局变量 */

.spark-container {
    position: fixed;
    top: 0;
    right: -400px;  /* 完全隐藏到屏幕右侧 */
    width: 400px;
    height: 100vh;
    background: var(--panel);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;  /* 使用flex布局 */
    flex-direction: column;
    
    /* 科幻风格投影 - 立体凸出效果 */
    filter: 
        drop-shadow(0 0 3px var(--line-main)) 
        drop-shadow(0 0 1px var(--line-main));
    
    /* 立体效果 - 右下方向白色高光 */
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset -2px -2px 4px rgba(255, 255, 255, 0.3),
        inset 2px 2px 4px rgba(0, 0, 0, 0.1);

    /* 机械切角 */
    clip-path: polygon(
        12px 0,
        calc(100% - 8px) 0,
        100% 12px,
        100% calc(100% - 8px),
        calc(100% - 12px) 100%,
        8px 100%,
        0 calc(100% - 12px),
        0 8px
    );
}

/* 外描边 - 轻微发光效果 */
.spark-container::before {
    content: "";
    position: absolute;
    inset: -2px;
    border: 2px solid var(--line-main);
    clip-path: inherit;
    box-shadow: 
        0 0 1px var(--line-main);
    z-index: -1;
    pointer-events: none;
}

/* 内描边 - 轻微发光效果 */
.spark-container::after {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid var(--line-soft);
    clip-path: inherit;
    box-shadow: 
        0 0 0.5px var(--line-soft);
    z-index: -1;
    pointer-events: none;
}

.spark-container.open {
    right: 0;  /* 显示在屏幕右侧 */
}

/* 悬浮效果 - 科幻增强投影 */
.spark-container:hover {
    filter: 
        drop-shadow(0 0 5px var(--line-main)) 
        drop-shadow(0 0 12px var(--line-main));
}

.spark-container:hover::before {
    box-shadow: 
        0 0 12px var(--line-main),
        0 0 20px var(--line-main),
        0 0 35px var(--line-main),
        inset 0 0 8px var(--line-main);
    animation: hologram-pulse 1.5s ease-in-out infinite;
}

.spark-container:hover::after {
    box-shadow: 
        0 0 10px var(--line-soft),
        0 0 18px var(--line-soft),
        0 0 30px var(--line-soft),
        inset 0 0 5px var(--line-soft);
    animation: energy-pulse 1s ease-in-out infinite;
}

/* 科幻动画效果 */
@keyframes hologram-pulse {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 
            0 0 8px var(--line-main),
            0 0 15px var(--line-main),
            0 0 25px var(--line-main),
            inset 0 0 5px var(--line-main);
    }
    50% {
        opacity: 1;
        box-shadow: 
            0 0 12px var(--line-main),
            0 0 20px var(--line-main),
            0 0 35px var(--line-main),
            inset 0 0 8px var(--line-main);
    }
}

@keyframes energy-pulse {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 
            0 0 8px var(--line-soft),
            0 0 15px var(--line-soft),
            0 0 25px var(--line-soft),
            inset 0 0 4px var(--line-soft);
    }
    50% {
        opacity: 1;
        box-shadow: 
            0 0 12px var(--line-soft),
            0 0 22px var(--line-soft),
            0 0 35px var(--line-soft),
            inset 0 0 6px var(--line-soft);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .spark-container {
        width: 100vw;
        right: -100vw;
    }
    
    .spark-container.open {
        right: 0;
    }
    
    .messages-container {
        height: calc(100vh - 200px);
        padding: 15px;
    }
    
    .input-area {
        padding: 15px;
    }
    
    .user-message .message-content,
    .system-message .message-content {
        max-width: 90%;
    }
}

/* 主题切换过渡动画 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 确保所有元素都能正确使用主题变量 */
body {
    background: var(--panel);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Spark框架样式 */
.spark-frame {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.spark-header {
    background: var(--panel);
    color: var(--text);
    padding: 15px 20px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 18px;
    position: relative;
}

.spark-header h2 {
    color: var(--text);
    font-weight: 700;
    margin: 0;
}

.spark-title {
    color: var(--text);
    font-weight: 700;
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--line-soft);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    z-index: 10;
}

.close-btn:hover {
    background: var(--line-main);
    color: white;
    box-shadow: 0 0 10px var(--line-main);
}

.chat-container {
    height: calc(100vh - 80px);
}

.messages-container {
    height: calc(100vh - 180px);
    padding: 20px;
    overflow-y: auto;
    display: block;
}

.user-message {
    text-align: right;
    margin-bottom: 15px;
}

.system-message {
    text-align: left;
    margin-bottom: 15px;
}

.user-message .message-content {
    display: inline-block;
    max-width: 80%;
    padding: 10px 15px;
    color: white;
    border-radius: 10px;
    word-wrap: break-word;
    line-height: 1.4;
}

.system-message .message-content {
    display: inline-block;
    max-width: 80%;
    padding: 10px 15px;
    color: var(--text);
    border-radius: 10px;
    word-wrap: break-word;
    line-height: 1.4;
}

.message-avatar {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: var(--line-main);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    margin-right: 10px;
    font-size: 16px;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 5px;
}

.message-time {
    font-size: 12px;
    color: var(--text);
    opacity: 0.7;
    text-align: right;
}

.thinking-indicator {
    display: inline-block;
    max-width: 80%;
    padding: 10px 15px;
    color: var(--text);
    opacity: 0.7;
    border-radius: 10px;
    font-style: italic;
}

.thinking-dots::after {
    content: '';
    animation: thinking-dots 1.5s infinite;
}

@keyframes thinking-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

.input-area {
    padding: 20px;
    border-top: 1px solid var(--line-soft);
    background: var(--panel);
}

.input-container {
    display: flex;
}

.input-frame {
    background: var(--bg-panel, #ffffff);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#message-input {
    flex: 1;
    background: var(--bg-panel, white);
    border: 1px solid var(--line-soft, #ccc);
    border-radius: 5px;
    padding: 10px;
    color: var(--text-primary, #333);
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    transition: all 0.3s ease;
}

#message-input:focus {
    outline: none;
    border-color: var(--line-main, #007bff);
    box-shadow: 0 0 5px var(--line-main, #007bff);
}

#message-input::placeholder {
    color: var(--line-soft, #999);
}

#send-btn {
    background: var(--line-main, #007bff);
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s ease;
}

#send-btn:hover {
    background: var(--accent, #10b981);
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--accent, #10b981);
}

/* 聊天气泡样式 - 科幻未来风 */
.spark-chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--bg-panel, #ffffff);
    cursor: pointer;
    z-index: 999;
    font-size: 24px;
    color: var(--text-primary, #0b1b2b);
    text-align: center;
    line-height: 60px;
    
    /* 科幻风格投影 */
    filter: 
        drop-shadow(0 0 3px var(--line-main, #007bff)) 
        drop-shadow(0 0 1px var(--line-main, #007bff));
    
    /* 立体效果 */
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset -2px -2px 4px rgba(255, 255, 255, 0.3),
        inset 2px 2px 4px rgba(0, 0, 0, 0.1);

    /* 机械切角 */
    clip-path: polygon(
        8px 0,
        calc(100% - 8px) 0,
        100% 8px,
        100% calc(100% - 8px),
        calc(100% - 8px) 100%,
        8px 100%,
        0 calc(100% - 8px),
        0 8px
    );
    
    transition: all 0.3s ease;
}

/* 外描边 - 轻微发光效果 */
.spark-chat-bubble::before {
    content: "";
    position: absolute;
    inset: -2px;
    border: 2px solid var(--line-main, #007bff);
    clip-path: inherit;
    box-shadow: 
        0 0 1px var(--line-main, #007bff);
    z-index: -1;
    pointer-events: none;
}

/* 内描边 - 轻微发光效果 */
.spark-chat-bubble::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid var(--line-soft, rgba(0,123,255,0.6));
    clip-path: inherit;
    box-shadow: 
        0 0 0.5px var(--line-soft, rgba(0,123,255,0.6));
    z-index: -1;
    pointer-events: none;
}

.spark-chat-bubble:hover {
    transform: translateY(-3px) scale(1.1);
    
    /* 悬浮增强立体效果 */
    box-shadow: 
        inset 1px 1px 0 rgba(255, 255, 255, 0.2),
        inset -4px -3px 6px rgba(255, 255, 255, 0.4),
        inset 3px 4px 6px rgba(0, 0, 0, 0.15);
}

.spark-chat-bubble:hover::before {
    box-shadow: 
        0 0 8px var(--line-main, #007bff),
        0 0 15px var(--line-main, #007bff),
        0 0 25px var(--line-main, #007bff),
        inset 0 0 6px var(--line-main, #007bff);
    animation: hologram-pulse 1.5s ease-in-out infinite;
}

.spark-chat-bubble:hover::after {
    box-shadow: 
        0 0 5px var(--line-soft, rgba(0,123,255,0.6)),
        0 0 12px var(--line-soft, rgba(0,123,255,0.6)),
        0 0 20px var(--line-soft, rgba(0,123,255,0.6)),
        inset 0 0 3px var(--line-soft, rgba(0,123,255,0.6));
    animation: energy-pulse 1s ease-in-out infinite;
}

/* Ionicons图标样式 */
.spark-chat-bubble ion-icon {
    font-size: 28px;
    color: var(--line-main, #007bff);
    filter: drop-shadow(0 0 2px var(--line-soft, rgba(0,123,255,0.6)));
}

/* 响应式设计 */
@media (max-width: 768px) {
    .spark-container {
        width: 100%;
        right: 0;
    }
    
    .spark-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        line-height: 50px;
    }
    
    .message-content {
        max-width: 90%;
    }
}

/* 清除浮动 */
.spark-header::after {
    content: "";
    display: table;
    clear: both;
}

/* 正在思考中动画样式 */
.thinking-indicator {
    display: inline-block;
    max-width: 80%;
    padding: 10px 15px;
    background: var(--panel-hover, #f8f9fa);
    color: var(--text, #666);
    border: 1px solid var(--line-soft, #dee2e6);
    border-radius: 10px;
    font-style: italic;
    position: relative;
}

.thinking-dots {
    display: inline-block;
    animation: thinking 1.5s infinite;
}

@keyframes thinking {
    0%, 20% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.thinking-dots::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}