/* ========================================
   博客前端统一布局样式
   Blog Frontend Layout Styles
   
   三段式布局：Header + Main + Footer
   主内容区：Main Content + Sidebar
======================================== */

/* ========================================
   顶部导航栏
======================================== */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--outline);
    box-shadow: var(--elevation-1);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    display: flex;
    align-items: center;
}

.header-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
}

.logo-icon {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
}

.logo span,
.logo-text {
    display: inline-block;
    font-size: 1.125rem;
    font-weight: var(--font-weight-bold);
    color: var(--on-surface);
    line-height: 1.2;
    white-space: nowrap;
    word-break: keep-all;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
    transition: color 0.2s ease;
}

.logo:hover span {
    color: var(--primary);
}

/* 主导航 */
.main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
    justify-content: center;
}

.nav-link {
    padding: var(--space-2) var(--space-4);
    color: var(--on-surface);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--surface-variant);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

/* 头部操作区 */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* 主题切换按钮 */
.theme-toggle {
    position: relative;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--surface-variant);
}

.theme-icon {
    position: absolute;
    transition: all 0.2s ease;
}

.theme-icon svg {
    width: 18px;
    height: 18px;
}

[data-theme="light"] .theme-icon.moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    transform: rotate(90deg);
}

/* ========================================
   主内容区布局
======================================== */

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
    min-height: calc(100vh - 200px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-8);
    align-items: start;
}

/* 优化布局比例：主内容区约70%，侧边栏约30% */
@media (min-width: 1200px) {
    .content-wrapper {
        grid-template-columns: minmax(0, 7fr) 3fr;
        gap: var(--space-8);
    }
}

.main-content {
    min-width: 0;
    /* 确保内容不会溢出 */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ========================================
   侧边栏
======================================== */

.sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    /* 优化sticky定位，确保在视口内固定 */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* 隐藏滚动条但保持可滚动 */
    scrollbar-width: thin;
    scrollbar-color: var(--outline) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--outline);
    border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--on-surface-variant);
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.sidebar-card:hover {
    box-shadow: var(--elevation-1);
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-semibold);
    color: var(--on-surface);
    padding: var(--space-3) var(--space-4);
    margin: 0;
    background: var(--surface-variant);
    border-bottom: 1px solid var(--outline);
}

.sidebar-title svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

/* 热门文章 */
.hot-articles {
    padding: var(--space-2);
}

.hot-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.hot-item:hover {
    background: var(--surface-variant);
}

.hot-rank {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: var(--font-weight-bold);
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

/* 热门文章排名颜色 - 1:1还原参考设计 */
.hot-rank.rank-1 {
    background: #ff6b6b;
    color: white;
}

.hot-rank.rank-2 {
    background: #ffa94d;
    color: white;
}

.hot-rank.rank-3 {
    background: #ffd43b;
    color: #333;
}

.hot-info {
    flex: 1;
    min-width: 0;
}

.hot-title {
    display: block;
    font-size: 0.8125rem;
    color: var(--on-surface);
    line-height: 1.4;
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hot-item:hover .hot-title {
    color: var(--primary);
}

.hot-views {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.6875rem;
    color: var(--on-surface-variant);
}

.hot-views svg {
    width: 12px;
    height: 12px;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: var(--space-1) var(--space-3);
    background: var(--surface-variant);
    color: var(--on-surface-variant);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

.tag-item:hover {
    background: var(--primary-container);
    color: var(--primary);
}

.tag-item.active {
    background: var(--primary);
    color: white;
}

.tag-item .tag-name {
    /* 标签名称样式 - 继承父元素样式 */
    display: inline;
}

.tag-item .tag-count {
    font-size: 0.625rem;
    opacity: 0.7;
}

.tag-item:hover .tag-count {
    opacity: 1;
}

.tag-item.weight-1 {
    font-size: 0.6875rem;
}

.tag-item.weight-2 {
    font-size: 0.75rem;
}

.tag-item.weight-3 {
    font-size: 0.8125rem;
}

.tag-item.weight-4 {
    font-size: 0.875rem;
    font-weight: var(--font-weight-semibold);
}

.tag-item.weight-5 {
    font-size: 0.9375rem;
    font-weight: var(--font-weight-bold);
}

/* 查看更多标签链接 */
.tag-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    margin: 0 var(--space-4) var(--space-3);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    background: var(--primary-container);
    transition: all 0.2s ease;
}

.tag-more:hover {
    background: var(--primary);
    color: white;
}

/* 归档列表 */
.archive-list {
    padding: var(--space-2);
}

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    color: var(--on-surface-variant);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    transition: all 0.2s ease;
}

.archive-item:hover {
    background: var(--surface-variant);
    color: var(--on-surface);
}

.archive-item.active {
    background: var(--primary-container);
    color: var(--primary);
}

.archive-date {
    font-weight: var(--font-weight-medium);
}

.archive-date .archive-year {
    color: var(--on-surface);
}

.archive-date .archive-month {
    color: var(--primary);
    font-weight: var(--font-weight-semibold);
}

.archive-item:hover .archive-date .archive-year,
.archive-item:hover .archive-date .archive-month {
    color: inherit;
}

.archive-count {
    font-size: 0.6875rem;
    padding: 2px var(--space-2);
    background: var(--surface-variant);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.archive-item:hover .archive-count {
    background: var(--primary-container);
}

.archive-item.active .archive-count {
    background: var(--primary);
    color: white;
}

.archive-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    margin: var(--space-2);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    background: var(--primary-container);
    transition: all 0.2s ease;
}

.archive-more:hover {
    background: var(--primary);
    color: white;
}

/* 站长工具组件 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: var(--space-2);
    padding: var(--space-3);
}

.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.tool-item:hover {
    background: var(--surface-variant);
    transform: translateY(-2px);
}

.tool-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 18px;
    color: white;
}

.tool-name {
    font-size: 0.6875rem;
    color: var(--on-surface-variant);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tool-item:hover .tool-name {
    color: var(--on-surface);
}

/* 推荐阅读组件（带缩略图） */
.recommend-list {
    padding: var(--space-2);
}

.recommend-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.recommend-item:hover {
    background: var(--surface-variant);
}

.recommend-thumb {
    width: 70px;
    height: 50px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-variant);
}

