/* 页面整体布局 */
html, body {
    height: 100%; /* 确保全屏 */
    margin: 0;
}

/* 新的导航栏样式 */
.head-navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 15px 0;
    position: fixed; /* 改为fixed定位 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* 添加一个占位元素，防止内容被固定导航栏遮挡 */
.head-navbar-placeholder {
    height: 70px; /* 与导航栏高度相同 */
}

.head-navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

.head-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-right: 40px;
}

.head-brand-logo {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.head-brand-text {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.head-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.head-nav-item {
    margin-right: 30px;
}

.head-nav-item.active .head-nav-link {
    color: #3498db;
}

.head-nav-item.active .head-nav-link::after {
    width: 100%;
}

.head-nav-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
    font-size: 15px;
}

.head-nav-link:hover {
    color: #3498db;
}

.head-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #3498db;
    transition: width 0.3s ease;
}

.head-nav-link:hover::after {
    width: 100%;
}

.head-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.head-search-box {
    position: relative;
}

.head-search-input {
    padding: 8px 15px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    width: 200px;
    transition: all 0.3s ease;
}

.head-search-input:focus {
    outline: none;
    border-color: #3498db;
    width: 250px;
}

.head-user-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.head-btn-login, .head-btn-register {
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.head-btn-login {
    color: #3498db;
    border: 1px solid #3498db;
}

.head-btn-register {
    background-color: #3498db;
    color: white;
}

.head-btn-login:hover {
    background-color: #3498db;
    color: white;
}

.head-btn-register:hover {
    background-color: #2980b9;
}

/* 登录后的用户信息样式 */
.head-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.head-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.head-user-avatar:hover {
    border-color: #3498db;
}

.head-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.head-user-profile:hover .head-user-dropdown {
    display: block;
}

.head-dropdown-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2c3e50;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.head-dropdown-item:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.head-dropdown-item i {
    width: 16px;
    text-align: center;
}

.head-dropdown-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 8px 0;
}

.head-user-name {
    font-weight: 500;
    color: #2c3e50;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.head-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}


/* 改變了頭部的高度*/
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.wrapper {
    min-height: 100%; /* 撑满整个页面 */
    display: flex;
    flex-direction: column; /* 使用垂直布局 */
}

.content {
    flex: 1; /* 内容区域占据剩余空间 */
    padding-top: 70px; /* 为固定导航栏留出空间 */
}

.content-margin {
    margin-top: 100px;
}

.footer {
    background-color: #222;
    color: #ccc;
    padding: 30px 20px;
}

.footer a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #fff;
}

.footer h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #fff;
}

.footer .footer-section {
    margin-bottom: 20px;
}

.footer .footer-links a {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 5px;
}

.footer .footer-info {
    font-size: 14px;
    line-height: 1.8;
}

.footer .footer-bottom {
    border-top: 1px solid #444;
    padding-top: 15px;
    margin-top: 15px;
    font-size: 13px;
    text-align: center;
}

/*内容卡片样式*/

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none; /* 去掉链接默认样式 */
    color: inherit; /* 确保文字颜色继承 */
    display: flex;
    flex-direction: column;
    max-width: 300px;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}
.card-content {
    padding: 15px;
    flex-grow: 1;
}
.card-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 10px;
}
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.tag {
    background: #337ab7;
    color: #fff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}
.card-info {
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding: 10px 15px;
}
.free-badge {
    color: #fff;
    background: #5cb85c;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 12px;
}
.not-free-badge {
    color: #fff;
    background: #d9534f;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 12px;
}



/*个人中心开始*/
#sidebar {
    background-color: #2c3e50;
    color: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    padding: 20px 0;
}

#sidebar .menu-section {
    margin-bottom: 25px;
}

#sidebar .menu-title {
    color: #95a5a6;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px 20px 5px;
    margin-top: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#sidebar .nav-link {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #ecf0f1;
    padding: 10px 20px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    margin: 4px 0;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
}

#sidebar .nav-link:hover {
    background-color: #34495e;
    color: #3498db;
    border-left: 3px solid #3498db;
    transform: translateX(5px);
}

#sidebar .nav-link.active {
    background-color: #3498db;
    color: white;
    border-left: 3px solid #2980b9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#sidebar i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

#sidebar .nav-link:hover i {
    transform: scale(1.1);
}

#sidebar .nav-item {
    margin: 4px 0;
    padding: 0 10px;
}

#sidebar .menu-section:first-child {
    margin-top: 0;
}

@media (max-width: 768px) {
    #sidebar {
        margin-top: 20px;
    }
    #sidebar .nav-link {
        padding: 8px 15px;
    }
}

