/* =====================================================
   资源分享系统 - 前台科技风样式
   ===================================================== */

/* --- 全局变量 --- */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #0f1535;
    --bg-card: rgba(15, 22, 55, 0.85);
    --accent: #00e5ff;
    --accent-dark: #0091ea;
    --accent-glow: rgba(0, 229, 255, 0.3);
    --text-primary: #e0e6f0;
    --text-secondary: #8892b0;
    --text-muted: #5a6a8a;
    --border-color: rgba(0, 229, 255, 0.15);
    --success: #00e676;
    --danger: #ff5252;
    --warning: #ffd740;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: #fff; text-shadow: 0 0 8px var(--accent-glow); }

/* --- 粒子背景 --- */
#particles-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}

/* --- 页面包装 --- */
.page-wrapper {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* --- 头部 --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
}

.header-inner {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 70px;
}

.site-brand {
    display: flex; align-items: center; gap: 14px;
}

.site-logo {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: bold; color: var(--bg-primary);
    box-shadow: 0 0 20px var(--accent-glow);
    overflow: hidden;
}

.site-logo img {
    width: 100%; height: 100%; object-fit: cover;
}

.site-name {
    font-size: 22px; font-weight: bold;
    background: linear-gradient(135deg, var(--accent), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex; align-items: center; gap: 24px;
    font-size: 13px; color: var(--text-secondary);
}

.header-info .info-item {
    display: flex; align-items: center; gap: 6px;
}

.header-info .info-item .icon {
    font-size: 16px;
}

.weather-info {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 14px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

/* --- 主内容区 --- */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px;
    width: 100%;
}

/* --- 卡片通用样式 --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    border-color: rgba(0, 229, 255, 0.3);
    box-shadow: 0 8px 40px rgba(0, 229, 255, 0.1);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}

.card-header h2 {
    font-size: 18px; color: var(--accent);
    display: flex; align-items: center; gap: 10px;
}

.card-header h2::before {
    content: '';
    width: 4px; height: 20px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-dark));
    border-radius: 2px;
}

.card-body { padding: 24px; }

/* --- 统计卡片（紧凑200x60横向布局）--- */
.stats-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px;
    margin-bottom: 24px;
}

.stats-row .stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0 14px;
    width: 200px;
    flex: 0 0 200px;
    height: 60px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    backdrop-filter: blur(20px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stats-row .stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-dark));
}

.stats-row .stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.12);
}

.stats-row .stat-card .stat-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    line-height: 1;
}

.stats-row .stat-card .stat-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.stats-row .stat-card .stat-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
    line-height: 1.2;
}

.stats-row .stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* 统计卡片可点击筛选 */
a.stat-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.15);
}

/* 当前筛选选中的卡片高亮 */
.stats-row .stat-card.stat-active {
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

.stats-row .stat-card.stat-active::before {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* --- 公告栏（卡片式，醒目黄色边框）--- */
.announcement-card {
    border-color: rgba(255, 215, 64, 0.35);
    margin-bottom: 24px;
}

.announcement-card .card-header {
    background: rgba(255, 215, 64, 0.06);
    border-bottom-color: rgba(255, 215, 64, 0.2);
}

.announcement-card .card-header h2 {
    color: var(--warning);
}

.announcement-card .card-header h2::before {
    background: linear-gradient(to bottom, var(--warning), #ff9100);
}

.ann-body {
    padding: 12px 24px;
    overflow: hidden;
}

.ann-scroll-wrap {
    overflow: hidden;
    position: relative;
}

.ann-scroll-text {
    display: inline-block;
    white-space: nowrap;
    animation: annScroll 20s linear infinite;
}

.ann-scroll-text .ann-item {
    display: inline;
    font-size: 13px;
    color: var(--warning);
    padding: 0 30px;
}

.ann-scroll-text .ann-item::after {
    content: '|';
    color: var(--text-muted);
    margin-left: 30px;
}

.ann-scroll-text .ann-item:last-child::after {
    content: '';
}

@keyframes annScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.announcement-card:hover .ann-scroll-text {
    animation-play-state: paused;
}

/* --- 友情链接（卡片式）--- */
.friendlinks-card {
    margin-top: 24px;
}

.fl-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 24px;
}

.fl-body .fl-item {
    color: var(--text-secondary);
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid rgba(0, 229, 255, 0.15);
    transition: var(--transition);
    font-size: 13px;
}

.fl-body .fl-item:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.08);
}

/* --- 资源表格 --- */
.resource-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.resource-table thead th {
    padding: 8px 8px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 229, 255, 0.03);
    white-space: nowrap;
}

.resource-table tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid rgba(0, 229, 255, 0.05);
}

.resource-table tbody tr:hover {
    background: rgba(0, 229, 255, 0.05);
}

.resource-table tbody td {
    padding: 6px 8px;
    font-size: 13px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* 资源名称列：允许自然换行，不截断 */
.resource-table tbody td:nth-child(2) {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.resource-name {
    font-weight: 500;
    display: block;
    line-height: 1.3;
}

/* 序号列 */
.resource-table .row-num {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
}

.resource-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 229, 255, 0.2);
}

/* 资源类型徽章：免费/付费 */
.price-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
}

.price-free {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.25);
}

.price-paid {
    background: rgba(255, 167, 38, 0.12);
    color: #ffa726;
    border: 1px solid rgba(255, 167, 38, 0.25);
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary) !important;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.download-link:hover {
    box-shadow: 0 4px 15px var(--accent-glow);
    transform: translateY(-1px);
    text-shadow: none;
}

