/*
Theme Name: BidiaNav导航主题
Theme URI: https://example.com/bidianav
Author: Developer
Description: 仿笔点导航的WordPress导航主题，分类网站样式完全还原
Version: 2.0
License: GPL v2 or later
Text Domain: bidianav
*/

/* ========== CSS Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary-color: #4285f4;
    --primary-hover: #3367d6;
    --bg-color: #f5f6f8;
    --card-bg: #fff;
    --text-color: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border-color: #e8e8e8;
    --cat-header-bg: #f8f9fa;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 4px;
    --radius-lg: 8px;
    --content-width: 1200px;
    --sidebar-width: 300px;
    --gap: 16px;
}
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--text-color); text-decoration: none; }
a:hover { color: var(--primary-color); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ========== Header / Navbar ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 20px;
}
.site-logo img { height: 32px; }
.site-logo .site-title-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-left: 8px;
}
.header-nav { margin-left: auto; display: flex; gap: 24px; }
.header-nav a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 56px;
}
.header-nav a:hover { color: var(--primary-color); }

/* ========== Search Section ========== */
.search-section {
    background: linear-gradient(135deg, #4285f4 0%, #5b9bf4 100%);
    padding: 40px 20px 30px;
}
.search-inner {
    max-width: 680px;
    margin: 0 auto;
}
.search-engines {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.search-engines .engine-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.search-engines .engine-btn:hover,
.search-engines .engine-btn.active {
    background: #fff;
    color: var(--primary-color);
    border-color: #fff;
}
.search-box {
    display: flex;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.search-box input {
    flex: 1;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    outline: none;
    background: transparent;
}
.search-box button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 28px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
}
.search-box button:hover { background: var(--primary-hover); }

/* ========== Quick Nav Icons (below search) ========== */
.quick-nav {
    max-width: 680px;
    margin: 16px auto 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.quick-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}
.quick-nav a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.quick-nav a img { width: 24px; height: 24px; border-radius: 4px; }

/* ========== Main Layout ========== */
.main-wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    gap: var(--gap);
    padding: 16px 20px;
    align-items: flex-start;
}
.main-content { flex: 1; min-width: 0; }
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

/* ========== Recommend / Top Section ========== */
.recommend-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--gap);
    overflow: hidden;
}
.recommend-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--cat-header-bg);
}
.recommend-tabs .tab-item {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}
.recommend-tabs .tab-item:hover { color: var(--primary-color); }
.recommend-tabs .tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}
.recommend-links {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    padding: 0;
}
.recommend-links .nav-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    min-width: 0;
}
.recommend-links .nav-card:nth-child(6n) { border-right: none; }
.recommend-links .nav-card:hover { background: #f0f5ff; }
.recommend-links .nav-card .card-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: contain;
    background: #f5f5f5;
}
.recommend-links .nav-card .card-title {
    font-size: 13px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* ========== Group Tabs (常用/生活/休闲/工具) ========== */
.group-tabs-bar {
    display: flex;
    gap: 0;
    margin-bottom: var(--gap);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.group-tabs-bar .group-tab {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.group-tabs-bar .group-tab:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--border-color);
}
.group-tabs-bar .group-tab:hover { color: var(--primary-color); background: #f7f9fc; }
.group-tabs-bar .group-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: #f0f5ff;
}

/* ========== Category Sections (核心仿制区域) ========== */
.category-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--gap);
    overflow: hidden;
}
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--cat-header-bg);
}
.category-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}
.category-header h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}
.category-header h3 a {
    color: var(--text-color);
}
.category-header h3 a:hover {
    color: var(--primary-color);
}
.category-header .more-link {
    font-size: 12px;
    color: var(--text-light);
}
.category-header .more-link:hover {
    color: var(--primary-color);
}

/* ---- 分类链接网格 (4列 × 2行, 每分类8个) ---- */
.category-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.category-links .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    min-width: 0;
}
.category-links .nav-item:nth-child(4n) {
    border-right: none;
}
/* Remove bottom border on last row */
.category-links .nav-item:nth-last-child(-n+4) {
    border-bottom: none;
}
/* Special case: if total items <= 4, no bottom border */
.category-links .nav-item:only-child,
.category-links .nav-item:first-child:nth-last-child(-n+4),
.category-links .nav-item:first-child:nth-last-child(-n+4) ~ .nav-item {
    border-bottom: none;
}

