/* AI Chat Interface V2 - Light Mode Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* 移动端视口高度修复 */
:root {
    --vh: 1vh;
}

html, body {
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
}

#root {
    height: 100%;
    overflow: hidden;
}

/* 移动端安全区域支持 */
.pt-safe {
    padding-top: max(env(safe-area-inset-top), 0px);
}

.pb-safe {
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
}

/* 自定义滚动条样式 - 明亮模式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

*:focus {
    outline: none;
}

/* 隐藏水平滚动条 */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 打字机光标动画 */
.typing-cursor::after {
    content: '▋';
    animation: blink 1s step-start infinite;
    margin-left: 2px;
    vertical-align: baseline;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* 消息出现动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* 思考过程展开动画 */
@keyframes expandHeight {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}
.animate-expand {
    animation: expandHeight 0.4s ease-out forwards;
    overflow: hidden;
}

/* 移动端遮罩动画 */
.overlay-enter { opacity: 0; }
.overlay-enter-active { opacity: 1; transition: opacity 300ms; }
.overlay-exit { opacity: 1; }
.overlay-exit-active { opacity: 0; transition: opacity 300ms; }

/* 代码块样式 - 明亮模式 */
.code-block-wrapper {
    position: relative;
    margin: 12px 0;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #4a5568;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
}

.code-copy-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #2d3748;
}

.code-copy-btn:active {
    transform: scale(0.95);
}

.code-copy-btn.copied {
    background: rgba(16, 163, 127, 0.1);
    color: #10a37f;
    border-color: rgba(16, 163, 127, 0.3);
}

/* Markdown 内容样式 - 明亮模式 */
.message-content pre {
    background: #f7fafc !important;
    border-radius: 8px;
    padding: 16px;
    padding-top: 40px;
    margin: 12px 0;
    overflow-x: auto;
    position: relative;
    border: 1px solid #e2e8f0;
}

.message-content pre code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
    color: #2d3748;
    line-height: 1.5;
}

.message-content p {
    margin-bottom: 8px;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* 减小列表项间距 */
.message-content ul, .message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 2px 0;
    line-height: 1.5;
}

/* 减小标题间距 */
.message-content h1, .message-content h2, .message-content h3,
.message-content h4, .message-content h5, .message-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    line-height: 1.3;
    color: #1a202c;
}

.message-content h1:first-child, .message-content h2:first-child,
.message-content h3:first-child, .message-content h4:first-child {
    margin-top: 0;
}

.message-content a {
    color: #10a37f;
    text-decoration: underline;
}

.message-content a:hover {
    color: #0d8c6a;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.9em;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.message-content th {
    background: #f7fafc;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.message-content td, .message-content th {
    padding: 10px 14px;
    border-right: 1px solid #e2e8f0;
}

.message-content tr:last-child td {
    border-bottom: none;
}

/* 深度思考区块样式 - 明亮模式 */
.reasoning-section {
    margin: 0 0 12px 0;
}

.reasoning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4a5568;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.reasoning-toggle:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.reasoning-toggle::before {
    content: '💡';
}

.reasoning-toggle::after {
    content: '▾';
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.reasoning-toggle.expanded::after {
    transform: rotate(180deg);
}

.reasoning-content {
    padding: 12px;
    margin-top: 8px;
    color: #4a5568;
    font-size: 0.85rem;
    line-height: 1.6;
    font-style: italic;
    background: #f7fafc;
    border-left: 3px solid #cbd5e0;
    border-radius: 4px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.reasoning-content.expanded {
    max-height: 1000px;
    opacity: 1;
}

/* 打字指示器 - 明亮模式 */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* 会话列表样式 - 明亮模式 */
.conversation-item {
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: #f7fafc;
    border-color: #e2e8f0;
}

.conversation-item.active {
    background: rgba(16,163,127,0.1);
    border-color: rgba(16,163,127,0.3);
}

.conversation-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.conversation-item-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-item-actions {
    display: none;
    gap: 4px;
}

.conversation-item:hover .conversation-item-actions {
    display: flex;
}

.conversation-action-btn {
    padding: 4px 6px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #718096;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.conversation-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2d3748;
}

.conversation-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.7rem;
    color: #a0aec0;
}

.conversation-role {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    flex-shrink: 0;
}

.conversation-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 8px 6px;
    margin-top: 8px;
}

.conversation-group-title:first-child {
    margin-top: 0;
}

.conversation-loading,
.conversation-empty {
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 0.875rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .conversation-item-actions {
        display: flex;
    }
    
    .conversation-action-btn {
        padding: 6px 8px;
        font-size: 0.875rem;
    }
}
