/* 灵凝AI页面样式 */
.lingning-container {
    display: flex;
    min-height: calc(100vh - 140px); /* 使用min-height而非height，允许内容自适应 */
    max-height: calc(100vh - 140px); /* 限制最大高度避免超出 */
    background: #f5f5f5;
    margin: 5px 15px 10px 15px; /* 底部增加5px边距 */
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8e8e8; /* 更浅的灰色轮廓 */
}

/* 侧边栏样式 */
.lingning-sidebar {
    width: 280px; /* 减少20px */
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background: #0051D5;
}

.new-chat-icon {
    width: 16px;
    height: 16px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-history-item {
    position: relative;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 8px; /* 左侧留出距离 */
    margin-right: 8px; /* 右侧留出距离 */
}

/* 笔直的分隔线 */
.chat-history-item::after {
    content: '';
    position: absolute;
    left: 12px;  /* 左侧留出距离 */
    right: 12px; /* 右侧留出距离 */
    bottom: 0;
    height: 1px;
    background: #e8e8e8;
}

.chat-history-item:hover {
    background: #f0f0f0;
}

.chat-history-item.active {
    background: #E8E8E8;
}

.chat-history-content {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-delete-btn {
    display: block;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-delete-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.delete-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
}

.delete-menu.show {
    display: block;
}

.delete-option {
    padding: 8px 16px;
    font-size: 14px;
    color: #ff4757;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-option:hover {
    background: #fff5f5;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.user-points {
    font-size: 12px;
    color: #666;
}

/* 主聊天区域 */
.lingning-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    min-height: 0; /* 关键：允许flex收缩 */
}

.chat-container {
    flex: 1 1 auto; /* 允许收缩和增长 */
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许flex子项正确收缩 */
}

/* 欢迎界面 */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1; /* 使用flex而非height:100%，更灵活 */
    min-height: 400px; /* 设置最小高度确保居中 */
    text-align: center;
}

.welcome-content {
    max-width: 500px;
}

.welcome-icon {
    margin-bottom: 20px;
}

.ai-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.welcome-content h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 16px;
}