/* --- 分页 --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
    background: transparent;
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 229, 255, 0.05);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: bold;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 4px;
}

/* --- 底部 --- */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    padding: 30px 24px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1400px; margin: 0 auto;
}

.footer-copyright {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.footer-disclaimer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-bottom: 16px;
}

.footer-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.footer-stats .stat-item {
    display: flex; align-items: center; gap: 6px;
}

.footer-stats .stat-item .label {
    color: var(--text-muted);
}

.footer-stats .stat-item .value {
    color: var(--accent);
    font-weight: 600;
}

/* --- 返回顶部 --- */
.back-to-top {
    position: fixed;
    bottom: 30px; right: 30px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px var(--accent-glow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 229, 255, 0.5);
}

/* --- 空状态 --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
}

/* --- 加载动画 --- */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading-spinner::after {
    content: '';
    width: 36px; height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- 动画效果 --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

    .site-name { font-size: 18px; }

    .header-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        font-size: 12px;
    }

    .header-info .info-item {
        font-size: 12px;
    }

    .weather-info {
        padding: 4px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .main-content {
        padding: 16px 12px;
    }

    .stats-row {
        gap: 8px !important;
    }

    .stats-row .stat-card {
        flex: 1 1 calc(50% - 8px) !important;
        width: auto !important;
        height: 54px;
        padding: 0 10px;
        gap: 8px;
    }

    .stats-row .stat-card .stat-icon { font-size: 18px; }
    .stats-row .stat-card .stat-value { font-size: 17px; }
    .stats-row .stat-card .stat-label { font-size: 10px; }

    .card-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .card-header h2 { font-size: 15px; }
    .card-body { padding: 0; }

    /* 手机端：表格转为卡片布局 */
    .resource-table,
    .resource-table thead,
    .resource-table tbody,
    .resource-table th,
    .resource-table td,
    .resource-table tr {
        display: block;
    }

    .resource-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .resource-table tbody tr {
        margin: 8px 12px;
        padding: 12px;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        background: rgba(0, 229, 255, 0.02);
        position: relative;
    }

    .resource-table tbody tr:hover {
        background: rgba(0, 229, 255, 0.04);
    }

    .resource-table tbody td {
        padding: 4px 0;
        font-size: 13px;
        white-space: normal !important;
        display: flex;
        align-items: center;
        gap: 8px;
        border: none;
    }

    /* 序号 + 资源名称行 */
    .resource-table tbody td:nth-child(1) {
        position: absolute;
        top: 12px;
        left: 12px;
        padding: 0;
        font-size: 11px;
        color: var(--text-muted);
        width: auto;
    }

    .resource-table tbody td:nth-child(2) {
        padding-left: 24px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(0, 229, 255, 0.06);
        margin-bottom: 4px;
        width: auto;
        max-width: none;
    }

    .resource-table tbody td:nth-child(2) .resource-name {
        max-width: none;
        white-space: normal;
        font-size: 14px;
    }

    /* 上传时间、上传者、资源分类、资源类型、下载地址：加标签前缀 */
    .resource-table tbody td:nth-child(3)::before { content: '上传时间'; color: var(--text-muted); font-size: 11px; min-width: 50px; }
    .resource-table tbody td:nth-child(4)::before { content: '上传者'; color: var(--text-muted); font-size: 11px; min-width: 50px; }
    .resource-table tbody td:nth-child(5)::before { content: '分类'; color: var(--text-muted); font-size: 11px; min-width: 50px; }
    .resource-table tbody td:nth-child(6)::before { content: '类型'; color: var(--text-muted); font-size: 11px; min-width: 50px; }
    .resource-table tbody td:nth-child(7)::before { content: '下载'; color: var(--text-muted); font-size: 11px; min-width: 50px; }

    .resource-table tbody td:nth-child(7) {
        justify-content: flex-start;
    }

    .resource-name { max-width: none; }

    .download-link {
        padding: 3px 8px;
        font-size: 11px;
    }

    .pagination {
        gap: 4px;
        margin-top: 16px;
    }

    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .footer-stats {
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
    }

    .back-to-top {
        bottom: 20px; right: 16px;
        width: 40px; height: 40px;
        font-size: 16px;
    }

    .announcement-card {
        margin-bottom: 16px;
    }

    .ann-body {
        padding: 10px 16px;
    }

    .ann-scroll-text .ann-item {
        font-size: 12px;
        padding: 0 16px;
    }

    .friendlinks-card {
        margin-top: 16px;
    }

    .fl-body {
        padding: 12px 16px;
        gap: 8px;
    }

    .fl-body .fl-item {
        font-size: 12px;
        padding: 3px 10px;
    }
}

@media (max-width: 480px) {
    .stats-row .stat-card {
        flex: 1 1 calc(50% - 8px) !important;
        width: auto !important;
        height: 50px;
        padding: 0 8px;
        gap: 6px;
    }

    .stats-row .stat-card .stat-value { font-size: 15px; }
    .stats-row .stat-card .stat-icon { font-size: 16px; }

    .site-brand { gap: 8px; }
    .site-logo { width: 34px; height: 34px; font-size: 14px; }
    .site-name { font-size: 16px; }

    .resource-table thead th,
    .resource-table tbody td {
        padding: 6px 6px;
        font-size: 11px;
    }
}
