/* 科技感主题样式 */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --neon-blue: #00f3ff;
    --neon-purple: #b967ff;
    --dark-bg: #0a0a1a;
    --darker-bg: #050510;
    --card-bg: rgba(16, 18, 37, 0.85); /* 增加透明度增强毛玻璃效果 */
    --glass-bg: rgba(255, 255, 255, 0.08); /* 增加透明度 */
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, sans-serif;
    background-color: var(--dark-bg);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 增强科技感背景动画 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 25%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.25) 0%, transparent 25%),
        linear-gradient(45deg, rgba(102, 126, 234, 0.1), rgba(185, 103, 255, 0.1));
    animation: pulse 8s ease-in-out infinite;
    z-index: -1;
    backdrop-filter: blur(5px); /* 添加背景模糊增强毛玻璃效果 */
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.chat-container {
    width: 95%;
    max-width: 800px;
    background: var(--card-bg);
    backdrop-filter: blur(30px) saturate(200%); /* 增加模糊度 */
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.15); /* 更细的边框 */
    border-radius: 24px;
    padding: 30px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 40px rgba(103, 119, 234, 0.4);
    display: flex;
    flex-direction: column;
    height: 90vh;
    margin: 20px;
    position: relative;
    overflow: hidden;
}

/* 科技感边框光效 */
.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), var(--neon-purple), transparent);
    animation: borderGlow 3s ease-in-out infinite;
    filter: blur(1px); /* 添加轻微模糊使光效更柔和 */
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* 头部标题样式 - 苹果风格白色发光效果（缩小光晕） */
.chat-header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.chat-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 
        0 0 3px rgba(255, 255, 255, 0.8),
        0 0 6px rgba(255, 255, 255, 0.6),
        0 0 9px rgba(255, 255, 255, 0.4); /* 缩小光晕范围 */
    letter-spacing: -0.02em;
    animation: subtleGlow 3s ease-in-out infinite alternate;
    position: relative;
    display: inline-block;
    padding: 0 20px;
}

.chat-header p {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0.9;
    text-shadow: 
        0 0 2px rgba(255, 255, 255, 0.7),
        0 0 4px rgba(255, 255, 255, 0.5); /* 缩小光晕范围 */
    letter-spacing: 0.01em;
    animation: subtlePulse 4s ease-in-out infinite alternate;
    margin-top: 5px;
}

/* 微妙的发光动画 */
@keyframes subtleGlow {
    0% {
        text-shadow: 
            0 0 3px rgba(255, 255, 255, 0.8),
            0 0 6px rgba(255, 255, 255, 0.6),
            0 0 9px rgba(255, 255, 255, 0.4);
    }
    100% {
        text-shadow: 
            0 0 4px rgba(255, 255, 255, 0.9),
            0 0 8px rgba(255, 255, 255, 0.7),
            0 0 12px rgba(255, 255, 255, 0.5);
    }
}

@keyframes subtlePulse {
    0% {
        opacity: 0.85;
        text-shadow: 
            0 0 2px rgba(255, 255, 255, 0.7),
            0 0 4px rgba(255, 255, 255, 0.5);
    }
    100% {
        opacity: 1;
        text-shadow: 
            0 0 3px rgba(255, 255, 255, 0.8),
            0 0 6px rgba(255, 255, 255, 0.6);
    }
}

/* 添加一个微妙的背景光晕效果 */
.chat-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 150%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.04) 30%,
        transparent 70%
    );
    z-index: -1;
    pointer-events: none;
    backdrop-filter: blur(10px); /* 添加毛玻璃效果 */
}

.messages {
    flex: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px); /* 增加模糊度 */
    -webkit-backdrop-filter: blur(15px);
    font-size: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(103, 119, 234, 0.5) transparent;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(103, 119, 234, 0.5);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: rgba(103, 119, 234, 0.7);
}

.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    animation: messageSlideIn 0.4s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
 }
}