.welcome-content p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feature-item span {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.cost-info {
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.cost-info p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* 聊天消息区域 */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    margin-bottom: 16px;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message.user .message-content {
    background: #007AFF;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #333;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.message.user .message-time {
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

/* 消息文本样式 */
.message-text {
    word-wrap: break-word;
    line-height: 1.6;
}

/* AI消息中的链接样式 */
.message.assistant .message-text a {
    color: #007AFF;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 122, 255, 0.3);
    transition: all 0.2s;
}

.message.assistant .message-text a:hover {
    border-bottom-color: #007AFF;
    background: rgba(0, 122, 255, 0.05);
    padding: 0 2px;
}

/* 用户消息中的链接（白色） */
.message.user .message-text a {
    color: white;
    text-decoration: underline;
}

/* 代码样式 */
.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.message.user .message-text code {
    background: rgba(255, 255, 255, 0.2);
}

/* 粗体 */
.message-text strong {
    font-weight: 600;
}

/* 斜体 */
.message-text em {
    font-style: italic;
}

/* 加载动画 */
.loading-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: loading 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 输入区域 - 真正的高斯模糊背景 */
.chat-input-container {
    background: rgba(255, 255, 255, 0.3); /* 降低不透明度，显示后面内容 */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    flex-shrink: 0; /* 关键：不允许收缩，始终可见 */
}

/* AI功能按钮区域 */
.ai-features-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px; /* 进一步减少间距 */
    flex-wrap: wrap;
}

.feature-group {
    position: relative;
}

.feature-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.feature-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: scale(1.02);
}

.feature-btn:active {
    transform: scale(0.96);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-btn[data-active="true"] {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

/* 网络搜索按钮激活状态 - 与推理强度按钮一致 */
#webSearchBtn[data-active="true"] {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

.feature-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.feature-btn span {
    font-weight: 500;
}

/* 推理强度下拉菜单 - iOS风格向上弹出 */
.reasoning-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #ffffff; /* 纯白色背景 */
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 140px;
    opacity: 0;
    /* iOS风格丝滑动画：从下往上弹出 + 缩放 + 模糊 */
    transform: translateY(12px) scale(0.92);
    filter: blur(4px);
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.reasoning-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
    pointer-events: auto;
}

.reasoning-option {
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: transparent;
}

.reasoning-option:hover {
    background: #f5f5f5;
}

.reasoning-option:active {
    background: #ebebeb;
    transform: scale(0.98);
}

.reasoning-option.selected {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    font-weight: 600;
}

.reasoning-option:first-child {
    border-radius: 12px 12px 0 0;
}

.reasoning-option:last-child {
    border-radius: 0 0 12px 12px;
}

.chat-input-wrapper {
    width: auto;
    margin: 0 20px; /* 左右20px间距 */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 4px 16px;
    transition: border-color 0.2s;
    min-height: 25px;
}

.chat-input-box:focus-within {
    border-color: #007AFF;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.15);
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    max-height: 100px;
    min-height: 17px;
    padding: 0;
    font-family: inherit;
    margin-bottom: 0;
    /* 隐藏滚动条但保留功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#chatInput::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

#chatInput::placeholder {
    color: #999;
    font-size: 16px;
}

.send-btn {
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 0;
}

.send-btn:hover:not(:disabled) {
    background: #0051D5;
}

.send-btn:disabled {
    background: #f0f0f0;
    color: #ccc;
    cursor: not-allowed;
}

.send-icon {
    width: 20px;
    height: 20px;
    transition: color 0.2s;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px; /* 进一步减少间距 */
    font-size: 12px;
    color: #666;
}

.char-count {
    color: #999;
}

.cost-reminder {
    color: #333;
}

/* 积分不足模态框 */
.insufficient-points-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.insufficient-points-modal.show {
    display: flex;
}

.insufficient-points-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
}

.insufficient-points-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.insufficient-points-content h2 {
    margin-bottom: 16px;
    color: #333;
}

.insufficient-points-content p {
    margin-bottom: 12px;
    color: #666;
}

.insufficient-points-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
    transition: background-color 0.2s;
}

.insufficient-points-btn:hover {
    background: #0051D5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .lingning-container {
        margin: 5px 10px 10px 10px;
        min-height: calc(100vh - 160px); /* 增加15px空间 */
        max-height: calc(100vh - 160px);
    }
    
    .lingning-sidebar {
        width: 250px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    #chatInput {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .lingning-container {
        flex-direction: column;
        margin: 5px 5px 10px 5px;
        min-height: calc(100vh - 165px); /* 增加15px空间 */
        max-height: calc(100vh - 165px);
    }
    
    .welcome-screen {
        min-height: 300px; /* 小屏幕上减少最小高度 */
    }
    
    .lingning-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .chat-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .chat-input-box {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    #chatInput {
        font-size: 16px;
        min-height: 20px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
}

.gradient-avatar-frame {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px auto;
    /* 呼吸效果的彩色阴影 - Tron红色系 */
    animation: breathing-shadow 4s ease-in-out infinite;
}

@keyframes breathing-shadow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 82, 82, 0.5),
                    0 0 40px rgba(255, 82, 82, 0.3);
    }
    25% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.5),
                    0 0 40px rgba(255, 107, 53, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 138, 101, 0.5),
                    0 0 40px rgba(255, 138, 101, 0.3);
    }
    75% {
        box-shadow: 0 0 20px rgba(252, 92, 125, 0.5),
                    0 0 40px rgba(252, 92, 125, 0.3);
    }
}

.gradient-avatar-frame::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(45deg, #ff5252, #ff6b35, #ff8a65, #fc5c7d);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: gradient-rotate 8s linear infinite;
}

.gradient-avatar-frame .ai-icon {
    position: relative;
    z-index: 2;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: block;
}

/* 移除内白圈 */
.gradient-avatar-frame::after {
    display: none;
}

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