/* --- 1. 全局变量与重置 (Variables & Reset) --- */
:root {
    --primary-color: #004080;   /* 主色调：深蓝 */
    --nav-bg-start: #003B70;    /* 导航渐变起始色 */
    --nav-bg-end: #005090;      /* 导航渐变结束色 */
    --accent-color: #0056b3;    /* 亮蓝/强调色 */
    --hover-color: #ff6600;     /* 列表悬停色 */
    --highlight-color: #ffaa00; /* 导航高亮金色 */
    --bg-color: #f4f6f9;
    --text-main: #333333;
    --text-light: #666666;
    --border-color: #e9ecef;
    
    /* 核心布局参数 */
    --card-height: 340px;       /* PC端卡片固定高度 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
}

a { text-decoration: none; color: inherit; transition: color 0.3s ease; }
ul { list-style: none; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* --- 2. 头部区域 (Header) --- */
.header {
    background-color: #fff;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo { display: flex; flex-direction: column; }
.logo .university-name { font-size: 18px; color: var(--text-light); letter-spacing: 1px; }
.logo .dept-name { font-size: 32px; font-weight: bold; color: var(--primary-color); line-height: 1.2; }

.search-box {
    display: flex;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    overflow: hidden;
    height: 38px;
}
.search-box input { border: none; padding: 0 15px; width: 240px; outline: none; }
.search-box button {
    background-color: var(--primary-color);
    color: #fff;
    border: none; padding: 0 20px;
    cursor: pointer; font-weight: bold;
}

/* --- 3. 导航栏 (NAV) --- */
.nav-wrapper {
    background: linear-gradient(to right, var(--nav-bg-start), var(--nav-bg-end));
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    width: 100%;
    position: relative;
    z-index: 100;
}

.nav-list {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-item {
    flex: 1;
    text-align: center;
    height: 100%;
    position: relative;
    min-width: 80px; /* 防止过窄 */
}

.nav-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    width: 100%;
    height: 100%;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-item a:hover,
.nav-item a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: bold;
}

.nav-item a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--highlight-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: center;
}

.nav-item a:hover::after,
.nav-item a.active::after {
    transform: scaleX(1);
}

/* --- 4. 主体网格布局 (Home Grid) --- */
.home-grid {
    display: grid;
    /* 核心：三列布局 */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 25px;
    margin-bottom: 40px;
}

/* 卡片通用样式 - 强制高度固定 */
.home-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    height: var(--card-height); /* 固定高度 */
    display: flex;
    flex-direction: column; /* 垂直排列 Header 和 Body */
}

.home-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

/* 轮播图跨两列，高度与其他卡片一致 */
.carousel-card {
    position: relative;
    grid-column: span 2;
    height: var(--card-height);
    border-radius: 8px;
    display: block; /* 轮播图不需要 flex 布局 */
}

.carousel-slides { position: relative; width: 100%; height: 100%; }
.slide {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; opacity: 0;
    transition: opacity 0.6s ease-in-out;
    background-size: cover; background-position: center;
    display: flex; align-items: flex-end;
}
.slide.active { opacity: 1; z-index: 1; }
.slide-content {
    width: 100%; padding: 30px 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;
}
.slide-content h3 { font-size: 22px; margin-bottom: 5px; }
.slide-content p { font-size: 14px; opacity: 0.9; }
.carousel-indicators {
    position: absolute; bottom: 15px; right: 20px; z-index: 2;
    display: flex; gap: 8px;
}
.indicator {
    width: 10px; height: 10px; background: rgba(255,255,255,0.5);
    border-radius: 50%; cursor: pointer; transition: all 0.3s;
}
.indicator.active { background: #fff; width: 25px; border-radius: 5px; }

/* 卡片内部 Header */
.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    border-left: 4px solid var(--primary-color);
    flex-shrink: 0; /* 防止头部被压缩 */
    background: #fff;
}
.panel-title { font-size: 18px; font-weight: bold; color: var(--primary-color); }
.panel-more { font-size: 12px; color: #999; }
.panel-more:hover { color: var(--hover-color); }

/* 卡片内部 Body - 核心：滚动控制 */
.panel-body {
    padding: 10px 20px;
    flex: 1; /* 占据剩余空间 */
    overflow-y: auto; /* 内容过多时垂直滚动 */
    height: 100%; /* 确保撑满容器 */
}

/* 滚动条美化 (Chrome/Safari) */
.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-thumb { background-color: #ddd; border-radius: 3px; }
.panel-body::-webkit-scrollbar-track { background-color: #f1f1f1; }

/* 列表样式 */
.simple-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px dashed #eee;
}
.simple-list li:last-child { border-bottom: none; }
.simple-list a {
    flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 15px; position: relative; padding-left: 12px; color: var(--text-main);
}
.simple-list a::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 4px; background-color: #ccc; border-radius: 50%;
    transition: background-color 0.3s;
}
.simple-list a:hover { color: var(--hover-color); }
.simple-list a:hover::before { background-color: var(--hover-color); }
.simple-list .date { font-size: 12px; color: #999; font-family: Arial; width: 40px; text-align: right; flex-shrink: 0; }
.download-list i { font-style: normal; margin-right: 5px; }

/* --- 5. 底部区域 --- */
.footer {
    background-color: #2d3436; color: #b2bec3; padding: 40px 0;
    text-align: center; border-top: 4px solid var(--accent-color);
}
.footer-content p { margin-bottom: 8px; font-size: 13px; }

/* --- 6. 响应式适配 (Media Queries) --- */

/* 平板/iPad (小于992px) */
@media (max-width: 992px) {
    .home-grid {
        grid-template-columns: repeat(2, 1fr); /* 变为双列 */
    }
    .carousel-card {
        grid-column: span 2; /* 轮播图依然占整行 */
    }
}

/* 手机端 (小于768px) */
@media (max-width: 768px) {
    :root {
        --card-height: 280px; /* 手机端卡片高度稍减 */
    }

    .header-inner { flex-direction: column; text-align: center; }
    .logo { margin-bottom: 15px; }
    
    /* 移动端导航栏：支持横向滑动 */
    .nav-list {
        display: block; white-space: nowrap;
        overflow-x: auto; height: auto; padding: 5px 0;
    }
    .nav-item { display: inline-block; width: auto; }
    .nav-item a { padding: 12px 15px; font-size: 15px; }
    .nav-item a::after { display: none; } /* 移动端去掉底部动画 */

    /* 移动端变为单列布局 */
    .home-grid { display: block; }
    
    /* 卡片间距 */
    .home-card { margin-bottom: 20px; }
    
    /* 轮播图调整 */
    .carousel-card { height: 200px; }
    .slide-content p { display: none; } /* 手机端隐藏轮播文字详情 */
}