.recommend-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recommend-item:hover .recommend-thumb img {
    transform: scale(1.05);
}

.recommend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recommend-title {
    font-size: 0.8125rem;
    color: var(--on-surface);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-1);
}

.recommend-item:hover .recommend-title {
    color: var(--primary);
}

.recommend-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.recommend-views {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.6875rem;
    color: var(--on-surface-variant);
}

.recommend-views svg {
    width: 12px;
    height: 12px;
}

/* 站长公告组件 */
.notice-content {
    padding: var(--space-3) var(--space-4);
}

.notice-image {
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.notice-image img {
    width: 100%;
    height: auto;
    display: block;
}

.notice-text {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    line-height: 1.6;
    margin: 0;
}

/* 推荐阅读v2（缩略图在右侧） */
.recommend-list-v2 {
    padding: var(--space-2);
}

.recommend-item-v2 {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.recommend-item-v2:hover {
    background: var(--surface-variant);
}

.recommend-info-v2 {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recommend-title-v2 {
    font-size: 0.8125rem;
    color: var(--on-surface);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-1);
}

.recommend-item-v2:hover .recommend-title-v2 {
    color: var(--primary);
}

.recommend-date-v2 {
    font-size: 0.6875rem;
    color: var(--on-surface-variant);
}

.recommend-thumb-v2 {
    width: 60px;
    height: 45px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-variant);
}

.recommend-thumb-v2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recommend-item-v2:hover .recommend-thumb-v2 img {
    transform: scale(1.05);
}

/* 文章排行组件 */
.rank-list {
    padding: var(--space-2);
}

.rank-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.rank-item:hover {
    background: var(--surface-variant);
}

.rank-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: var(--font-weight-bold);
    color: var(--on-surface-variant);
    background: var(--surface-variant);
    border-radius: var(--radius-sm);
}

.rank-item.rank-1 .rank-num {
    background: #ff6b6b;
    color: white;
}

.rank-item.rank-2 .rank-num {
    background: #ffa94d;
    color: white;
}

.rank-item.rank-3 .rank-num {
    background: #ffd43b;
    color: #333;
}

.rank-title {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--on-surface);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rank-item:hover .rank-title {
    color: var(--primary);
}

/* 精选资源组件 */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    padding: var(--space-3);
}

.resource-item {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-variant);
    aspect-ratio: 16/10;
    transition: all 0.2s ease;
}

.resource-item:hover {
    transform: scale(1.02);
    box-shadow: var(--elevation-1);
}

.resource-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   底部
======================================== */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--outline);
    margin-top: var(--space-8);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.footer-main {
    display: flex;
    justify-content: space-between;
    padding: var(--space-10) 0;
    gap: var(--space-8);
}

