/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

body {
    background-color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 移动端顶部导航栏 (仅在小屏显示) */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #fff;
    border-bottom: 1px solid #eaeaea;
    z-index: 999;
    align-items: center;
    padding: 0 1rem;
}

.mobile-header .btn-toggle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    cursor: pointer;
}

.mobile-header .title {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
}

/* 侧边栏样式 */
.sidebar {
    height: 100vh;
    padding-top: 2rem;
    position: sticky;
    top: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

/* 侧边栏展开/收起 (移动端) - 修复核心样式 */
.sidebar-mobile {
    position: fixed;
    top: 56px;
    left: -100%;
    width: 280px;
    height: calc(100vh - 56px);
    background-color: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    /* 增加层级确保不被遮挡 */
    padding: 2rem 1.5rem;
    /* 补充内边距，和大屏侧边栏一致 */
    transition: left 0.3s ease-in-out;
    /* 明确过渡属性 */
    overflow-y: auto;
    /* 内容超出时可滚动 */
}

.sidebar-mobile.show {
    left: 0;
    /* 滑出时定位到左侧 */
}

/* 标签栏弹窗 (移动端) */
.tab-modal {
    position: fixed;
    top: 56px;
    right: -100%;
    width: 280px;
    height: auto;
    background-color: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 1rem;
    border-radius: 8px 0 0 8px;
    transition: right 0.3s ease-in-out;
}

.tab-modal.show {
    right: 0;
}

.tab-modal .tab-btn {
    display: block;
    width: 100%;
    margin: 0 0 0.8rem 0;
}

.logo {
    display: flex;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo img {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #000000;
}

.sidebar-nav .nav-link {
    color: #666666;
    padding: 0.6rem 1rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none;
    /* 移除链接下划线 */
}

.sidebar-nav .nav-link.active {
    color: #000000;
    font-weight: 500;
    background-color: #f0f0f0;
}

.sidebar-nav .nav-link:hover {
    color: #000000;
    background-color: #f8f8f8;
}

.sidebar-nav .nav-link span {
    margin-left: 0.5rem;
}

/* 顶部标签栏样式 (大屏显示) */
.tab-nav {
    border-bottom: 1px solid #eaeaea;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.5rem 1.2rem;
    margin-right: 0.8rem;
    border-radius: 6px;
    border: none;
    background-color: #f0f0f0;
    color: #666666;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background-color: #00b42a;
    color: #ffffff;
}

.tab-btn:hover:not(.active) {
    background-color: #eaeaea;
}

/* 卡片容器与卡片样式 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.theme-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-img-top {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #f5f5f5;
}

.card-body {
    padding: 1.2rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-text {
    font-size: 0.8rem;
    color: #999999;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: #fff7e6;
    color: #ff9f00;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
}

/* 遮罩层 - 修复层级和点击区域 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 998;
    /* 低于弹窗但高于其他内容 */
    display: none;
    cursor: pointer;
}

.overlay.show {
    display: block;
}

/* 响应式适配 */
@media (max-width: 991px) {

    /* 大屏隐藏移动端头部，小屏显示 */
    .mobile-header {
        display: flex;
        justify-content: space-between;
    }

    /* 小屏隐藏原侧边栏和标签栏 */
    .sidebar.d-none.d-md-block {
        display: none !important;
    }

    .tab-nav {
        display: none;
    }

    /* 小屏主内容区适配顶部固定栏 */
    .main-content {
        margin-top: 56px;
        padding-top: 1rem;
        min-height: calc(100vh - 56px);
        /* 确保内容高度足够 */
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 576px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* 大屏隐藏移动端专属元素 */
@media (min-width: 992px) {

    .mobile-header,
    .sidebar-mobile,
    .tab-modal,
    .overlay {
        display: none !important;
    }
}