/* resource_sharing_site/public/css/style.css (包含终极修复的完整版) */
/* --- 首页英雄区域 (时钟和搜索框) 样式 (最终修复版 V4 - Flexbox方案) --- */
.hero-section {
    padding: 40px -1px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf3 100%);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.hero-content {
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.clock-container {
    font-size: 3rem;
    font-weight: 300;
    color: #4a4a4a;
    letter-spacing: 2px;
    margin-bottom: 15px;
    font-family: 'Helvetica Neue', sans-serif;
}

.hero-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #777;
    margin: 10px 0 A30px 0;
}

.search-bar-wrapper {
    max-width: 650px;
    margin: 0 auto;
}

/* ‼️ 全新的、基于Flexbox的搜索框CSS，更简单可靠 ‼️ */
.hero-search-form {
    display: flex; /* 关键：使用Flexbox布局 */
    gap: 10px;     /* 关键：设置输入框和按钮之间的间距 */
    align-items: center; /* 垂直居中 */
}

.hero-search-form input {
    flex-grow: 1; /* 关键：让输入框占据所有剩余空间 */
    height: 52px;
    border-radius: 10px;
    border: 1px solid #ddd;
    padding: 0 20px;
    font-size: 16px;
    box-sizing: border-box;
    transition: all 0.3s;
}
.hero-search-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
    outline: none;
}