.footer-brand {
    max-width: 320px;
    flex-shrink: 0;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    text-decoration: none;
    margin-bottom: var(--space-4);
}

.footer-logo .logo-icon {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
}

.footer-logo span {
    color: var(--on-surface);
}

.footer-desc {
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    line-height: 1.7;
    max-width: 280px;
}

.footer-links {
    display: flex;
    gap: var(--space-10);
    flex-wrap: wrap;
}

.footer-col {
    min-width: 100px;
}

.footer-col h4 {
    font-size: 0.875rem;
    font-weight: var(--font-weight-semibold);
    color: var(--on-surface);
    margin-bottom: var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-col a {
    display: block;
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    text-decoration: none;
    padding: var(--space-1) 0;
    transition: color 0.2s ease;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    padding: var(--space-5) 0;
    border-top: 1px solid var(--outline);
}

.footer-bottom p {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    margin: 0;
}

.footer-bottom .copyright {
    flex: 1;
}

.footer-bottom .icp {
    text-align: right;
}

.footer-bottom .icp a {
    color: var(--on-surface-variant);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-bottom .icp a:hover {
    color: var(--primary);
}

/* 简化版底部 */
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
    text-align: center;
}

.footer-inner p {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
}

/* ========================================
   响应式设计
   Requirements: 7.1, 7.2, 7.3, 7.4
======================================== */

/* 中等屏幕：调整侧边栏宽度 */
@media (max-width: 1200px) {
    .content-wrapper {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: var(--space-5);
    }
}

/* 小屏幕（<900px）：转换为单栏布局，侧边栏移至主内容下方 - Requirements 7.1, 7.4 */
@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    /* 主内容区在上 */
    .main-content {
        order: 1;
    }

    /* 侧边栏移至主内容下方 - Requirements 7.4 */
    .sidebar {
        order: 2;
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
        max-height: none;
        overflow-y: visible;
    }

    /* 侧边栏卡片在双列布局中的优化 */
    .sidebar-card {
        height: fit-content;
    }

    /* 站长信息组件在双列布局中居中 */
    .widget-author-info {
        grid-column: span 2;
    }

    .footer-main {
        flex-direction: column;
        gap: var(--space-6);
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-desc {
        max-width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .footer-bottom .copyright,
    .footer-bottom .icp {
        text-align: center;
    }
}

/* 移动端（<768px）：单列侧边栏 - Requirements 7.4 */
@media (max-width: 768px) {
    .site-header {
        height: 64px;
        min-height: 64px;
    }

    .header-container {
        padding: 0 var(--space-3);
        gap: var(--space-2);
        flex-wrap: nowrap;
        align-items: center;
    }

    .main-nav {
        display: none;
    }

    .logo {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        flex-shrink: 1;
    }

    .logo span,
    .logo-text {
        font-size: 0.95rem;
    }

    .header-actions {
        margin-left: 0;
        gap: var(--space-2);
    }

    .theme-toggle,
    .mobile-menu-toggle {
        width: 34px;
        height: 34px;
    }

    .main-container {
        padding: var(--space-4);
    }

    /* 侧边栏改为单列 */
    .sidebar {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    /* 站长信息组件恢复单列 */
    .widget-author-info {
        grid-column: span 1;
    }

    .footer-links {
        flex-direction: column;
        gap: var(--space-4);
    }

    /* 汉堡菜单按钮显示 */
    .mobile-menu-toggle {
        display: flex;
    }

    /* 移动端导航面板显示 */
    .mobile-nav-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-nav-overlay.active {
        pointer-events: auto;
    }

    .mobile-nav-panel {
        display: flex;
        flex-direction: column;
    }
}

/* 超小屏幕（<480px） */
@media (max-width: 480px) {
    .site-header {
        height: 56px;
        min-height: 56px;
    }

    .logo span,
    .logo-text {
        display: inline-block;
        font-size: 0.875rem;
    }

    .header-container {
        padding: 0 var(--space-2);
        gap: var(--space-2);
    }

    .main-container {
        padding: var(--space-3);
    }

    .sidebar-card {
        border-radius: var(--radius-md);
    }

    /* 侧边栏组件紧凑模式 */
    .sidebar-title {
        padding: var(--space-2) var(--space-3);
        font-size: 0.875rem;
    }

    .hot-articles {
        padding: var(--space-1);
    }

    .hot-item {
        padding: var(--space-2);
    }

    .tag-cloud {
        padding: var(--space-2) var(--space-3);
    }

    .archive-list {
        padding: var(--space-1);
    }
}

/* ========================================
   移动端汉堡菜单 - Requirements 8.2
======================================== */

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--on-surface);
    transition: all 0.2s ease;
}

@media (max-width: 860px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

.mobile-menu-toggle:hover {
    background: var(--surface-variant);
}

.mobile-menu-toggle svg {
    width: 22px;
    height: 22px;
}

/* 移动端导航面板 */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
}

.mobile-nav-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--surface);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.mobile-nav-panel.active {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--outline);
    background: var(--surface-variant);
}

