/* Frontend CSS - AI Navigation */

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

.dark ::-webkit-scrollbar-thumb {
    background: #323b67;
    border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #4a5589;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Hide scrollbar for no-scrollbar class */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Details/Summary Styles */
details > summary {
    list-style: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

/* Timeline Line */
.timeline-line {
    background: linear-gradient(to bottom, transparent, #323b67 10%, #323b67 90%, transparent);
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(19, 55, 236, 0.15);
}

/* Prose Styles for Markdown Content */
.prose {
    color: inherit;
    max-width: 65ch;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: inherit;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.prose p {
    margin-top: 1em;
    margin-bottom: 1em;
}

.prose a {
    color: #1337ec;
    text-decoration: underline;
}

.prose a:hover {
    color: #0f2bc4;
}

.prose ul, .prose ol {
    margin-top: 1em;
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.dark .prose code {
    background-color: rgba(255, 255, 255, 0.1);
}

.prose pre {
    background-color: #1a1d24;
    color: #e5e7eb;
    padding: 1em;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-top: 1em;
    margin-bottom: 1em;
}

.prose pre code {
    background-color: transparent;
    padding: 0;
}

.prose blockquote {
    border-left: 4px solid #1337ec;
    padding-left: 1em;
    margin-left: 0;
    font-style: italic;
    color: #6b7280;
}

.dark .prose blockquote {
    color: #929bc9;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    margin-bottom: 1em;
}

.prose th, .prose td {
    border: 1px solid #e2e8f0;
    padding: 0.5em 1em;
    text-align: left;
}

.dark .prose th, .dark .prose td {
    border-color: #232948;
}

.prose th {
    background-color: #f6f6f8;
    font-weight: 600;
}

.dark .prose th {
    background-color: #191e33;
}

/* Animation for loading spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Focus styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #1337ec;
    outline-offset: 2px;
}

/* Transition utilities */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* Line clamp utilities */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* Mobile sidebar animation */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

#sidebar.open {
    transform: translateX(0) !important;
}

/* Backdrop blur support */
@supports (backdrop-filter: blur(8px)) {
    .backdrop-blur-sm {
        backdrop-filter: blur(8px);
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}
/* 防闪烁和跳动优化 */

/* 防止图标和按钮闪烁 */
button, .btn, a {
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* 侧边栏链接优化 */
#sidebar .sidebar-nav a {
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    will-change: background-color, color;
}

/* 防止布局跳动 */
.sidebar-nav {
    contain: layout style;
}

/* 图标容器固定尺寸 */
.icon-container {
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 按钮状态优化 */
button:focus,
button:active,
.btn:focus,
.btn:active {
    outline: none;
    transform: translateZ(0) scale(0.98);
}

/* 防止主题切换时的闪烁 */
html.dark,
html:not(.dark) {
    transition: none !important;
}

html.dark *,
html:not(.dark) * {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* 页面加载时防止闪烁 */
.page-loading * {
    transition: none !important;
}

/* 优化滚动性能 */
.scroll-container {
    contain: layout style paint;
    will-change: scroll-position;
}

/* 防止重排 */
.prevent-reflow {
    contain: layout;
}