/**
 * Fpoew.css (Flexible Page Organization Engine for Web)
 * Independently Developed by Fpoew
 * 
 * Version: 3.1.0 (Fix: Mobile Grid Overflow & Layout Stability)
 * Description: 全站核心样式库。包含双端独立的导航系统样式及移动端布局加固。
 * 
 * 目录结构：
 * 1. Configuration
 * 2. Reset & Base
 * 3. Layout System
 * 4. Skeleton System
 * 5. Header Components
 * 6. PC Navigation
 * 7. Mobile Drawer
 * 8. Footer Component
 * 9. UI Components
 * 10. Sidebar
 * 11. Mobile Specific Fixes (新增: 移动端专属修复区)
 */

/* ============================================================
   1. 配置中心 (Configuration)
   ============================================================ */
:root {
    /* --- 品牌色系 --- */
    --fpoew-color-main: #014c2e;   /* 主色 (深绿) */
    --fpoew-color-sub:  #ef4444;   /* 辅色 (红) */
    
    /* --- 文本色系 --- */
    --fpoew-text-dark:  #333333;
    --fpoew-text-gray:  #666666;
    --fpoew-text-light: #999999;
    
    /* --- 背景与边框 --- */
    --fpoew-bg-body:    #f4f4f4;
    --fpoew-bg-white:   #ffffff;
    --fpoew-border:     #eeeeee;
    
    /* --- 动效与阴影 --- */
    --fpoew-transition: all 0.3s ease;
    --fpoew-shadow:     0 2px 10px rgba(0,0,0,0.1);
    --fpoew-shadow-hover: 0 10px 30px rgba(0,0,0,0.08);
}

/* ============================================================
   2. 重置与基础样式 (Reset & Base)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    overflow-x: hidden; /* 全局防止横向溢出 */
    font-family: "Microsoft YaHei", -apple-system, sans-serif;
    background: var(--fpoew-bg-body);
    color: var(--fpoew-text-dark);
    line-height: 1.6;
}

body.drawer-open { overflow: hidden; }

a { text-decoration: none; color: inherit; transition: var(--fpoew-transition); }
ul { list-style: none; }
img { max-width: 100%; display: block; height: auto; } /* 强制图片自适应 */

/* ============================================================
   3. 布局系统 (Layout System)
   ============================================================ */
.container {
    max-width: 1360px; /* 宽屏适配 */
    margin: 0 auto;
    padding: 0 15px;
    width: 100%; 
}

/* 首页双栏布局 */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 40px 0;
    min-height: 600px;
    width: 100%;
}

/* 内页标准布局 */
.main-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 30px;
    padding: 40px 0;
    min-height: 800px;
    width: 100%;
}

.content-area {
    background: var(--fpoew-bg-white);
    padding: 30px 40px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    width: 100%;
}
.content-area.is-full { padding: 0; overflow: hidden; }

/* ============================================================
   4. 骨架屏占位 (Skeleton)
   ============================================================ */
.skeleton-top { height: 37px; background: var(--fpoew-color-main); width: 100%; }
.skeleton-logo { height: 100px; background: var(--fpoew-bg-white); width: 100%; border-bottom: 1px solid var(--fpoew-border); }
.skeleton-nav { height: 54px; background: var(--fpoew-color-main); width: 100%; box-shadow: var(--fpoew-shadow); }
.skeleton-footer { height: 140px; background: #222; width: 100%; margin-top: 50px; border-top: 4px solid var(--fpoew-color-main); }

@media (max-width: 768px) {
    .skeleton-logo { height: 100px; }
}

/* ============================================================
   5. 组件：通用头部元素 (Top Bar & Logo)
   ============================================================ */
#top-bar {
    width: 100%; background: var(--fpoew-color-main); color: #fff;
    font-size: 13px; height: 37px; line-height: 37px; padding: 0;
}
#top-bar .flex { display: flex; justify-content: space-between; }
.version-badge { color: rgba(255,255,255,0.65); font-size: 12px; font-family: Arial, monospace; letter-spacing: 1px; }