.category-links .nav-item:hover {
    background: #f0f5ff;
}
.category-links .nav-item .item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: contain;
    background: #f5f5f5;
}
.category-links .nav-item .item-info {
    flex: 1;
    min-width: 0;
}
.category-links .nav-item .item-title {
    font-size: 13px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 400;
}
.category-links .nav-item .item-desc {
    font-size: 11px;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}

/* ========== Sidebar ========== */
.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--gap);
    overflow: hidden;
}
.sidebar-widget .widget-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--cat-header-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-widget .widget-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}
.sidebar-widget .widget-body { padding: 12px 16px; }

/* Sidebar tabs */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-tabs .stab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.sidebar-tabs .stab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Calendar Widget */
.calendar-widget table { width: 100%; border-collapse: collapse; }
.calendar-widget th {
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
}
.calendar-widget td {
    text-align: center;
    padding: 6px 0;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
}
.calendar-widget td:hover { background: #f0f5ff; }
.calendar-widget td.today {
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    font-weight: 500;
}
.calendar-widget td.other-month { color: #ccc; }
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 4px;
}
.calendar-nav span { font-size: 14px; font-weight: 500; }
.calendar-nav button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
}
.calendar-nav button:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* Hot Search */
.hot-list { list-style: none; }
.hot-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dashed #f0f0f0;
    font-size: 13px;
    cursor: pointer;
}
.hot-list li:last-child { border-bottom: none; }
.hot-list li:hover { color: var(--primary-color); }
.hot-list .hot-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    flex-shrink: 0;
}
.hot-list li:nth-child(1) .hot-rank { background: #fe2d46; }
.hot-list li:nth-child(2) .hot-rank { background: #ff6600; }
.hot-list li:nth-child(3) .hot-rank { background: #faa90e; }
.hot-list li:nth-child(n+4) .hot-rank { background: #ddd; color: #999; }

/* ========== Footer ========== */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 30px 20px 20px;
    margin-top: 20px;
}
.footer-inner {
    max-width: var(--content-width);
    margin: 0 auto;
}
.footer-cols {
    display: flex;
    gap: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.footer-col h5 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.footer-col a { display: block; font-size: 13px; color: var(--text-light); line-height: 2; }
.footer-col a:hover { color: var(--primary-color); }
.footer-bottom { text-align: center; font-size: 12px; color: var(--text-light); }
.footer-bottom a { color: var(--text-light); margin: 0 4px; }
.footer-bottom a:hover { color: var(--primary-color); }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .main-wrap { flex-direction: column; }
    .sidebar { width: 100%; }
    .recommend-links { grid-template-columns: repeat(4, 1fr); }
    .recommend-links .nav-card:nth-child(6n) { border-right: 1px solid var(--border-color); }
    .recommend-links .nav-card:nth-child(4n) { border-right: none; }
}
@media (max-width: 768px) {
    .category-links { grid-template-columns: repeat(2, 1fr); }
    .category-links .nav-item:nth-child(4n) { border-right: 1px solid var(--border-color); }
    .category-links .nav-item:nth-child(2n) { border-right: none; }
    .recommend-links { grid-template-columns: repeat(3, 1fr); }
    .recommend-links .nav-card:nth-child(4n) { border-right: 1px solid var(--border-color); }
    .recommend-links .nav-card:nth-child(3n) { border-right: none; }
    .footer-cols { flex-wrap: wrap; gap: 20px; }
    .header-nav { gap: 12px; }
}
@media (max-width: 480px) {
    .category-links { grid-template-columns: repeat(2, 1fr); }
    .recommend-links { grid-template-columns: repeat(2, 1fr); }
    .recommend-links .nav-card:nth-child(3n) { border-right: 1px solid var(--border-color); }
    .recommend-links .nav-card:nth-child(2n) { border-right: none; }
    .search-section { padding: 24px 12px 20px; }
    .group-tabs-bar .group-tab { font-size: 13px; padding: 10px 0; }
}
