/**
 * 思悟数学 - 智能助手甘雨主题
 * 灵感来源: 原神 - 甘雨
 * 主题色: 冰蓝色、淡蓝色、雪白色
 */

/* ==================== 甘雨主题变量 ==================== */
.ai-assistant-ganyu-theme {
    /* 主色调 */
    --ai-assistant-primary: #4A90E2;
    --ai-assistant-secondary: #7EC8E3;
    --ai-assistant-accent: #B8E6F5;

    /* 背景色 */
    --ai-assistant-bg: #F0F8FF;
    --ai-assistant-text: #2C3E50;
    --ai-assistant-border: #B8E6F5;
    --ai-assistant-shadow: rgba(74, 144, 226, 0.3);
    --ai-assistant-hover: #E6F4FF;

    /* 消息气泡 */
    --ai-assistant-user-bg: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    --ai-assistant-user-text: #ffffff;
    --ai-assistant-bot-bg: #F8FCFF;
    --ai-assistant-bot-text: #2C3E50;

    /* 发光效果 */
    --ai-assistant-glow: rgba(74, 144, 226, 0.6);
    --ai-assistant-glow-strong: rgba(74, 144, 226, 0.8);
}

/* ==================== 容器定位修正 ==================== */
.ai-assistant-container.ai-assistant-ganyu-theme {
    position: fixed;
}

/* ==================== 浮动按钮 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-float-button {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    box-shadow: 
        0 4px 12px rgba(74, 144, 226, 0.4),
        0 0 20px rgba(74, 144, 226, 0.3);
    animation: ganyuPulse 2s ease-in-out infinite;
}

@keyframes ganyuPulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(74, 144, 226, 0.4),
            0 0 20px rgba(74, 144, 226, 0.3);
    }
    50% {
        box-shadow: 
            0 6px 16px rgba(74, 144, 226, 0.6),
            0 0 30px rgba(74, 144, 226, 0.5);
    }
}

.ai-assistant-ganyu-theme .ai-assistant-float-button:hover {
    transform: scale(1.15);
    box-shadow: 
        0 8px 20px rgba(74, 144, 226, 0.6),
        0 0 40px rgba(74, 144, 226, 0.6);
}

/* ==================== 主容器 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-container {
    background: linear-gradient(135deg, #F0F8FF 0%, #E6F4FF 100%);
    border: 2px solid #B8E6F5;
    box-shadow: 
        0 8px 32px rgba(74, 144, 226, 0.3),
        0 0 60px rgba(74, 144, 226, 0.2);
    position: relative;
    overflow: hidden;
}

/* 兜底：当主题类直接挂在容器上时也应用甘雨色系（避免被其他作用域覆盖） */
.ai-assistant-container.ai-assistant-ganyu-theme {
    --ai-assistant-primary: #4A90E2;
    --ai-assistant-secondary: #7EC8E3;
    background: linear-gradient(135deg, #F0F8FF 0%, #E6F4FF 100%);
    border: 2px solid #B8E6F5;
}

.ai-assistant-container.ai-assistant-ganyu-theme .ai-assistant-header {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
}

/* 甘雨主题背景图 */
/* 甘雨主题背景图 */
@media (min-width: 769px) {
    .ai-assistant-ganyu-theme .ai-assistant-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, var(--ai-assistant-primary) 0%, var(--ai-assistant-secondary) 100%);
        opacity: 0.2;
        z-index: 1;
        pointer-events: none;
    }
}

/* 雪花粒子容器 */
.ai-assistant-ganyu-theme .ai-assistant-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/ganyu/冰雪装饰元素.png');
    background-size: 200px;
    opacity: 0.05;
    z-index: 0;
    pointer-events: none;
    animation: snowfall 20s linear infinite;
}

@keyframes snowfall {
    0% { background-position: 0 0; }
    100% { background-position: 0 200px; }
}

/* ==================== 甘雨立绘面板 ==================== */
/* 立绘包装器 - 使用fixed定位,附着在智能助手右侧 */
.ai-assistant-ganyu-theme .ganyu-illustration-wrapper {
    position: fixed;
    right: calc(30px - 260px);
    bottom: 100px;
    width: 250px;
    height: 600px;
    /* 保持显示但默认允许点击穿透，移动端再降层级 */
    pointer-events: none;
    z-index: 9997;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 769px) {
    .ganyu-illustration-wrapper.ai-assistant-ganyu-theme {
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
    }
    .ai-assistant-container.fullscreen ~ .ganyu-illustration-wrapper {
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
    }
}

/* 智能助手最小化时隐藏立绘 */
.ai-assistant-container.minimized ~ .ganyu-illustration-wrapper {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50px);  /* 向左滑出 */
}

/* 全屏模式下调整立绘位置 */
@media (max-width: 768px) {
    .ai-assistant-container.fullscreen ~ .ganyu-illustration-wrapper {
        right: calc(50% - 450px - 260px);
        bottom: 50%;
        transform: translateY(50%);
    }

    /* 移动端：立绘层彻底不拦截点击且降层级，避免遮挡顶部按钮 */
    .ganyu-illustration-wrapper,
    .ganyu-illustration-panel,
    .ganyu-character-illustration {
        pointer-events: none !important;
        z-index: 0 !important;
    }
}

