:root {
    --primary: #ff8c00;
    --primary-hover: #e67300;
    --bg-color: #f5f6f8;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #888888;
    --border-color: #e8e8e8;
    --sidebar-bg: #2d2d2d;
    --sidebar-hover: #ff8c00;
    --sidebar-text: #ffffff;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.10);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 200px;
    --topnav-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Left Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid #3d3d3d;
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.sidebar-logo { padding: 0; border-bottom: 1px solid #3d3d3d; display: flex; align-items: center; justify-content: center; height: var(--topnav-height); }
.sidebar-logo a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; text-decoration: none; }
.sidebar-logo-text { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.sidebar-header {
    padding: 12px 20px 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--sidebar-text);
    border-bottom: 1px solid #3d3d3d;
    position: relative;
}
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20px;
    width: 30px;
    height: 2px;
    background: var(--primary);
}
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-nav { padding: 8px 0; }
.sidebar-item > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 13px 16px 12px 20px;
    color: var(--sidebar-text);
    transition: all 0.2s;
    font-size: 13px;
    position: relative;
}
.sidebar-item > a:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.sidebar-item > a.active { color: var(--sidebar-text); background: var(--sidebar-hover); }
.sidebar-item > a .cat-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; opacity: 1; }
.sidebar-item > a .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item > a .sidebar-more {
    font-size: 10px;
    color: #aaa;
    transition: transform 0.2s;
    flex-shrink: 0;
    font-style: normal;
}
.sidebar-item.open > a .sidebar-more { transform: rotate(90deg); color: var(--sidebar-text); }
.sub-nav {
    padding: 0 0 2px 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #383838;
}
.sidebar-item.open .sub-nav { max-height: 2000px; }
.sub-nav a {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: #ccc;
    transition: all 0.2s;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sub-nav a:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.sub-nav a.active { color: var(--sidebar-text); background: var(--sidebar-hover); font-weight: 500; }
.sidebar-footer {
    border-top: 1px solid #3d3d3d;
    padding: 10px 16px;
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--sidebar-text);
    border-radius: 6px;
    transition: all 0.2s;
}
.sidebar-footer a:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.sidebar-footer .icon-tijiao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-style: normal;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(130,130,130,0.3); border-radius: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== Right Main Area ===== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== Top Navigation ===== */
.top-nav {
    height: var(--topnav-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.top-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 8px;
}
.top-nav-menu { flex: 1; }
.top-nav-menu ul { display: flex; gap: 2px; }
.top-nav-menu ul li a {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
    white-space: nowrap;
}
.top-nav-menu ul li a:hover,
.top-nav-menu ul li a.active {
    color: var(--primary);
    background: rgba(241,64,75,0.06);
}
.top-nav-right { display: flex; align-items: center; gap: 8px; }
.admin-btn {
    display: inline-block;
    padding: 5px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}
.admin-btn:hover { background: var(--primary-hover); }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; }

