/**
 * AI助手Sidebar样式
 */

/* 切换按钮 - 固定在右侧 */
.ai-assistant-toggle {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ls-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0.9;
}

.ai-assistant-toggle:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-assistant-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* 当sidebar打开时，切换按钮向右移动 */
.ai-assistant-sidebar.open ~ .ai-assistant-toggle,
body.ai-assistant-open .ai-assistant-toggle {
    right: 400px;
}

/* Sidebar容器 */
.ai-assistant-sidebar {
    position: fixed;
    top: 0;
    right: -420px; /* 默认隐藏，宽度400px + 20px边距 */
    width: 400px;
    height: 100vh;
    background: var(--ls-bg-primary);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-assistant-sidebar.open {
    right: 0;
}

/* 遮罩层 */
.ai-assistant-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.ai-assistant-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 当sidebar打开时，遮罩层显示 */
.ai-assistant-sidebar.open ~ .ai-assistant-overlay,
body.ai-assistant-open .ai-assistant-overlay {
    opacity: 1;
    visibility: visible;
}

/* 调整AI助手内部样式以适应sidebar */
.ai-assistant-sidebar .ai-assistant {
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
}

.ai-assistant-sidebar .ai-assistant-header {
    border-radius: 0;
    padding: 20px;
    flex-shrink: 0;
}

.ai-assistant-sidebar .ai-assistant-header h4 {
    font-size: 1.2rem;
}

/* 添加关闭按钮 */
.ai-assistant-sidebar .ai-assistant-header {
    position: relative;
}

.ai-assistant-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ls-bg-secondary);
    border: 1px solid var(--ls-border-color);
    color: var(--ls-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.ai-assistant-close-btn:hover {
    background: var(--ls-danger);
    border-color: var(--ls-danger);
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-assistant-sidebar {
        width: 100%;
        right: -100%;
    }

    .ai-assistant-sidebar.open {
        right: 0;
    }

    .ai-assistant-toggle {
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .ai-assistant-sidebar.open ~ .ai-assistant-toggle,
    body.ai-assistant-open .ai-assistant-toggle {
        right: 100%;
    }
}

@media (max-width: 480px) {
    .ai-assistant-toggle {
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

