/* ==================== CSS 变量 ==================== */
:root {
    --primary-color: #4a90a4;
    --primary-hover: #3d7a8c;
    --text-color: #333;
    --text-light: #333;
    --border-color: #ddd;
    --bg-light: #e8f4f8;
    --bg-white: #fff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
    --border-radius: 6px;
}

/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
}

a {
    color: #1a73e8;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==================== 头部样式 ==================== */
.header {
    background: linear-gradient(135deg, #5a5a5a 0%, #4a4a4a 100%);
    color: var(--bg-white);
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bg-white);
    font-weight: bold;
    font-size: 20px;
}

.logo:hover {
    color: var(--bg-white);
    opacity: 0.9;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-white);
    color: #1a73e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

.slogan {
    font-size: 12px;
    opacity: 0.9;
    flex: 1;
    text-align: center;
}

.site-update {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 2px solid var(--bg-white);
    color: var(--bg-white);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--bg-white);
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--bg-white);
    left: 0;
}

.hamburger::before {
    top: -6px;
}

.hamburger::after {
    bottom: -6px;
}

/* ==================== 主容器布局 ==================== */
.main-container {
    display: flex;
    gap: 30px;
    padding-top: 30px;
    padding-bottom: 30px;
}

/* ==================== 侧边栏样式 ==================== */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ccc;
}

.sidebar-header h2 {
    font-size: 18px;
    color: #555;
}

.close-sidebar {
    display: none;
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.category-nav {
    width: 100%;
}

.category-list > li {
    margin-bottom: 5px;
}

.category-list > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
}

.category-list > li.has-sub > a {
    position: relative;
}

.category-list > li.has-sub > a::after {
    content: '+';
    font-size: 16px;
    color: var(--text-light);
    transition: var(--transition);
}

.category-list > li.has-sub.active > a::after {
    content: '-';
}

.category-list > li.has-sub > a:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.category-list > li > a:not(.category-toggle) {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-list > li > a:not(.category-toggle):hover {
    background: #e0e0e0;
    text-decoration: none;
}

.category-list > li.active > a {
    background: #e0e0e0;
    color: var(--text-color);
    text-decoration: none;
}

.sub-category {
    display: none;
    padding: 10px 0 10px 20px;
}

.category-list > li.active .sub-category {
    display: block;
}

.sub-category li {
    margin-bottom: 3px;
}

.sub-category a {
    display: block;
    padding: 6px 12px;
    color: var(--text-light);
    font-size: 13px;
    border-radius: 4px;
    transition: var(--transition);
}

.sub-category a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    text-decoration: none;
}

.hot-sites {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.hot-sites h3 {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 500;
}

.hot-site-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hot-site-list li {
    margin-bottom: 6px;
}

.hot-site-list a {
    display: block;
    padding: 5px 8px;
    color: var(--text-light);
    font-size: 13px;
    border-radius: 4px;
    transition: var(--transition);
}

.hot-site-list a:hover {
    background: var(--bg-light);
    color: var(--text-color);
    text-decoration: none;
}

/* ==================== 主内容区样式 ==================== */
.content {
    flex: 1;
    min-width: 0;
}

.breadcrumb {
    background: var(--bg-white);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 13px;
    box-shadow: var(--shadow);
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--text-color);
}

.breadcrumb .separator {
    margin: 0 8px;
    color: var(--border-color);
}

.breadcrumb .current {
    color: var(--text-color);
}

/* ==================== 列表统计栏 ==================== */
.site-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.stats-text {
    font-size: 14px;
    color: var(--text-light);
}

.stats-text strong {
    color: var(--primary-color);
    font-weight: bold;
}

.tab-search {
    display: flex;
    align-items: center;
}

.search-input {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    outline: none;
    width: 180px;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 4px 4px 0;
    background: var(--bg-white);
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--bg-light);
}

/* ==================== 网站列表 ==================== */
.site-list {
    padding: 0;
}

.site-item {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

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

.site-item:hover {
    background: var(--bg-light);
}

.site-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.site-title {
    font-size: 14px;
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-title:hover {
    color: var(--primary-color);
}

.recommend-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    background: #27ae60;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 8px;
}

.intro-toggle {
    padding: 4px 6px;
    font-size: 12px;
    color: #333;
    background: transparent;
    border: 1px solid #333;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.intro-toggle:hover {
    background: #333;
    color: white;
}

.intro-toggle.active {
    background: #333;
    color: white;
}

.intro-toggle::before {
    content: '▼';
    font-size: 10px;
}

.intro-toggle.active::before {
    content: '▲';
}

.site-intro-text {
    display: none;
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.6;
    padding: 12px 0;
    border-top: 1px dashed var(--border-color);
    margin-top: 10px;
}

.site-intro-text.show {
    display: block;
}

.site-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.site-category {
    color: #999;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-category::before {
    content: '📁';
    font-size: 11px;
}

.site-category:hover {
    text-decoration: underline;
}

.site-date {
    color: #999;
}

/* ==================== 底部样式 ==================== */
.footer {
    background: var(--bg-white);
    padding: 15px 0;
    margin-top: 30px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-light);
    flex-wrap: wrap;
    gap: 10px;
}

.footer-left {
    text-align: left;
}

.footer-right {
    text-align: right;
}

.footer-left a {
    color: var(--text-light);
    text-decoration: underline;
}

.footer-right a:hover {
    color: var(--text-color);
}

.footer-inner .divider {
    margin: 0 10px;
    color: var(--border-color);
}

/* ==================== 遮罩层 ==================== */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: none;
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 200;
        border-radius: 0;
        transition: left 0.3s ease;
        padding-top: 60px;
    }

    .sidebar.active {
        left: 0;
    }

    .close-sidebar {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 576px) {
    .header {
        padding: 12px 0;
    }

    .logo-text {
        display: none;
    }

    .slogan {
        display: none;
    }

    .site-update {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .main-container {
        padding-top: 15px;
    }

    .breadcrumb {
        padding: 10px 15px;
        font-size: 12px;
        overflow-x: auto;
        white-space: nowrap;
        margin-bottom: 10px;
    }

    .site-stats-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .stats-text {
        font-size: 13px;
        text-align: center;
    }

    .tab-search {
        width: 100%;
    }

    .search-input {
        width: 100%;
        flex: 1;
    }

    .site-item {
        padding: 10px 15px;
    }

    .site-title {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .related-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .header,
    .sidebar,
    .overlay,
    .footer,
    .pagination-nav {
        display: none !important;
    }

    .main-container {
        display: block;
    }

    .content {
        width: 100%;
    }
}