.logo-section {
    width: 100%; background: var(--fpoew-bg-white); height: 100px; padding: 0;
    display: flex; align-items: center; border-bottom: 1px solid #f0f0f0;
}
.logo-flex { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.logo-box { display: flex; align-items: center; gap: 15px; }
.logo-box img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 1px solid #eee; }
.logo-text h1 { font-size: 28px; color: var(--fpoew-color-main); letter-spacing: 2px; line-height: 1.2; margin: 0; }
.logo-text p { font-size: 14px; color: var(--fpoew-text-gray); line-height: 1.2; margin: 0; }

.mobile-toggle, .nav-mobile-drawer, .mobile-overlay { display: none; }

/* ============================================================
   6. 组件：PC端导航 (PC System)
   ============================================================ */
@media (min-width: 769px) {
    .nav-pc {
        width: 100%; background: var(--fpoew-color-main);
        position: sticky; top: 0; z-index: 1000;
        box-shadow: var(--fpoew-shadow); height: 54px;
    }
    .nav-list { display: flex; align-items: center; height: 54px; margin: 0; padding: 0; }
    .nav-list > li { position: relative; height: 100%; list-style: none; }
    .nav-list > li > a {
        display: flex; align-items: center; height: 100%; padding: 0 25px;
        color: #fff; font-weight: bold; gap: 5px;
    }
    .nav-list > li:hover > a, .nav-list > li > a.active { background: rgba(255,255,255,0.15); }

    .dropdown-menu {
        position: absolute; top: 100%; left: 0;
        background-color: var(--fpoew-color-main); min-width: 200px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        opacity: 0; visibility: hidden; transform: translateY(10px);
        transition: var(--fpoew-transition);
        border-top: 2px solid var(--fpoew-color-sub);
        z-index: 1001; margin: 0; padding: 0;
    }
    .nav-list > li:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
    .dropdown-menu li a {
        display: block; height: auto; padding: 12px 20px;
        color: rgba(255,255,255,0.9); font-size: 14px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .dropdown-menu li a:hover { background-color: rgba(255,255,255,0.2); padding-left: 25px; }
}

/* ============================================================
   7. 组件：移动端侧滑抽屉 (Mobile Drawer System)
   ============================================================ */
@media (max-width: 768px) {
    .nav-pc, .pc-only-slogan { display: none !important; }

    .logo-text h1 { font-size: 20px; }
    .logo-text p { display: none; }
    .logo-box img { width: 40px; height: 40px; }
    .logo-section { height: 70px; padding: 0 15px; }
    
    .logo-flex { display: flex; align-items: center; width: 100%; }

    .mobile-toggle {
        display: block; background: none; border: none; font-size: 24px;
        color: var(--fpoew-color-main); cursor: pointer;
        margin-left: auto; padding: 12px; line-height: 1;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-toggle:active { opacity: 0.7; }

    .mobile-overlay {
        display: block; position: fixed; inset: 0;
        background: rgba(0,0,0,0.6); z-index: 1999;
        opacity: 0; visibility: hidden; transition: all 0.3s;
        backdrop-filter: blur(4px);
    }
    .mobile-overlay.is-active { opacity: 1; visibility: visible; }

    .nav-mobile-drawer {
        display: block; position: fixed; top: 0; left: 0; bottom: 0;
        width: 85%; max-width: 320px;
        background: #fff; z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-mobile-drawer.is-active { transform: translateX(0); }

    .drawer-header {
        height: 140px; background: var(--fpoew-color-main); color: #fff;
        display: flex; flex-direction: column; justify-content: center; align-items: center;
        position: relative;
        background-image: radial-gradient(circle at top right, rgba(255,255,255,0.1), transparent 70%);
    }
    .drawer-logo img { width: 60px; height: 60px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3); margin-bottom: 10px; }
    .drawer-logo span { font-weight: bold; font-size: 18px; letter-spacing: 1px; display: block; }
    
    .drawer-close {
        position: absolute; top: 15px; right: 15px;
        background: none; border: none; color: rgba(255,255,255,0.8);
        font-size: 24px; padding: 10px; cursor: pointer;
    }

    .drawer-list { padding: 15px 0; margin: 0; }
    .drawer-list li { border-bottom: 1px solid #f9f9f9; }
    .drawer-list a {
        display: flex; align-items: center; padding: 16px 25px;
        color: #444; font-size: 16px; font-weight: 500; transition: background 0.2s;
    }
    .drawer-list a:active { background-color: #f0f0f0; }
    .drawer-list a i { color: var(--fpoew-color-main); width: 24px; text-align: center; margin-right: 15px; font-size: 18px; opacity: 0.8; }
    
    .drawer-dropdown-toggle { justify-content: space-between; }
    .drawer-dropdown-toggle .arrow { transition: transform 0.3s; font-size: 12px; color: #ccc; margin-right: 0; }
    
    .drawer-dropdown.is-expanded .drawer-submenu { max-height: 500px; border-bottom: 1px solid #eee; }
    .drawer-dropdown.is-expanded .arrow { transform: rotate(90deg); color: var(--fpoew-color-main); }
    .drawer-dropdown.is-expanded > a { color: var(--fpoew-color-main); background-color: #f9fdfb; }
    
    .drawer-submenu {
        max-height: 0; overflow: hidden; transition: max-height 0.4s ease; background: #fcfcfc;
    }
    .drawer-submenu li a { padding-left: 65px; font-size: 14px; color: #666; padding-top: 14px; padding-bottom: 14px; }
}

/* ============================================================
   8. 组件：页脚 (Footer Component)
   ============================================================ */
footer {
    width: 100%; background: #222; color: #bbb;
    padding: 40px 0; margin-top: 50px; text-align: center;
    border-top: 4px solid var(--fpoew-color-main); box-sizing: border-box;
}
.footer-info p { margin: 5px 0; font-size: 14px; line-height: 1.5; }
.copyright-tag { margin-top: 15px; font-size: 13px; color: #777; letter-spacing: 0.5px; }

/* ============================================================
   9. 通用 UI 组件
   ============================================================ */
.page-banner { width: 100%; background-size: cover; background-position: center; }

.card {
    background: var(--fpoew-bg-white); border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); padding: 25px;
    margin-bottom: 20px; border: 1px solid rgba(0,0,0,0.05);
}

.section-title {
    border-bottom: 2px solid #eee; margin-bottom: 20px; padding-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
}
.section-title h3 {
    color: var(--fpoew-color-main); border-left: 5px solid var(--fpoew-color-main);
    padding-left: 10px; margin: 0;
}

.breadcrumb {
    font-size: 14px; color: #888; padding-bottom: 15px;
    border-bottom: 1px solid #eee; margin-bottom: 25px; text-align: right;
}
.breadcrumb span { margin: 0 5px; }
.breadcrumb a:hover { color: var(--fpoew-color-main); }

.loading-spinner {
    padding: 60px; text-align: center; color: var(--fpoew-color-main); font-size: 16px; line-height: 1.6;
}
.loading-spinner i { font-size: 30px; margin-bottom: 15px; display: block; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.pagination {
    margin-top: 40px; text-align: center; display: flex; justify-content: center; gap: 5px; user-select: none;
}
.page-btn {
    display: inline-block; padding: 8px 16px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px; color: #555; cursor: pointer; background: #fff; transition: all 0.2s;
}
.page-btn:hover, .page-btn.active {
    background: var(--fpoew-color-main); color: #fff; border-color: var(--fpoew-color-main);
}
.page-btn.disabled { color: #ccc; border-color: #eee; cursor: not-allowed; }

/* ============================================================
   10. 侧边栏 (Sidebar)
   ============================================================ */
.sidebar {
    background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden; height: fit-content; margin-bottom: 20px; width: 100%;
}
.sidebar-header {
    background: var(--fpoew-color-main); color: #fff; padding: 20px;
    font-size: 20px; font-weight: bold; text-align: center;
}
.sidebar-menu { padding: 10px 0; margin: 0; }
.sidebar-menu li { list-style: none; }
.sidebar-menu li a {
    display: block; padding: 15px 25px; color: #333; font-size: 15px;
    border-bottom: 1px solid #f5f5f5; position: relative;
}
.sidebar-menu li:last-child a { border-bottom: none; }
.sidebar-menu li a:hover, .sidebar-menu li a.active {
    color: var(--fpoew-color-main); background-color: #f9fdfb; padding-left: 35px;
}
.sidebar-menu li a.active::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px; background: var(--fpoew-color-main);
}

/* ============================================================
   11. 移动端专属修复区 (Mobile Specific Fixes)
   核心：解决布局溢出、卡片撑破等”崩坏”问题
   ============================================================ */
@media (max-width: 768px) {
    /* 强制全站容器不溢出 */
    .container { max-width: 100vw; padding: 0 10px; overflow-x: hidden; }

    /* 强制 Grid 变单列 */
    .main-grid, .main-layout {
        display: flex;
        flex-direction: column;
        padding: 15px 0;
        gap: 15px;
        min-height: auto;
    }

    /* 内页布局：内容区先显示，侧边栏后显示（避免侧边栏占据手机首屏） */
    .main-layout > aside,
    .main-layout > .sidebar { order: 2; }
    .main-layout > main,
    .main-layout > .content-area { order: 1; }

    /* 卡片内边距瘦身 */
    .card, .content-area { padding: 15px; border-radius: 4px; }

    /* 首页双列卡片强制堆叠 (社团/智慧) */
    .card[style*=”grid-template-columns”] {
        display: flex !important;
        flex-direction: column;
        gap: 20px;
    }

    /* 强制图片自适应 */
    .card img { width: 100%; height: auto; border-radius: 4px; }

    /* 侧边栏优化 */
    .sidebar { margin-bottom: 15px; border-radius: 4px; }

    /* 分页优化 */
    .pagination { flex-wrap: wrap; }

    /* 移除不必要的 Hover 效果 (手机无悬停) */
    .news-item a:hover { transform: none; }

    /* 顶部条：隐藏标语，只右对齐显示版本号 */
    #top-bar .flex > span:not(.version-badge) { display: none; }
    #top-bar .flex { justify-content: flex-end; }

    /* Logo 换行修复：消除 logo-section 内的容器双重内边距 */
    .logo-section .container { padding: 0; }
    /* Logo 标题字间距缩小，防止挤出容器 */
    .logo-text h1 { letter-spacing: 0 !important; white-space: nowrap; }

    /* 页脚：移动端缩减内边距，避免撑高 */
    footer { padding: 25px 15px; margin-top: 30px; }
    .copyright-tag { margin-top: 8px; }
}