.mobile-nav-header .logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.mobile-nav-header .logo-icon {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
}

.mobile-nav-header .logo span {
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    color: var(--on-surface);
    white-space: nowrap;
    word-break: keep-all;
}

.mobile-nav-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--on-surface-variant);
    transition: all 0.2s ease;
}

.mobile-nav-close:hover {
    background: var(--outline);
    color: var(--on-surface);
}

.mobile-nav-close svg {
    width: 18px;
    height: 18px;
}

.mobile-nav-content {
    padding: var(--space-4);
}

.mobile-nav-section {
    margin-bottom: var(--space-4);
}

.mobile-nav-section-title {
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    color: var(--on-surface);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.mobile-nav-link:hover {
    background: var(--surface-variant);
    color: var(--primary);
}

.mobile-nav-link.active {
    background: var(--primary-container);
    color: var(--primary);
}

.mobile-nav-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.mobile-nav-link.active svg {
    opacity: 1;
}

/* 移动端分类导航 */
.mobile-category-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.mobile-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    color: var(--on-surface);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.mobile-category-item:hover {
    background: var(--surface-variant);
}

.mobile-category-item.active {
    background: var(--primary-container);
    color: var(--primary);
}

.mobile-category-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.mobile-category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.mobile-category-count {
    font-size: 0.75rem;
    color: var(--on-surface-variant);
    padding: 2px var(--space-2);
    background: var(--surface-variant);
    border-radius: var(--radius-full);
}

.mobile-category-item.active .mobile-category-count {
    background: var(--primary);
    color: white;
}

/* 移动端底部操作 */
.mobile-nav-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--outline);
    margin-top: auto;
}

.mobile-nav-footer .btn {
    width: 100%;
    justify-content: center;
}

/* ========================================
   深色主题适配
   Requirements: 9.1, 9.2, 9.3
======================================== */