.hero-search-form button {
    flex-shrink: 0; /* 关键：防止按钮被压缩 */
    height: 52px;
    width: 100px; /* 按钮宽度 */
    border-radius: 10px;
    border: none;
    background: linear-gradient(45deg, #4A90E2, #007bff);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}
.hero-search-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(74, 144, 226, 0.5);
}

.section-title {
    text-align: left !important;
    font-size: 28px !important;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}
/* --- 基础与通用样式 --- */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; padding: 0; background-color: #f4f6f8; color: #333; }
/* 替换旧的 .container 规则 */
.container {
    width: 90%; /* 在小屏幕上保留边距 */
    max-width: 1600px; /* ‼️ 关键修改：大大增加最大宽度 ‼️ */
    margin: 0 auto; /* 保持水平居中 */
    padding: 0 15px; /* 增加左右内边距，防止内容贴边 */
    box-sizing: border-box;
}
header { background-color: #fff; color: #333; padding: 10px 0; border-bottom: 1px solid #e9ecef; box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: sticky; top: 0; z-index: 1000; }
header .container { display: flex; justify-content: space-between; align-items: center; }
.logo a { color: #007bff; text-decoration: none; font-size: 24px; font-weight: bold; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; }
nav ul li { margin-left: 20px; }
nav ul li a { color: #555; text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 6px; transition: background-color 0.2s ease, color 0.2s ease; }
nav ul li a:hover { background-color: #f1f3f5; color: #000; }
main { padding: 20px 0; min-height: 70vh; }
main > .container > h1 { font-size: 28px; margin-bottom: 30px; font-weight: 600; color: #343a40; }
/* --- 页脚 (Footer) 新样式 --- */
.site-footer {
    background-color: #343a40; /* 深色背景 */
    color: #adb5bd;      /* 柔和的文字颜色 */
    padding: 40px 0;
    margin-top: 60px;
    font-size: 14px;
    line-height: 1.8;
}
.site-footer .container {
    text-align: center;
}
.footer-links {
    margin-bottom: 20px;
}
.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    margin: 0 15px;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: #ffffff;
}
.footer-copyright {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px; /* 行间距 */
}
.footer-copyright span {
    display: inline-block;
}
.icp-info a, .police-beian a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.2s;
}
.icp-info a:hover, .police-beian a:hover {
    color: #ffffff;
}
.police-beian a {
    display: inline-flex;
    align-items: center;
    gap: 5px; /* 图标和文字的间距 */
}
.police-beian img {
    width: 18px;
    height: 18px;
    vertical-align: middle; /* 确保图标和文字垂直对齐 */
}
footer a { color: #fff; text-decoration: none; }
form { background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); max-width: 500px; margin: 30px auto; }
form h2 { text-align: center; margin-bottom: 25px; color: #333; }
form div { margin-bottom: 15px; }
form label { display: block; margin-bottom: 8px; font-weight: bold; }
form input[type="text"], form input[type="password"], form input[type="email"], form input[type="number"], form textarea, form select { width: 100%; padding: 12px 15px; border: 1px solid #ced4da; border-radius: 6px; font-size: 16px; box-sizing: border-box; }
form input[type="submit"], .button { background-color: #007bff; color: white; padding: 12px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: bold; width: 100%; box-sizing: border-box; text-align: center; display: inline-block; text-decoration: none; transition: background-color 0.2s ease; }
form input[type="submit"]:hover, .button:hover { background-color: #0056b3; }
.message { padding: 15px; margin-bottom: 20px; border-radius: 6px; font-weight: bold; text-align: center; }
.message.success { background-color: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.message.error { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.resource-detail { background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); margin-top: 30px; display: flex; flex-wrap: wrap; gap: 30px; }
.resource-detail .image-box { flex: 1 1 400px; }
.resource-detail .image-box img { width: 100%; height: auto; border-radius: 8px; border: 1px solid #eee; }
.resource-detail .info-box { flex: 2 1 500px; }
.resource-detail h1 { margin-top: 0; font-size: 32px; color: #333; }
.resource-detail .price { font-size: 28px; font-weight: bold; color: #e44d26; margin-bottom: 20px; }
.resource-detail .description { line-height: 1.8; color: #555; margin-bottom: 20px; word-wrap: break-word; }
.resource-detail .description img { max-width: 100% !important; width: auto !important; height: auto !important; border-radius: 8px; margin-top: 10px; margin-bottom: 10px; display: block; }
.resource-detail .actions { margin-top: 20px; }
.resource-detail .actions a { display: inline-block; width: auto; padding: 12px 25px; margin-right: 15px; }

/* 
 * ===================================================================
 *  首页网格卡片UI (Grid Card UI) - 最新版
 * ===================================================================
*/
.category-nav { background-color: #fff; padding: 10px 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 30px; text-align: center; }
.category-nav ul { list-style: none; padding: 0; margin: 0; display: inline-flex; flex-wrap: wrap; gap: 5px; }
.category-nav a { display: block; padding: 8px 18px; color: #333; text-decoration: none; border-radius: 20px; font-weight: 500; transition: all 0.2s ease-in-out; }
.category-nav a:hover { background-color: #f0f0f0; color: #000; }
.category-nav a.active { background-color: #007bff; color: #fff; box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3); }

.resource-grid {
    display: grid;
    /* 核心修改：在不同屏幕宽度下，设置不同的列数 */
    grid-template-columns: repeat(5, 1fr); /* 默认5列 */
    gap: 25px;
}

/* --- 增加媒体查询，用于响应式适配 --- */

/* 当屏幕宽度小于 1400px 时，变成4列 */
@media (max-width: 1400px) {
    .resource-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 当屏幕宽度小于 1100px 时，变成3列 */
@media (max-width: 1100px) {
    .resource-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 当屏幕宽度小于 800px 时，变成2列 */
@media (max-width: 800px) {
    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 当屏幕宽度小于 500px 时，变成1列 */
@media (max-width: 500px) {
    .resource-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}
.resource-card-grid { background-color: #fff; border-radius: 12px; border: 1px solid #e9ecef; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; flex-direction: column; overflow: hidden; }
.resource-card-grid:hover { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); border-color: transparent; }

/* ‼️ 首页卡片图片强制样式 ‼️ */
.card-image { position: relative; overflow: hidden; }
/* ‼️‼️ 这是最终的、兼容性最强的解决方案 ‼️‼️ */

/* 1. 修改图片容器 a 标签的样式 */
.card-image a {
    display: block;
    position: relative; /* 关键：设置为相对定位，作为内部图片的定位参考 */
    width: 100%;
    /* 关键：使用 padding-top 来撑开一个16:10的比例高度 */
    /* (10 / 16) * 100% = 62.5% */
    padding-top: 62.5%; 
    background-color: #f4f6f8; /* 图片加载前的占位背景色 */
}

/* 2. 修改图片 img 标签的样式 */
.card-image img {
    position: absolute; /* 关键：设置为绝对定位，脱离文档流 */
    top: 0;
    left: 0;
    width: 100% !important;     /* 强制宽度填满容器 */
    height: 100% !important;    /* 强制高度填满容器 */
    object-fit: cover !important; /* 强制图片不变形地裁剪填充 */
    transition: transform 0.4s ease;
}
.resource-card-grid:hover .card-image img { transform: scale(1.05); }

.card-content { padding: 15px 20px 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card-title { font-size: 17px; font-weight: 600; margin: 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; min-height: 48px; }
.card-title a { color: #333; text-decoration: none; transition: color 0.2s ease; }
.card-title a:hover { color: #007bff; }
.card-description { font-size: 14px; color: #777; margin: 10px 0 15px; line-height: 1.6; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 1px solid #f1f1f1; }
.card-meta { font-size: 13px; color: #999; display: flex; align-items: center; gap: 6px; }
.card-meta svg { width: 16px; height: 16px; stroke: #aaa; stroke-width: 1.5; }
/* --- 详情页新布局样式 --- */
.resource-page-layout {
    display: flex;
    gap: 30px;
    max-width: 1600px; /* 匹配容器最大宽度 */
    margin: 0 auto;
    padding: 0 15px;
}
.resource-main-content {
    flex: 1;
    min-width: 0; /* 防止被内部宽内容撑开 */
}
.resource-sidebar {
    flex-basis: 350px; /* 侧边栏固定宽度 */
    flex-shrink: 0;
}

/* 元数据条 */
.meta-bar { display: flex; gap: 20px; color: #888; font-size: 14px; margin-bottom: 25px; }
.meta-bar a { color: #007bff; text-decoration: none; }
.meta-bar a:hover { text-decoration: underline; }

/* 固定声明 */
.fixed-statement { background: #fff8e1; border-left: 4px solid #ffc107; padding: 20px; margin-bottom: 30px; border-radius: 4px; }
.fixed-statement ol { padding-left: 20px; margin: 0; line-height: 1.8; color: #555; }

/* 详情和标签盒子 */
.description-box, .tags-box { background: #fff; padding: 30px; border-radius: 8px; margin-bottom: 30px; }
.description-box h2, .tags-box h2 { margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.description-content { line-height: 1.9; }
.description-content img { max-width: 100% !important; height: auto !important; border-radius: 8px; }

/* 标签列表 */
.tags-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-item { background: #f1f3f5; color: #555; padding: 5px 12px; border-radius: 4px; text-decoration: none; font-size: 14px; transition: all 0.2s; }
.tag-item:hover { background: #e9ecef; color: #000; }

/* --- 侧边栏样式 --- */
.sidebar-widget { background: #fff; padding: 25px; border-radius: 8px; margin-bottom: 30px; }
.sidebar-widget h3 { margin-top: 0; font-size: 18px; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 20px; }

/* 购买卡片 */
.purchase-card .price-display { text-align: center; margin-bottom: 20px; }
.purchase-card .amount { font-size: 42px; font-weight: bold; color: #e44d26; }
.purchase-card .currency { font-size: 18px; color: #e44d26; margin-left: 5px; }
.purchase-card .purchase-info { list-style: none; padding: 0; margin: 0 0 25px 0; }
.purchase-card .purchase-info li { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: #666; }
.purchase-card .purchase-info li strong { color: #333; }
.purchase-card .button { width: 100%; text-align: center; font-size: 18px; padding: 15px; }
.btn-download { background-color: #28a745; }
.btn-purchase { background-color: #007bff; }

/* 最新发布推荐 */
.latest-posts ul { list-style: none; padding: 0; margin: 0; }
.latest-posts li a { display: flex; align-items: center; gap: 15px; text-decoration: none; padding: 10px 0; border-bottom: 1px dashed #f0f0f0; }
.latest-posts li:last-child a { border-bottom: none; }
.latest-posts img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.latest-posts span { color: #333; font-size: 14px; line-height: 1.5; transition: color 0.2s; }
.latest-posts li a:hover span { color: #007bff; }
/* --- 登录/注册弹窗样式 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    position: relative;
    width: 100%;
    max-width: 420px;
    transform: scale(0.9);
    animation: scaleIn 0.3s forwards;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); } to { transform: scale(1); } }

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: #333; }

.modal-content form {
    margin: 0;
    padding: 0;
    box-shadow: none;
    max-width: none;
}
.modal-content form h2 { margin-top: 0; }
.modal-switch { text-align: center; font-size: 14px; margin-top: 20px; }
/* --- 会员中心样式 (最终修复版) --- */
.user-center-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
.user-sidebar {
    flex-basis: 280px;
    flex-shrink: 0;
}
.user-content {
    flex-grow: 1;
    min-width: 0;
}

/* 左侧菜单 */
.user-info-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}
.user-info-card h4 { margin: 0 0 5px 0; font-size: 18px; }
.user-info-card p { margin: 0; color: #888; font-size: 14px; }

.user-menu { background: #fff; border-radius: 8px; padding: 10px; }

/* ‼️ 这是核心修改 ‼️ */
.user-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;          /* 将 ul 设为 flex 容器 */
    flex-direction: column; /* ‼️ 关键：设置主轴方向为垂直 ‼️ */
    gap: 5px;               /* 使用 gap 来设置菜单项之间的间距 */
}

/* li 不再需要 margin-bottom */
.user-menu ul li {
    /* 移除之前的 margin-bottom */
}

.user-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    text-decoration: none;
    color: #333;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s; /* 平滑过渡 */
}
.user-menu a i { width: 20px; text-align: center; color: #888; transition: color 0.2s; }
.user-menu a:hover { background-color: #f8f9fa; }
.user-menu a.active { background-color: #007bff; color: #fff; }
.user-menu a.active i { color: #fff; }


/* --- 右侧内容 (保持不变) --- */
.user-content h2 {
    margin-top: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}
.content-box {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
}
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th, .orders-table td { padding: 15px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.orders-table th { background-color: #f8f9fa; font-weight: 600; }
.order-item { display: flex; align-items: center; gap: 15px; text-decoration: none; color: #333; }
.order-item img { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; }
.order-item span { font-weight: 500; }
.btn-download-small { padding: 6px 12px; font-size: 13px; background-color: #28a745; width: auto; }
.user-center-form { max-width: 500px; margin: 0; padding: 0; box-shadow: none; }
/* --- 会员功能相关样式 --- */
/* 会员购买页 */
.membership-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.plan-card { background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); text-align: center; padding: 30px; transition: all 0.3s; }
.plan-card:hover { transform: translateY(-10px); box-shadow: var(--card-hover-shadow); }
.plan-header h3 { font-size: 22px; margin: 0 0 10px; }
.plan-price { margin: 20px 0; }
.plan-price sup { font-size: 24px; top: -20px; }
.plan-price span { font-size: 16px; color: #888; }
.plan-features { list-style: none; padding: 0; margin: 30px 0; text-align: left; }
.plan-features li { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.plan-features .fa-check-circle { color: var(--success-color); }
.plan-footer .button { width: 100%; }

/* 详情页侧边栏 */
.original-price { text-decoration: line-through; color: #999; font-size: 16px; margin-left: 10px; }
.membership-info-box { background: linear-gradient(45deg, #f39c12, #f1c40f); color: #fff; padding: 15px; border-radius: 8px; text-align: center; margin-top: 20px; }
.membership-info-box .fa-crown { margin-right: 8px; }
.membership-promo { text-align: center; margin-top: 20px; }
.membership-promo a { font-weight: bold; }
/* --- 顶部二级导航样式 (最终布局/交互修复版) --- */
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-left {
    display: flex;
    align-items: center;
}
.main-nav {
    margin-left: 20px;
}
.main-nav ul, .user-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}
.main-nav ul li, .user-nav ul li {
    margin-left: 15px;
}
.main-nav ul li:first-child, .user-nav ul li:first-child {
    margin-left: 0;
}
.main-nav ul li a, .user-nav ul li a {
    color: #555; text-decoration: none; font-weight: 500;
    padding: 8px 12px; border-radius: 6px; display: flex; align-items: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.main-nav ul li a .fa-angle-down { font-size: 12px; margin-left: 5px; }

/* ‼️ 全新的、更可靠的下拉菜单交互CSS ‼️ */
.dropdown-li {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    padding: 10px;
    list-style: none;
    min-width: 180px;
    z-index: 1100;

    /* 关键修改：使用 opacity 和 visibility 控制显隐 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.dropdown-li:hover > .dropdown-menu {
    /* 悬停时，让菜单变得可见和不透明 */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu li a {
    width: 100%;
    padding: 10px 15px;
    box-sizing: border-box;
    border-radius: 6px;
    white-space: nowrap;
}
.dropdown-menu li a:hover {
    background-color: #f0f4f8;
    color: var(--primary-color);
}

/* ===================================================================
 *  追加样式：首页卡片上的分类标签
 * =================================================================== */

.card-content {
    position: relative; /* 设置为相对定位，作为标签定位的参考 */
}

.card-category-tag {
    display: inline-block; /* 确保可以设置内外边距 */
    position: absolute;    /* 绝对定位 */
    top: -12px;            /* 向上移动，一半在卡片内，一半在卡片外 */
    right: 20px;           /* 定位到内容区的右上角 */
    
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-color);
    background-color: #fff; /* 白色背景 */
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary-color); /* 带有主题色的边框 */
    z-index: 2; /* 确保在图片之上 */
}

/* 调整卡片标题的上边距，为标签留出空间 */
.card-title {
    margin-top: 15px;
}
/* 响应式适配 */
@media (max-width: 992px) {
    .resource-page-layout { flex-direction: column; }
    .resource-sidebar { flex-basis: auto; }
}