/* 顶部Header区域 - 精确还原原站结构（高度140px，与inner容器一致） */
.header {
    /* background-color: #f5f5f5;
    background-image: url('../images/opacity.png');
    background-repeat: repeat;
    background-position: 0 0; */
    background: #FFF url(images/sprite.png) repeat-x 0 0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    height: 140px; /* 与inner容器高度一致，确保完全包含inner内容 */
    width: 100%;
    overflow: visible; /* 允许内容正常显示 */
    display: flex;
    justify-content: center;
    align-items: center;
}

.header .inner {
    position: relative;
    width: 100%;
    max-width: var(--container-width);
    height: 140px;
    margin: 0 auto;
    /* margin-left: 23px; */
    padding: 0 15px;
    box-sizing: border-box;
    background-color: transparent; /* inner容器背景透明，继承header的背景 */
}

/* Logo区域 - 绝对定位：top=30px, left=53px, width=300px, height=80px */
.header .lbox {
    position: absolute;
    top: 30px;
    left: 0px;
    /* width: 300px;
    height: 80px; */
}

.header .logo {
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.header .logo a {
    font-size: 0;
    font-weight: bold;
    color: #004E89;
    text-decoration: none;
    line-height: 1;
    display: block;
    width: 1000px;
    /* height: 80px; */
    position: relative;
    overflow: hidden;
    transform: translateX(-65px);
}

.header .logo a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
    display: block;
}

/* 标语区域 - 绝对定位：top=0px, left=398px, width=480px, height=130px */
.header .slogan {
    position: absolute;
    top: 0;
    left: 398px;
    width: 480px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

.header .slogan img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 右侧按钮区域 */
.header .header-right {
    position: absolute;
    top: 15px;
    right: 40px;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    justify-content: space-between;
    height: 80%;
}
.header .header-right .tool-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.header .header-right .user-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: #1C8CEB;
    padding: 2px 10px;
    border-radius: 4px;
    color: #fff;
}

.share-btn, .rss-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
    background-color: #666;
    color: #fff;
}
.share-btn .img, .rss-btn .img {
    width: 20px;
    height: 20px;
}

/* .icon-share::before { content: url('./images/header/icon-share.png'); }
.icon-rss::before { content: url('./images/header/icon-rss.png'); } */

/* 主导航栏 */
.main-nav {
    background-color: #004E89;
    position: static;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block;
    width: 100%;
    clear: both;
}

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.nav-list li {
    margin: 0;
}

.nav-list li a {
    display: block;
    padding: 16px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.3s;
}

.nav-list li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-list li.active a {
    background-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-weight: 600;
}

.nav-search {
    padding: 0 20px;
}

.search-icon {
    color: #fff;
    font-size: 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: background-color 0.3s;
    border-radius: 4px;
}

.search-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.icon-search::before { content: "🔍"; }

/* 搜索下拉面板 */
.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 320px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    z-index: 10000;
    padding: 15px;
}

.search-dropdown.active {
    display: block;
}

body.dark .search-dropdown {
    background: #2d2d2d;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.search-form {
    display: flex;
    gap: 10px;
    position: relative;
}

.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    background: transparent;
}

body.dark .search-form input {
    border-color: #444;
    color: #fff;
}

.search-form button {
    padding: 8px 15px;
    background: #004E89;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Header粘性定位样式 */
.header {
    position: static;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-level-1);
}

body.dark .header {
    background-color: rgba(45, 45, 45, 0.9);
}

.main-container {
    /* padding-top: 20px; */
    /* padding-bottom: 40px; */
    display: flex;
    /* gap: 30px; */
    position: relative;
    clear: both;
    width: 100%;
    min-height: calc(100vh - 140px - 60px - 180px);
    overflow-y: auto;
}
.left-box {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.content-left {
    flex: 1;
    min-width: 0; /* 防止flex子元素溢出 */
    width: auto;
}

.content-left.fl {
    float: left;
    width: calc(100% - 370px); /* 减去侧边栏宽度和间距 */
    max-width: 1104px; /* 精确匹配原站宽度 */
}

.sidebar {
    width: 340px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 20px);
    align-self: flex-start;
}

.sidebar.fr {
    float: right;
}

.footer {
    background-color: #333;
    color: #ccc;
    padding: 40px 0;
    margin-top: 40px;
}

.footer a {
    color: #eee;
    text-decoration: none;
}

.footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

/* Header响应式适配 */
@media (max-width: 1200px) {
    .header {
        height: auto;
        padding: 15px 0 10px;
    }
    
    .header .inner {
        width: 100%;
        max-width: 960px;
        margin: 0 auto;
        padding: 0 15px;
        height: auto;
        min-height: auto; /* clear min-height */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .header .lbox {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: 200px; /* reasonable logo width */
        height: auto;
        margin-bottom: 10px;
        display: flex;
        justify-content: center;
    }
    
    .header .logo a {
        width: 100%;
        height: auto;
        min-height: auto;
        transform: none; /* clear negative translate */
    }
    
    .header .slogan {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: 250px;
        height: auto;
        margin-bottom: 0px;
    }
    
    .header .header-right {
        display: none; /* normally hidden on mobile */
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 0 8px;
    }
    .header .inner {
        padding: 0 15px;
    }
    .header .lbox {
        max-width: 150px; /* smaller logo on phone */
        margin-bottom: 8px;
    }
    .header .logo a img {
        max-width: 100%;
        height: auto;
    }
    .header .slogan {
        max-width: 200px;
    }
    .header .slogan img {
        width: 100%;
        height: auto;
    }
}

/* 响应式适配 */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .content-left {
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
}
/* 移动端响应式 */
@media (max-width: 768px) {
    .top-header .container {
        flex-wrap: wrap;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }
    
    .site-tagline {
        font-size: 12px;
    }
    
    .main-nav .container {
        flex-wrap: nowrap;
        display: flex;
        align-items: center;
    }
    
    .m-nav-toggle {
        display: none; /* Hide hamburger toggle completely */
    }
    
    .nav-list {
        display: flex;
        position: static;
        flex: 1;
        width: auto;
        background: transparent;
        flex-direction: row; /* Horizontal tabs */
        box-shadow: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox hide scrollbar */
    }
    
    .nav-list::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Webkit */
    }
    
    .nav-list li {
        width: auto;
        border-top: none;
        flex-shrink: 0; /* Important: don't shrink tabs */
    }
    
    .nav-list li a {
        padding: 12px 15px;
        font-size: 14px;
        white-space: nowrap; /* Prevent text wrap */
    }
    
    .nav-search {
        padding: 0 10px;
        flex-shrink: 0;
    }
    
    .carousel-section {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .recommended-news {
        width: 100%;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .content-left {
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
}
