/* 谷歌风格的颜色变量 */
:root {
    --primary-color: #4285f4;  /* 谷歌蓝 */
    --secondary-color: #34a853; /* 谷歌绿 */
    --accent-color:   #91bbff;    /* 谷歌红 */
    --yellow-color: #fbbc05;    /* 谷歌黄 */
    --background-color: #f8f9fa;
    --card-color: #ffffff;
    --text-color: #202124;
    --secondary-text: #5f6368;
    --border-color: #dadce0;
    --shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--card-color);
    padding: 16px 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo .material-icons {
    color: var(--primary-color);
    font-size: 28px;
    margin-right: 12px;
}

.logo h1 {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-color);
}

.search-container {
    flex-grow: 1;
    max-width: 720px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--background-color);
    border-radius: 24px;
    padding: 8px 16px;
    width: 100%;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s, background-color 0.2s;
}

.search-bar:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

.search-bar:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    background-color: var(--card-color);
    border-color: rgba(223, 225, 229, 0);
}

.search-bar .material-icons {
    color: var(--secondary-text);
    margin-right: 12px;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    width: 100%;
    color: var(--text-color);
}

main {
    display: flex;
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
    gap: 24px;
}

.sidebar {
    width: 1000px;
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    height: calc(100vh - 140px);
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-color);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

#table-of-contents {
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
    max-height: calc(100vh - 200px);
}

#table-of-contents::-webkit-scrollbar {
    width: 6px;
}

#table-of-contents::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

#table-of-contents::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

#table-of-contents::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.toc-item {
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    word-break: break-word;
    line-height: 1.4;
    min-height: 44px;
    max-height: 60px;
}

.toc-item:hover {
    background: var(--accent-color);
    transform: translateX(4px);
}

.toc-item.active {
    background: var(--accent-color);
    color: var(--text-primary);
    font-weight: 500;
}

.toc-item .toc-date {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.toc-item .toc-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.content {
    flex-grow: 1;
}

.article {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.article-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-color);
}

.article-meta {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    color: var(--secondary-text);
    font-size: 14px;
}

.article-date {
    display: flex;
    align-items: center;
}

.article-date .material-icons {
    font-size: 16px;
    margin-right: 4px;
}

.article-content {
    color: var(--text-color);
    line-height: 1.8;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content img {
    max-width: 100%;
    border-radius: 4px;
    margin: 16px 0;
}

footer {
    text-align: center;
    padding: 24px;
    color: var(--secondary-text);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 24px;
        height: auto;
        max-height: 400px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--border-color) transparent;
    }

    /* 为移动端目录添加滚动条样式 */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background-color: var(--border-color);
        border-radius: 3px;
    }

    .sidebar::-webkit-scrollbar-thumb:hover {
        background-color: var(--secondary-text);
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-container {
        width: 100%;
        margin-top: 16px;
    }

    .toc-item {
        padding: 10px 12px;
        margin: 3px 0;
        min-height: 40px;
        max-height: 56px;
    }
    
    .toc-item .toc-date {
        font-size: 0.8em;
    }
    
    #table-of-contents {
        padding: 12px;
        max-height: calc(100vh - 160px);
    }
}

/* 在适当位置添加以下样式 */
.article.highlighted {
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 10px rgba(66, 133, 244, 0.3);
    background-color: rgba(66, 133, 244, 0.03);
}

/* 在文件末尾添加以下样式 */

/* 谷歌风格链接 */
.google-style-link {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
    font-weight: 500;
    margin: 8px 0;
    word-break: break-all;
}

.google-style-link:hover {
    color: #1a73e8;
    text-decoration: underline;
}

.google-style-link .link-icon {
    font-size: 16px;
    margin-left: 4px;
}