/* 立绘面板 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel {
    position: absolute;
    left: 0;  /* 左对齐 */
    top: 50%;
    transform: translateY(-50%);
    width: 250px;  /* 与包装器宽度一致 */
    height: 550px;  /* 稍微小一点,留出上下边距 */
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.08) 0%, rgba(184, 230, 245, 0.08) 100%);
    border-radius: 20px;  /* 四周圆角 */
    border: 2px solid rgba(74, 144, 226, 0.25);
    box-shadow:
        0 10px 40px rgba(74, 144, 226, 0.2),
        inset 0 0 60px rgba(184, 230, 245, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;  /* 允许立绘超出边界 */
    pointer-events: all;  /* 面板本身可以交互 */
}

.ai-assistant-ganyu-theme .ganyu-illustration-panel:hover {
    border-color: rgba(74, 144, 226, 0.4);
    box-shadow:
        0 12px 48px rgba(74, 144, 226, 0.3),
        inset 0 0 80px rgba(184, 230, 245, 0.1);
}

/* 收起状态 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel.collapsed {
    width: 60px;
    background: rgba(74, 144, 226, 0.05);
}

/* 立绘图片 */
.ai-assistant-ganyu-theme .ganyu-character-illustration {
    width: auto;
    height: 100%;
    max-height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: center center;
    opacity: 1;
    animation: characterFloat 4s ease-in-out infinite, characterGlow 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(74, 144, 226, 0.4));
    transition: all 0.3s ease;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

/* 收起时隐藏立绘 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel.collapsed .ganyu-character-illustration {
    opacity: 0;
    transform: scale(0.5);
}

/* 切换按钮 */
.ai-assistant-ganyu-theme .ganyu-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #4A90E2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 10;
}

.ai-assistant-ganyu-theme .ganyu-toggle-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* 收起时按钮位置调整 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel.collapsed .ganyu-toggle-btn {
    right: 8px;
}

/* 角色立绘浮动动画 */
@keyframes characterFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* 角色立绘发光动画 */
@keyframes characterGlow {
    0%, 100% {
        filter: drop-shadow(0 10px 30px rgba(74, 144, 226, 0.6)) brightness(1);
    }
    50% {
        filter: drop-shadow(0 15px 40px rgba(126, 200, 227, 0.8)) brightness(1.1);
    }
}

/* 装饰元素 - 雪花粒子 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel::before {
    content: '❄️';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    animation: snowflakeFloat 3s ease-in-out infinite;
    opacity: 0.8;
}

.ai-assistant-ganyu-theme .ganyu-illustration-panel::after {
    content: '❄️';
    position: absolute;
    bottom: 30px;
    right: 20px;
    font-size: 28px;
    animation: snowflakeFloat 3.5s ease-in-out infinite 0.5s;
    opacity: 0.8;
}

@keyframes snowflakeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) rotate(180deg);
        opacity: 1;
    }
}

/* 收起时隐藏装饰 */
.ai-assistant-ganyu-theme .ganyu-illustration-panel.collapsed::before,
.ai-assistant-ganyu-theme .ganyu-illustration-panel.collapsed::after {
    opacity: 0;
}

/* 响应式 - 移动端自动隐藏 */
@media (max-width: 768px) {
    .ai-assistant-ganyu-theme .ganyu-illustration-panel {
        display: none;
    }
}

/* ==================== 头部标题 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-header {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    border-bottom: 2px solid rgba(74, 144, 226, 0.3);
}

.ai-assistant-ganyu-theme .ai-assistant-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==================== 消息气泡 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-message.user .ai-assistant-message-bubble {
    background: var(--ai-assistant-user-bg);
    color: var(--ai-assistant-user-text);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.ai-assistant-ganyu-theme .ai-assistant-message.assistant .ai-assistant-message-bubble {
    background: var(--ai-assistant-bot-bg);
    color: var(--ai-assistant-bot-text);
    border: 1px solid #B8E6F5;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

/* ==================== 输入框 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-input-wrapper {
    border-top: 2px solid #B8E6F5;
    background: rgba(240, 248, 255, 0.8);
}

.ai-assistant-ganyu-theme .ai-assistant-input {
    background: #ffffff;
    border: 2px solid #B8E6F5;
    color: var(--ai-assistant-text);
}

.ai-assistant-ganyu-theme .ai-assistant-input:focus {
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.ai-assistant-ganyu-theme .ai-assistant-send-btn {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    color: white;
}

.ai-assistant-ganyu-theme .ai-assistant-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5AA0F2 0%, #8ED8F3 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* ==================== 按钮 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== 设置面板 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-settings {
    background: linear-gradient(135deg, #F0F8FF 0%, #E6F4FF 100%);
}

.ai-assistant-ganyu-theme .ai-assistant-personality-option.active {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    color: white;
    border-color: #4A90E2;
}

.ai-assistant-ganyu-theme .ai-assistant-personality-option:hover {
    border-color: #4A90E2;
    background: rgba(74, 144, 226, 0.1);
}

/* ==================== 快速主题按钮 - 甘雨主题 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-theme-btn.active {
    background: linear-gradient(135deg, #4A90E2 0%, #7EC8E3 100%);
    color: white;
    border-color: #4A90E2;
}

/* ==================== 表情包样式 ==================== */
.ai-assistant-ganyu-theme .ai-assistant-message-emoji {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-left: 8px;
    filter: drop-shadow(0 2px 4px rgba(74, 144, 226, 0.3));
}