[data-theme="dark"] .site-header {
    background: var(--surface);
    border-bottom-color: var(--outline);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .logo span {
    color: var(--on-surface);
}

[data-theme="dark"] .logo:hover span {
    color: var(--primary);
}

[data-theme="dark"] .nav-link {
    color: var(--on-surface);
}

[data-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
}

[data-theme="dark"] .nav-link.active {
    background: var(--primary-container);
    color: var(--primary);
}

[data-theme="dark"] .theme-toggle {
    color: var(--on-surface);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-card {
    background: var(--surface);
    border-color: var(--outline);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sidebar-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sidebar-title {
    background: var(--surface-variant);
    border-color: var(--outline);
    color: var(--on-surface);
}

[data-theme="dark"] .hot-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .hot-title {
    color: var(--on-surface);
}

[data-theme="dark"] .hot-item:hover .hot-title {
    color: var(--primary);
}

[data-theme="dark"] .hot-rank {
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

/* 深色主题热门文章排名颜色 */
[data-theme="dark"] .hot-rank.rank-1 {
    background: #ff6b6b;
    color: white;
}

[data-theme="dark"] .hot-rank.rank-2 {
    background: #ffa94d;
    color: white;
}

[data-theme="dark"] .hot-rank.rank-3 {
    background: #ffd43b;
    color: #333;
}

[data-theme="dark"] .tag-item {
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

[data-theme="dark"] .tag-item:hover {
    background: var(--primary-container);
    color: var(--primary);
}

[data-theme="dark"] .tag-item.active {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .archive-item {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .archive-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--on-surface);
}

[data-theme="dark"] .archive-item.active {
    background: var(--primary-container);
    color: var(--primary);
}

[data-theme="dark"] .archive-count {
    background: var(--surface-variant);
}

[data-theme="dark"] .archive-item:hover .archive-count {
    background: var(--primary-container);
}

[data-theme="dark"] .archive-item.active .archive-count {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .tag-more,
[data-theme="dark"] .archive-more {
    background: var(--primary-container);
    color: var(--primary);
}

/* 站长工具深色主题 */
[data-theme="dark"] .tool-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tool-name {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .tool-item:hover .tool-name {
    color: var(--on-surface);
}

/* 推荐阅读深色主题 */
[data-theme="dark"] .recommend-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .recommend-thumb {
    background: var(--surface-variant);
}

[data-theme="dark"] .recommend-title {
    color: var(--on-surface);
}

[data-theme="dark"] .recommend-item:hover .recommend-title {
    color: var(--primary);
}

[data-theme="dark"] .recommend-views {
    color: var(--on-surface-variant);
}

/* 站长公告深色主题 */
[data-theme="dark"] .notice-text {
    color: var(--on-surface-variant);
}

/* 推荐阅读v2深色主题 */
[data-theme="dark"] .recommend-item-v2:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .recommend-title-v2 {
    color: var(--on-surface);
}

[data-theme="dark"] .recommend-item-v2:hover .recommend-title-v2 {
    color: var(--primary);
}

[data-theme="dark"] .recommend-thumb-v2 {
    background: var(--surface-variant);
}

/* 文章排行深色主题 */
[data-theme="dark"] .rank-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .rank-num {
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

[data-theme="dark"] .rank-title {
    color: var(--on-surface);
}

[data-theme="dark"] .rank-item:hover .rank-title {
    color: var(--primary);
}

/* 精选资源深色主题 */
[data-theme="dark"] .resource-item {
    background: var(--surface-variant);
}

[data-theme="dark"] .tag-more:hover,
[data-theme="dark"] .archive-more:hover {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .site-footer {
    background: var(--surface);
    border-top-color: var(--outline);
}

[data-theme="dark"] .footer-logo span {
    color: var(--on-surface);
}

[data-theme="dark"] .footer-desc {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .footer-col h4 {
    color: var(--on-surface);
}

[data-theme="dark"] .footer-col a {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .footer-col a:hover {
    color: var(--primary);
}

[data-theme="dark"] .footer-bottom {
    border-top-color: var(--outline);
}

[data-theme="dark"] .footer-bottom p {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .footer-bottom .icp a {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .footer-bottom .icp a:hover {
    color: var(--primary);
}

/* 深色主题 - 移动端导航 */
[data-theme="dark"] .mobile-nav-panel {
    background: var(--surface);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .mobile-nav-header {
    background: var(--surface-variant);
    border-color: var(--outline);
}

[data-theme="dark"] .mobile-nav-header .logo span {
    color: var(--on-surface);
}

[data-theme="dark"] .mobile-nav-close {
    background: var(--surface);
    color: var(--on-surface-variant);
}

[data-theme="dark"] .mobile-nav-close:hover {
    background: var(--outline);
    color: var(--on-surface);
}

[data-theme="dark"] .mobile-nav-section-title {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .mobile-nav-link {
    color: var(--on-surface);
}

[data-theme="dark"] .mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-light);
}

[data-theme="dark"] .mobile-nav-link.active {
    background: var(--primary-container);
    color: var(--primary-light);
}

[data-theme="dark"] .mobile-nav-link svg {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .mobile-nav-link.active svg {
    color: var(--primary-light);
}

[data-theme="dark"] .mobile-category-item {
    color: var(--on-surface);
}

[data-theme="dark"] .mobile-category-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mobile-category-item.active {
    background: var(--primary-container);
    color: var(--primary-light);
}

[data-theme="dark"] .mobile-category-count {
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

[data-theme="dark"] .mobile-category-item.active .mobile-category-count {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .mobile-nav-footer {
    border-top-color: var(--outline);
}

/* ========================================
   深色主题 - 侧边栏组件增强
   Requirements: 8.1, 8.2
======================================== */

/* 热门文章排名深色主题 */
[data-theme="dark"] .hot-views {
    color: var(--on-surface-variant);
}

/* 标签云深色主题增强 */
[data-theme="dark"] .tag-item .tag-count {
    opacity: 0.6;
}

[data-theme="dark"] .tag-item:hover .tag-count {
    opacity: 0.9;
}

/* 归档列表深色主题增强 */
[data-theme="dark"] .archive-date .archive-year {
    color: var(--on-surface);
}

[data-theme="dark"] .archive-date .archive-month {
    color: var(--primary-light);
}

[data-theme="dark"] .archive-item:hover .archive-date .archive-year,
[data-theme="dark"] .archive-item:hover .archive-date .archive-month {
    color: var(--on-surface);
}

/* 站长信息组件深色主题增强 */
[data-theme="dark"] .widget-author-info .author-name {
    color: var(--on-surface);
}

[data-theme="dark"] .widget-author-info .author-bio {
    color: var(--on-surface-variant);
}

/* 最新文章组件深色主题增强 */
[data-theme="dark"] .widget-latest-articles .latest-title {
    color: var(--on-surface);
}

[data-theme="dark"] .widget-latest-articles .latest-item:hover .latest-title {
    color: var(--primary-light);
}

[data-theme="dark"] .widget-latest-articles .latest-date {
    color: var(--on-surface-variant);
}

/* 友情链接组件深色主题增强 */
[data-theme="dark"] .widget-links .link-name {
    color: var(--on-surface-variant);
}

[data-theme="dark"] .widget-links .link-item:hover .link-name {
    color: var(--primary-light);
}

/* ========================================
   无障碍支持
======================================== */

.nav-link:focus-visible,
.tag-item:focus-visible,
.archive-item:focus-visible,
.hot-item:focus-visible,
.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .sidebar-card:hover {
        box-shadow: none;
    }
}

/* ========================================
   侧边栏组件样式 - 新增组件
   Requirements: 4.2, 4.4, 4.7, 4.8
======================================== */

/* 站长信息组件 */
.widget-author-info {
    text-align: center;
    padding: var(--space-5);
}

.widget-author-info .author-header {
    margin-bottom: var(--space-3);
}

.widget-author-info .author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: var(--space-3);
    transition: transform 0.3s ease;
}

.widget-author-info:hover .author-avatar {
    transform: scale(1.05);
}

.widget-author-info .author-name {
    font-size: 1.125rem;
    font-weight: var(--font-weight-bold);
    color: var(--on-surface);
    margin: 0;
}

.widget-author-info .author-bio {
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    line-height: 1.6;
    margin: 0 0 var(--space-3);
}

.widget-author-info .author-social {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
}

.widget-author-info .social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-variant);
    color: var(--on-surface-variant);
    transition: all 0.2s ease;
}

.widget-author-info .social-link:hover {
    background: var(--primary);
    color: white;
}

.widget-author-info .social-link svg {
    width: 18px;
    height: 18px;
}

/* 最新文章组件 - 优化缩略图样式 */
.widget-latest-articles .latest-articles {
    padding: var(--space-2);
}

.widget-latest-articles .latest-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.widget-latest-articles .latest-item:hover {
    background: var(--surface-variant);
}

/* 缩略图 - 60x60圆角 */
.widget-latest-articles .latest-cover {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-variant);
}

/* 无缩略图时的占位 */
.widget-latest-articles .latest-item:not(:has(.latest-cover)) {
    padding-left: 12px;
}

.widget-latest-articles .latest-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.widget-latest-articles .latest-title {
    display: block;
    font-size: 0.8125rem;
    color: var(--on-surface);
    line-height: 1.5;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: var(--font-weight-medium);
}

.widget-latest-articles .latest-item:hover .latest-title {
    color: var(--primary);
}

.widget-latest-articles .latest-date {
    font-size: 0.6875rem;
    color: var(--on-surface-variant);
    display: flex;
    align-items: center;
    gap: 4px;
}

.widget-latest-articles .latest-date::before {
    content: '';
    width: 3px;
    height: 3px;
    background: var(--outline);
    border-radius: 50%;
}

/* 友情链接组件 */
.widget-links .links-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
}

.widget-links .link-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-variant);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    transition: all 0.2s ease;
}

.widget-links .link-item:hover {
    background: var(--primary-container);
    color: var(--primary);
}

.widget-links .link-logo {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.widget-links .link-name {
    font-weight: var(--font-weight-medium);
}

/* 广告位组件 */
.widget-ad-slot {
    padding: 0;
    overflow: hidden;
}

.widget-ad-slot .ad-link {
    display: block;
}

.widget-ad-slot .ad-image {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s ease;
}

.widget-ad-slot .ad-link:hover .ad-image {
    opacity: 0.9;
}

/* 深色主题适配 - 新增组件 */
[data-theme="dark"] .widget-author-info .author-avatar {
    border-color: var(--primary);
}

[data-theme="dark"] .widget-author-info .social-link {
    background: var(--surface-variant);
    color: var(--on-surface-variant);
}

[data-theme="dark"] .widget-author-info .social-link:hover {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .widget-latest-articles .latest-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .widget-links .link-item {
    background: var(--surface-variant);
}

[data-theme="dark"] .widget-links .link-item:hover {
    background: var(--primary-container);
}