.message img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid transparent;
    background: var(--primary-gradient);
    padding: 2px;
}

.message.user img {
    border-color: var(--neon-blue);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
}

.message.bot img {
    border-color: var(--neon-purple);
    box-shadow: 0 0 12px rgba(185, 103, 255, 0.5);
}

.message-content {
    padding: 18px 20px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.07); /* 增加透明度 */
    backdrop-filter: blur(12px); /* 增加模糊度 */
    -webkit-backdrop-filter: blur(12px);
}

.message.user {
    flex-direction: row-reverse;
}

.message.user img {
    margin-left: 15px;
    margin-right: 0;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.85), rgba(118, 75, 162, 0.85));
    color: white;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.message.bot .message-content {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.input-container input {
    flex: 1;
    min-width: 0;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-container input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.input-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.input-container button {
    padding: 16px 24px;
    min-width: 80px;
    white-space: nowrap;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.input-container button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.input-container button:hover::before {
    left: 100%;
}

.input-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

/* 下拉菜单科技感样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--card-bg);
    backdrop-filter: blur(25px); /* 增加模糊度 */
    -webkit-backdrop-filter: blur(25px);
    min-width: 180px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1000;
    margin-bottom: 10px;
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
    animation: dropdownSlide 0.3s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 加载动画科技感样式 */
.loading {
    text-align: center;
    font-size: 16px;
    color: var(--neon-blue);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid var(--neon-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 增强电脑端显示效果 */
@media (min-width: 769px) {
    body {
        background-image: 
            radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 40%),
            radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.25) 0%, transparent 40%),
            linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    }
    
    body::before {
        opacity: 0.7;
    }
    
    .chat-container {
        box-shadow: 
            0 35px 70px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 0 60px rgba(103, 119, 234, 0.5),
            0 0 100px rgba(185, 103, 255, 0.3);
    }
    
    .chat-container::before {
        background: linear-gradient(90deg, 
            transparent, 
            var(--neon-blue), 
            var(--neon-purple), 
            transparent);
        animation: borderGlow 2s ease-in-out infinite;
    }
    
    /* 增强电脑端标题效果 */
    .chat-header h1 {
        font-size: 3em;
        font-weight: 600;
    }
    
    .chat-header p {
        font-size: 1.2em;
        font-weight: 300;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        height: 95vh;
        margin: 10px;
        padding: 20px;
        border-radius: 20px;
    }

    .messages {
        padding: 20px;
        font-size: 15px;
    }

    .message-content {
        max-width: 85%;
        font-size: 14px;
    }

    .input-container {
        gap: 10px;
    }

    .input-container input {
        padding: 14px 18px;
        font-size: 15px;
    }

    .input-container button {
        padding: 14px 20px;
        font-size: 14px;
    }

    .message img {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 15px;
    }

    .messages {
        padding: 15px;
    }

    .message-content {
        max-width: 90%;
        padding: 15px;
    }

    .input-container {
        flex-direction: column;
        gap: 10px;
    }

    .input-container input {
        width: 100%;
    }

    .dropdown {
        align-self: flex-end;
    }
}

/* 深色模式优化 */
body.dark-mode {
    background: var(--dark-bg);
}

.dark-mode .chat-container {
    background: var(--card-bg);
}

.dark-mode .messages {
    background: rgba(0, 0, 0, 0.3);
}

/* 消息内容样式优化 */
.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content .bold-text {
    font-weight: 700;
    color: var(--neon-blue);
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.message-content .section-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 20px 0 12px 0;
    color: var(--neon-purple);
}

.message-content .subsection {
    margin: 12px 0 12px 25px;
    position: relative;
}

.message-content .subsection::before {
    content: '⟡';
    position: absolute;
    left: -20px;
    color: var(--neon-blue);
}

.message-content .subtitle {
    font-weight: 600;
    color: var(--neon-purple);
}