/* 主样式文件 */
/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: #3498db;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
}

ul {
    list-style: none;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background-color: #2980b9;
    color: #fff;
}

.btn-secondary {
    background-color: #2ecc71;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #27ae60;
    color: #fff;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
    color: #fff;
}

.btn-login {
    background-color: transparent;
    color: #3498db;
    border: 1px solid #3498db;
}

.btn-login:hover {
    background-color: #3498db;
    color: #fff;
}

.btn-register {
    background-color: #3498db;
    color: #fff;
}

.btn-register:hover {
    background-color: #2980b9;
    color: #fff;
}

/* 头部样式 */
.site-header {
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1010;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

.logo a {
    color: #3498db;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.main-nav ul {
    display: flex;
    margin: 0;
    padding: 0;
}

.main-nav ul li {
    margin-right: 30px;
    position: relative;
}

.main-nav ul li a {
    color: #2c3e50;
    font-weight: 600;
    font-size: 17px;
    padding: 10px 0;
    display: block;
    text-decoration: none;
    transition: color 0.3s ease;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: #3498db;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 25px;
    color: #2c3e50;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.dropdown-toggle:hover {
    background-color: #e9ecef;
    color: #3498db;
}

.dropdown-toggle .username {
    margin-right: 8px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-toggle i {
    font-size: 18px;
    margin-left: 5px;
}

.dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    z-index: 1030;
    min-width: 220px;
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.dropdown-menu li {
    margin: 0 !important;
    border-bottom: 1px solid #f1f1f1;
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu li a {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-menu li a:hover {
    background-color: #f8f9fa;
    color: #3498db;
    padding-left: 22px;
}

.dropdown-menu li a i {
    margin-right: 10px;
    width: 16px;
    color: #3498db;
}

/* 用户操作样式 */
.user-actions {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1020;
}

.user-actions .btn {
    margin-left: 10px;
}

.user-actions .dropdown-toggle {
    color: #333;
    font-weight: 500;
}

.user-actions .dropdown-toggle .username {
    margin-right: 5px;
}

.user-actions .dropdown-toggle i {
    font-size: 18px;
}

/* 搜索表单样式 */
.search-form {
    margin-left: 15px;
    position: relative;
}

.search-form input[type="text"] {
    padding: 8px 12px;
    padding-right: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 240px;
    font-size: 14px;
}

.search-form button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: none;
    border: none;
    padding: 0 12px;
    cursor: pointer;
    color: #777;
}

/* 页面主体样式 */
.site-main {
    padding: 30px 0;
}

/* 页面头部样式 */
.page-header {
    background-color: #3498db;
    color: #fff;
    padding: 50px 0;
    margin-bottom: 30px;
    text-align: center;
}

.page-header h1 {
    font-size: 32px;
    margin-bottom: 15px;
}

.page-header p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* 分类区域样式 */
.categories-section {
    margin-bottom: 50px;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 28px;
    color: #333;
}

.section-header p {
    color: #777;
    font-size: 16px;
}

.view-all {
    display: inline-flex;
    align-items: center;
    color: #3498db;
    font-weight: 600;
}

.view-all i {
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.view-all:hover i {
    transform: translateX(5px);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.category-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    color: #333;
    text-decoration: none;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    color: #333;
    text-decoration: none;
}

.category-icon {
    width: 60px;
    height: 60px;
    background-color: #e3f2fd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.category-icon i {
    font-size: 24px;
    color: #3498db;
}

.category-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.category-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.resource-count {
    color: #888;
    font-size: 13px;
}

/* 资源区域样式 */
.latest-resources, .popular-resources {
    margin-bottom: 50px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.resource-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-img {
    height: 180px;
    object-fit: cover;
}

.placeholder-img {
    background-color: #f5f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
}

.placeholder-img i {
    font-size: 48px;
    color: #bdc3c7;
}

.card-body {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.card-title a {
    color: #333;
    text-decoration: none;
}

.card-title a:hover {
    color: #3498db;
    text-decoration: none;
}

.card-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    font-size: 14px;
    color: #777;
}

.stats {
    display: flex;
    gap: 15px;
}

.stats span {
    display: flex;
    align-items: center;
}

.stats i {
    margin-right: 5px;
}

/* 响应式样式 */
@media screen and (max-width: 991px) {
    .header-inner {
        flex-wrap: wrap;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        margin-top: 15px;
    }
    
    .search-form {
        margin-left: 0;
        margin-right: 15px;
    }
    
    .search-form input[type="text"] {
        width: 180px;
    }
}

@media screen and (max-width: 767px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logo {
        margin-bottom: 15px;
    }
    
    .user-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 15px;
    }
    
    .search-form {
        width: 100%;
        margin: 15px 0 0 0;
    }
    
    .search-form input[type="text"] {
        width: 100%;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
}

/* 页脚样式 */
.main-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 10px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background-color: #3498db;
}

.footer-section.about p {
    margin-bottom: 20px;
}

.contact span {
    display: block;
    margin-bottom: 10px;
}

.contact i {
    margin-right: 10px;
}

.socials {
    margin-top: 20px;
}

.socials a {
    display: inline-block;
    width: 35px;
    height: 35px;
    background-color: #3a4a5d;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 35px;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.socials a:hover {
    background-color: #3498db;
    transform: translateY(-3px);
}

.footer-section.links ul li {
    margin-bottom: 10px;
}

.footer-section.links ul li a {
    color: #bdc3c7;
    transition: color 0.3s ease;
}

.footer-section.links ul li a:hover {
    color: #3498db;
    padding-left: 5px;
}

.contact-form .text-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: none;
    background-color: #34495e;
    color: #fff;
    border-radius: 4px;
}

.contact-form .text-input:focus {
    outline: none;
    background-color: #2c3c4c;
}

.contact-form textarea {
    min-height: 100px;
    resize: vertical;
}

.contact-form button {
    width: 100%;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
}

@media screen and (max-width: 767px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .footer-section {
        margin-bottom: 30px;
    }
}

/* 表单样式 */
.form-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.form-text {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 资源详情页样式 */
.resource-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.resource-image {
    flex: 0 0 300px;
}

.resource-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.resource-info {
    flex: 1;
    min-width: 300px;
}

.resource-title {
    font-size: 28px;
    margin-bottom: 15px;
}

.resource-description {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.7;
    white-space: pre-line; /* 保留换行和空格，同时允许自动换行 */
}

.resource-meta {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    font-size: 14px;
}

.resource-meta-item {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.resource-meta-item i {
    width: 20px;
    margin-right: 10px;
    color: #3498db;
}

.resource-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.resource-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.resource-actions .btn i {
    margin-right: 8px;
}

/* 移动菜单切换按钮 */
.mobile-menu-toggle {
    display: none;
}

/* 点赞与收藏按钮样式 */
.btn-like,
.btn-favorite {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 25px;
    color: #555;
    transition: all 0.3s ease;
}

.btn-like:hover,
.btn-favorite:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn-liked {
    background-color: #e1f5fe;
    border: 1px solid #81d4fa;
    border-radius: 25px;
    color: #0288d1;
    transition: all 0.3s ease;
}

.btn-liked:hover {
    background-color: #b3e5fc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-favorited {
    background-color: #fce4ec;
    border: 1px solid #f48fb1;
    border-radius: 25px;
    color: #d81b60;
    transition: all 0.3s ease;
}

.btn-favorited:hover {
    background-color: #f8bbd0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 点赞计数样式 */
.likes-count {
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.likes-count i {
    margin-right: 5px;
    color: #0288d1;
}

/* 消息提示容器样式 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.message-alert {
    margin-bottom: 10px;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* 动作按钮布局 */
.action-buttons-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 15px;
}

.btn-download {
    flex: 1.5;
    padding: 12px;
}

.action-form {
    flex: 1;
}

.btn-like, .btn-liked, .btn-favorite, .btn-favorited {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

/* 全局弹框消息样式 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    width: 300px;
}

.message-alert {
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-alert:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: rgba(0,0,0,0.1);
    animation: countdown 3s linear forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes countdown {
    from { width: 100%; }
    to { width: 0; }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

.alert-success {
    background-color: #4CAF50;
    color: white;
}

.alert-danger {
    background-color: #f44336;
    color: white;
}

.alert-warning {
    background-color: #ff9800;
    color: white;
}

.alert-info {
    background-color: #2196F3;
    color: white;
}

/* 在小屏幕上优化按钮布局 */
@media (max-width: 768px) {
    .action-buttons-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-form {
        width: 100%;
    }
    
    .btn-download, .btn-like, .btn-liked, .btn-favorite, .btn-favorited {
        width: 100%;
    }
    
    .message-container {
        width: 90%;
        left: 5%;
        right: 5%;
    }
} 