/* Submission Page */
.submission-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); line-height: 1.8; font-size: 14px; color: #444; }
.submission-card h4 { font-size: 14px; font-weight: 600; color: #333; }
.submission-card p { margin-bottom: 4px; }
.btn-back-home:hover { background: #e0e0e0 !important; }

/* Page Tab System */
.page-tab-content { }
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }

/* News Layout - Full width with sidebar hidden */
.news-sidebar { width: 200px; flex-shrink: 0; background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow-y: auto; }
.news-sidebar .ns-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 13px; color: #444; }
.news-sidebar .ns-item:hover { background: #f5f5f5; color: #ff8c00; }
.news-sidebar .ns-item.active { background: rgba(255,140,0,0.1); color: #ff8c00; font-weight: 500; }
.news-layout-full { display: flex; gap: 16px; height: calc(100vh - 80px); }
.news-main-full { flex: 1; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; position: relative; }
.news-main-full iframe { border-radius: 12px; }

/* Events */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.event-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; position: relative; }
.event-status { display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 0 0 6px 0; }
.event-status.ongoing { background: #ff8c00; color: #fff; }
.event-status.ended { background: #ddd; color: #999; }
.event-body { padding: 16px; }
.event-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.event-body p { font-size: 13px; color: #888; margin-bottom: 8px; }
.event-meta { font-size: 12px; color: #aaa; }

/* Filtered sites */
.filtered-sites .sites-grid { margin-top: 16px; }

/* ===== Content Area (scrollable) ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.content-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Content Search */
.content-search { margin-bottom: 16px; }
.content-search input {
    width: 100%;
    max-width: 380px;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
}
.content-search input:focus { border-color: var(--primary); }

/* Ad Row */
.ad-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.ad-col a { display: block; }
@media (max-width: 991px) {
    .ad-col-right { display: none; }
    .ad-row { grid-template-columns: 1fr; }
}

/* Category Section */
.category-section { margin-bottom: 32px; }
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #444;
}
.section-title-icon { color: var(--primary); font-size: 18px; }

/* Sub Tabs */
.sub-tabs { margin-bottom: 14px; }
.sub-tabs-nav {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
}
.sub-tabs-nav-inner {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
}
.sub-tab-btn {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}
.sub-tab-btn:hover { color: var(--primary); }
.sub-tab-btn.active {
    background: var(--primary);
    color: #fff;
}
.tab-more-link {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s;
}
.tab-more-link:hover { color: var(--primary); }
.sub-tabs-content { position: relative; }
.sub-tab-pane { display: none; }
.sub-tab-pane.active { display: block; }

/* Sites Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
/* Tab card content grid: exactly 4 columns, spaced from sidebar */
.tab-card-content {
    padding: 0 24px;
}
.tab-card-content .sites-grid {
    grid-template-columns: repeat(4, 1fr);
}
.tab-card-content .site-card {
    padding: 18px 14px;
}
.tab-card-content .site-card-icon {
    width: 50px;
    height: 50px;
}
.site-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    transition: all 0.25s;
    position: relative;
}
.site-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--sidebar-hover);
    background: rgba(255,140,0,0.05);
}
.site-card-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}
.site-card-icon img { width: 24px; height: 24px; object-fit: contain; }
.site-card-info { flex: 1; min-width: 0; }
.site-card-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.site-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.site-card-tags {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-align: center;
}
.badge.hot { background: #fff1f0; color: #f1404b; }
.badge.new { background: #e6f7ff; color: #1890ff; }
.empty-tab { padding: 40px; text-align: center; color: #bbb; font-size: 14px; }

/* Footer */
.footer {
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 30px 0 20px;
    margin-top: 10px;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}
.footer-row {
    display: grid;
    grid-template-columns: 1.5fr 2fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}
.footer-logo { display: inline-block; margin-bottom: 10px; }
.footer-desc { font-size: 12px; color: #999; line-height: 1.8; }
.footer-col-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: #555; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.footer-links a { color: #888; font-size: 12px; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }
.footer-shortcut { font-size: 12px; color: #999; }
.footer-copyright { text-align: center; padding-top: 14px; border-top: 1px solid var(--border-color); }
.footer-copyright p { color: #999; font-size: 12px; }

/* Scrollbar for content area */
.content-area::-webkit-scrollbar { width: 5px; }
.content-area::-webkit-scrollbar-thumb { background: rgba(130,130,130,0.3); border-radius: 4px; }
.content-area::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px;
        transition: left 0.3s;
        z-index: 1050;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .sidebar.mobile-open { left: 0; }
    .menu-toggle { display: block; }
    .top-nav-menu ul li a { padding: 6px 8px; font-size: 13px; }
    .footer-row { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 576px) {
    .content-inner { padding: 12px; }
    .sites-grid { grid-template-columns: 1fr; }
    .top-nav-inner { padding: 0 10px; }
    .admin-btn { padding: 4px 10px; font-size: 12px; }
}