/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 首页样式 */
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #333;
}

/* 首页body样式 */
body {
    background: 
        radial-gradient(ellipse 800px 400px at 50% 30%, rgba(245, 184, 133, 0.3), transparent),
        radial-gradient(ellipse 600px 300px at 80% 60%, rgba(240, 160, 112, 0.2), transparent),
        radial-gradient(ellipse 700px 350px at 20% 80%, rgba(230, 120, 85, 0.15), transparent),
        linear-gradient(to bottom, #fff 0%, #f5f3f0 20%, #f5f3f0 80%, #fff 100%);
    overflow-x: hidden;
    min-height: 100vh;
}

/* 地图页面body样式 */
body.map-page {
    background-image: url('static/img/BG.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

@media (min-aspect-ratio: 4/3) {
    body.map-page {
        background-image: url('static/img/BG-B.png');
    }
}

/* 头部 */
.header {
    padding: 15px 20px 40px;
    color: white;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to bottom, #ff3e00 0%, #f0a070 50%, #f5b885 80%, rgba(245, 243, 240, 0) 100%);
    z-index: -1;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 12px;
    opacity: 0.9;
}

/* 主图横幅 */
.main-banner {
    margin: -20px 0 20px 15px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.main-banner::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.banner-scroll-container {
    display: flex;
    gap: 12px;
    padding-right: 15px;
}

/**
 * @brief 轮播图项目容器
 * @details 限制最大宽度和高度，防止在移动端显示过大
 */
.banner-item {
    flex: 0 0 280px;
    max-width: 320px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    scroll-snap-align: start;
}

/**
 * @brief 轮播图图片样式
 */
.banner-item img {
    width: 100%;
    height: 150px;
    max-height: 180px;
    object-fit: cover;
    display: block;
    background: #ddd;
}

/* 图标导航 */
.icon-nav {
    background: white;
    margin: 0 15px 15px;
    border-radius: 12px;
    padding: 20px 10px;
}

.icon-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.icon-row:last-child {
    margin-bottom: 0;
}

.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    cursor: pointer;
}

.icon-box {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 6px;
    color: #a73d34;
}

.icon-label {
    font-size: 12px;
    color: #666;
}

/* 内容模块通用样式 */
.section {
    margin: 0 15px 15px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.section-title-icon {
    font-size: 18px;
    color: #a73d34;
}

.more-link {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 党史纵横卡片 */
.card-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-left: -15px;
    margin-right: -15px;
    padding: 0 15px;
}

.card-grid::-webkit-scrollbar {
    display: none;
}

.history-card {
    flex: 0 0 280px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    scroll-snap-align: start;
}

.history-card-img {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #8b7b6f 0%, #6b5f56 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    text-align: center;
    padding: 10px;
}

.history-card-content {
    padding: 10px;
}

.history-card-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.history-card-location {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* 地方志库 */
.archive-banner {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.archive-banner-img {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #8b9ba3 0%, #6b7b83 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    position: relative;
}

.archive-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    text-align: center;
}

.archive-overlay h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.archive-overlay p {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.archive-btn {
    display: inline-block;
    padding: 6px 20px;
    border: 1px solid white;
    border-radius: 20px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

/* 初心课堂 */
.classroom-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.classroom-card {
    background: linear-gradient(135deg, #c84b40 0%, #b43d34 100%);
    border-radius: 12px;
    height: 100px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    padding: 15px;
    color: white;
    box-shadow: 0 4px 12px rgba(196, 74, 63, 0.3);
}

.classroom-card.full-width {
    grid-column: 1 / -1;
}

.classroom-title {
    font-size: 15px;
    font-weight: bold;
    position: relative;
    z-index: 2;
}

.classroom-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 60px;
    height: 60px;
    opacity: 0.3;
    font-size: 50px;
}

.classroom-play-btn {
    position: absolute;
    bottom: 12px;
    left: 15px;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
}

/* 改革新篇 */
.reform-scroll-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-left: -15px;
    margin-right: -15px;
    padding: 0 15px;
}

.reform-scroll-container::-webkit-scrollbar {
    display: none;
}

.reform-card {
    flex: 0 0 300px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    scroll-snap-align: start;
}

.reform-card-img {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #4a5a6a 0%, #3a4a5a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.reform-overlay {
    position: absolute;
    bottom: 15px;
    left: 15px;
    color: white;
}

.reform-overlay h3 {
    font-size: 15px;
    margin-bottom: 3px;
    line-height: 1.4;
}

.reform-overlay p {
    font-size: 12px;
    opacity: 0.9;
}

.reform-btn {
    position: absolute;
    bottom: 5px;
    /* left: 15px; */
    padding: 5px 10px;
    border: 1px solid white;
    border-radius: 20px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* 留出底部导航空间 */
.content-wrapper {
    padding-bottom: 70px;
}

/* 地图页面样式 */
.navigation {
    width: 100%;
    height: 200px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.navigation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('static/img/navigation-background.png');
    background-size: 100% 100%;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: -1;
}

.nav-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20px;
}

.nav-title {
    color: white;
    font-size: 2rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    margin: 0;
}

.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.map {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: transparent;
    z-index: 1;
}

.bottom-info {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: auto;
    height: auto;
    background-image: url('static/img/bottom_bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 60px;
    box-sizing: border-box;
    max-width: calc(100vw - 40px);
    min-height: 180px;
}

.info-content {
    text-align: center;
    color: white;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.base-title {
    font-size: 24px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

.cards-container {
    display: flex;
    gap: 20px;
    padding: 10px 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.cards-container::-webkit-scrollbar {
    height: 8px;
}

.cards-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.cards-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.education-card {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    overflow: hidden;
    min-width: 300px;
    max-width: 350px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.education-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 120px;
    height: 100px;
    object-fit: cover;
    flex-shrink: 0;
}

.card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.default-info {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.panel-header {
    background: #ff9d9d;
    color: white;
    padding: 10px 20px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 0 0 0 0;
}

.panel-header h2 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.close-btn:active {
    transform: scale(0.95);
}

.panel-content {
    flex: 1;
    padding: 15px 20px 20px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    background: #f8f9fa;
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.panel-content::-webkit-scrollbar {
    height: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: #e1e5e9;
    border-radius: 4px;
    margin: 0 20px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #ff9d9d;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #ff9d9d;
}

.site-item {
    flex: 0 0 280px;
    margin: 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #ff9d9d;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
}

.site-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.site-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.site-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.site-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.site-link {
    display: inline-block;
    color: #ff9d9d;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.site-link:hover {
    background: #ff9d9d;
    color: white;
    transform: translateY(-1px);
}

.no-sites {
    width: 100%;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 30px 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1rem;
    color: #666;
}

.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 电脑端适配 */
@media screen and (min-width: 768px) {
    body {
        max-width: 1200px;
        margin: 0 auto;
    }

    /* 主图横幅 - 显示多个轮播图 */
    .main-banner {
        margin: -20px 0 20px 0;
        overflow: visible;
    }

    .banner-scroll-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 20px;
        padding: 0 20px;
    }

    .banner-item {
        flex: none;
        width: 100%;
    }

    .banner-item img {
        height: 250px;
    }

    /* 图标导航 */
    .icon-nav {
        margin: 0 20px 20px;
        padding: 30px 20px;
    }

    .icon-row {
        justify-content: center;
        gap: 60px;
    }

    /* 内容模块 */
    .section {
        margin: 0 20px 20px;
    }

    /* 党史纵横 - 网格布局 */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        overflow: visible;
        scroll-snap-type: none;
        margin: 0;
        padding: 0;
    }

    .history-card {
        flex: none;
        width: 100%;
    }

    .history-card:hover {
        transform: translateY(-5px);
        transition: transform 0.3s ease;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }

    /* 初心课堂 */
    .classroom-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }

    .classroom-card {
        height: 120px;
    }

    .classroom-card:hover {
        transform: translateY(-5px);
        transition: transform 0.3s ease;
        box-shadow: 0 8px 20px rgba(196, 74, 63, 0.4);
    }

    /* 改革新篇 - 网格布局 */
    .reform-scroll-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 20px;
        overflow: visible;
        scroll-snap-type: none;
        margin: 0;
        padding: 0;
    }

    .reform-card {
        flex: none;
        width: 100%;
    }

    .reform-card:hover {
        transform: translateY(-5px);
        transition: transform 0.3s ease;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }

    .reform-card-img {
        height: 180px;
    }

    /* 地方志库 */
    .archive-banner:hover {
        transform: translateY(-5px);
        transition: transform 0.3s ease;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }

    .archive-banner-img {
        height: 180px;
    }

    /* 底部导航在电脑端隐藏或调整 */
    .bottom-nav {
        max-width: 1200px;
        left: 50%;
        transform: translateX(-50%);
    }

    /* 地图页面样式 */
    .map {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .bottom-info {
        left: 10px;
        right: 10px;
        padding: 20px 30px;
        min-height: 160px;
        max-width: calc(100vw - 20px);
    }
        
    .panel-header {
        padding: 12px 16px;
    }
    
    .panel-header h2 {
        font-size: 1.2rem;
    }
    
    .panel-content {
        padding: 16px;
    }
    
    .site-item {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .site-title {
        font-size: 1rem;
    }
    
    .site-description {
        font-size: 0.85rem;
    }
    
    .site-image {
        height: 100px;
    }
    
    .close-btn {
        font-size: 18px;
    }
}

/* 超大屏幕优化 */
@media screen and (min-width: 1024px) {
    .banner-scroll-container {
        grid-template-columns: repeat(3, 1fr);
    }

    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .classroom-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .classroom-card.full-width {
        grid-column: auto;
    }

    .reform-scroll-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    
    .map {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .bottom-info {
        left: 5px;
        right: 5px;
        padding: 15px 20px;
        min-height: 140px;
        max-width: calc(100vw - 10px);
    }
    
    .base-title {
        font-size: 20px;
    }
    
    .education-card {
        min-width: 250px;
        max-width: 280px;
    }
    
    .card-content {
        padding: 12px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .card-description {
        font-size: 11px;
    }
        
    .panel-header {
        padding: 10px 14px;
    }
    
    .panel-header h2 {
        font-size: 1.1rem;
    }
    
    .panel-content {
        padding: 14px;
    }
    
    .site-item {
        padding: 10px;
        margin-bottom: 14px;
    }
    
    .site-image {
        height: 80px;
    }
}

@media (min-width: 1200px) {
    .navigation {
        height: 200px;
    }
    
    .nav-title {
        font-size: 2.5rem;
    }
    
    .map {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .panel-content {
        padding: 25px;
    }
    
    .site-item {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .site-image {
        height: 140px;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
}