/* 三栏布局容器 */
.layout {
    display: flex;
    margin-top: 20px;
    min-height: calc(100vh - 84px);
}

/* 左侧导航栏 (Sidebar) - 固定不动 */
.sidebar {
    width: 15%;
    background: #eef5eb;
    padding: 30px 20px;
    border-right: 1px solid #dde7d8;
    border-radius: 10px;
    position: sticky;
    top: 84px;
    align-self: flex-start;
    height: calc(100vh - 104px);
    overflow-y: auto;
    margin-left: 20px;
    flex-shrink: 0;
}

.sidebar h3 {
    font-size: 24px;
    margin-bottom: 24px;
    color: #1f512c;
}

.side-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 侧边栏菜单项 */
.side-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    transition: 0.3s;
    cursor: pointer;
    border-bottom: 1px solid #cde0c5;
}

.side-item:hover {
    transform: translateY(-3px);
    background: #ffffff;
    border-color: #cae2c5;
    box-shadow: 0 10px 24px rgba(0,0,0,0.04);
    border-radius: 10px;
    box-shadow: 0 rgba(0, 0, 0, 0.02) 8px 0;
}

/* 最后一个菜单项无边框 */
.side-item:last-child {
    border-bottom: none;
}

/* 侧边栏图标 */
.side-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
}

/* 侧边栏文字区域 */
.side-item .side-text {
    flex: 1;
}

.side-item h4 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #215630;
}

.side-item p {
    color: #748771;
    line-height: 1.5;
    font-size: 13px;
    margin: 0;
}

/* 右侧滚动区域 (中间内容 + 右侧栏一起滚动) */
.scroll-wrapper {
    flex: 1;
    margin-left: 20px;
    margin-right: 20px;
    display: flex;
    gap: 24px;
    overflow-y: auto;
    height: calc(100vh - 104px);
}

/* 中间主内容区 */
.content {
    flex: 1;
    overflow-y: visible;
    padding: 0 0 24px 0;
    max-width: 100%;
}

/* 右侧栏容器 */
.rightbar {
    width: 30%;
    min-width: 300px;  /* 最小宽度，防止过窄 */
    max-width: 360px;  /* 最大宽度 */
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border-left: none;
    overflow-y: visible;
}

/* 轮播图区域 */
.carousel-section {
    margin-bottom: 34px;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel-slide.active {
    opacity: 1;
}

/* 左右切换按钮 - 默认隐藏，鼠标悬停时显示 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease, background 0.3s;
    opacity: 0;
    pointer-events: none;
}

.carousel-container:hover .carousel-btn {
    opacity: 1;
    pointer-events: auto;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-btn.prev {
    left: 16px;
}

.carousel-btn.next {
    right: 16px;
}

/* 小圆点指示器容器 */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

/* 小圆点样式 */
.carousel-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

/* 当前激活的小圆点 */
.carousel-dots .dot.active {
    width: 24px;
    border-radius: 5px;
    background: #ffffff;
}

/* 通用按钮样式 */
.btn {
    padding: 12px 28px;
    border-radius: 999px;
    border: none;
    font-size: 15px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #45a458;
    color: white;
}

.btn-primary:hover {
    background: #2d8f45;
}

.btn-outline {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
}

/* 内容区块样式 (公益服务/无障碍知识/真实故事) */
.section {
    margin-bottom: 25px;
    padding: 20px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title h3 {
    font-size: 28px;
    color: #214c2d;
}

/* 公益服务区域描述文字 */
.service-description {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
    padding: 0 4px;
}

/* 网格布局 */
.service-grid,
.knowledge-grid,
.story-grid {
    display: grid;
    gap: 20px;
}

.service-grid {
    grid-template-columns: repeat(3, 1fr);
}

.knowledge-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);  /* 三列等宽 */
}

.story-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* 卡片样式 */
.card {
    border-radius: 10px;
    border: 1px solid #e4eee1;
    transition: 0.3s;
    overflow: hidden;
    text-align: center;
    padding: 22px 12px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.card img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
}

.card-body {
    padding: 16px 14px;
}

.card-body h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #215630;
}

.card-body p {
    color: #738270;
    line-height: 1.5;
    font-size: 12px;
    margin: 0;
}

/* 无障碍知识卡片样式 (图片在顶部，文字左对齐) */
.knowledge-grid .card {
    text-align: left;      /* 文字左对齐 */
    padding: 0;            /* 移除内边距，图片顶边 */
}

.knowledge-grid .card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.knowledge-grid .card-body {
    padding: 20px;
}

.knowledge-grid .card-body h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.knowledge-grid .card-body p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

/* 真实故事卡片图片样式 (让图片更大) */
.story-grid .card {
    text-align: left;      /* 文字左对齐，更美观 */
    padding: 0;            /* 移除内边距，图片顶边 */
}

.story-grid .card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}

.story-grid .card-body {
    padding: 18px;
}

.story-grid .card-body h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.story-grid .card-body p {
    font-size: 14px;
    line-height: 1.6;
}

/* 右侧面板背景 */
.rightbar .panel {
    background: #eef5eb;
    border: 1px solid #dde7d8;
    border-radius: 10px;
    padding: 20px 15px;
    margin-bottom: 20px;
}

/* 面板头部 (标题 + 查看更多链接) */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-header .panel-title {
    color: #2b8f43;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 0;
}

.panel-header .more-link {
    color: #37944b;
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
}

.panel-header .more-link:hover {
    text-decoration: underline;
    background: transparent;
    transform: none;
}

/* 右侧面板标题统一颜色 */
.rightbar .panel .panel-title {
    display: flex;
    align-items: center;
    color: #2b8f43;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* 最新动态列表容器 */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 16px; 
    margin-top: 0;
    padding: 0;
}

/* 新闻卡片链接 */
.news-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: auto;
}

/* 最新动态-新闻卡片 */
.news-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #d4e8dc;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.news-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* 图片区域 */
.news-image {
    width: 100%;
    height: auto;  /* 高度自适应 */
    aspect-ratio: 16 / 9;  /* 保持 16:9 比例 */
    overflow: hidden;
    background: #e0e8dc;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文字信息区域 */
.news-info {
    padding: 10px;
    text-align: left;
}

/* 标题 - 限制两行，超出省略 */
.news-title {
    font-size: 12px;
    font-weight: 600;
    color: #1f512c;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 8px;
    text-align: left;
}

.news-title:hover {
    color: #2b7a4b;
    text-decoration: underline;
}

/* 日期 */
.news-date {
    font-size: 11px;
    color: #b0c4aa;
    display: block;
    text-align: left;
}

/* 公益成果数据样式 */
.stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid #d4e2cc;
}

.stat:last-child {
    border-bottom: none;
}

.stat strong {
    font-size: 26px;
    font-weight: 800;
    color: #2b7a4b;
}

.stat span {
    font-size: 14px;
    color: #6d7d6b;
    font-weight: 500;
}

/* 加入我们面板样式 */
.rightbar .panel:last-child p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 13px;
}

.rightbar .panel:last-child .btn {
    width: 100%;
    background:#2f8b57;
    color: white;
    border: none;
    padding: 12px 10px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    /* 让伪元素相对按钮定位，并裁剪溢出内容 */
    position: relative;
    overflow: hidden;
}

/* 悬停效果 */
.rightbar .panel:last-child .btn:hover {
    background: #1f5e3a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 139, 87, 0.3);
}

/* 点击效果 */
.rightbar .panel:last-child .btn:active {
    transform: translateY(1px);
}

/* 脉冲动画 */
.rightbar .panel:last-child .btn.pulse {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 光效划过 */
.rightbar .panel:last-child .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.rightbar .panel:last-child .btn:hover::before {
    left: 100%;
}



/* 右侧标题图标样式 */

.panel-title img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #b9d7b3;
    border-radius: 999px;
}

/* 响应式布局 */
/* 中等屏幕（笔记本 1200px - 1500px） */
@media (max-width: 1500px) {
    .sidebar {
        width: 240px;
    }
    .rightbar {
        width: 300px;
    }
    
    /* 公益服务 - 保持3列，紧凑 */
    .service-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .service-grid .card {
        padding: 14px 6px;
    }
    
    .service-grid .card img {
        width: 45px;
        height: 45px;
    }
    
    /* 无障碍知识 - 也保持3列，紧凑（不换行） */
    .knowledge-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .knowledge-grid .card img {
        height: 120px;  /* 图片从180px缩小到120px */
    }
    
    .knowledge-grid .card-body {
        padding: 10px;  /* 内边距缩小 */
    }
    
    .knowledge-grid .card-body h4 {
        font-size: 13px;  /* 标题缩小 */
        margin-bottom: 5px;
    }
    
    .knowledge-grid .card-body p {
        font-size: 11px;  /* 描述缩小 */
        line-height: 1.3;
        margin-bottom: 5px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        line-clamp: 3;
        overflow: hidden;
    }
    
    /* 统一卡片字体 */
    .card-body h4 {
        font-size: 14px;
    }
    
    .card-body p {
        font-size: 11px;
    }
}

/* 小型笔记本（1200px 以下） */
@media (max-width: 1200px) {
    .sidebar {
        width: 220px;
    }
    .rightbar {
        width: 280px;
    }
}

/* 平板屏幕（900px 以下，隐藏左右侧栏） */
@media (max-width: 900px) {
    .sidebar,
    .rightbar {
        display: none;
    }
    .scroll-wrapper {
        margin-left: 0;
        margin-right: 0;
    }
    .section-title h3 {
        font-size: 24px;
    }
}

/* 手机横屏/小平板 */
@media (max-width: 700px) {
    .left-group span {
        display: none;
    }
    .service-grid,
    .knowledge-grid,
    .story-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .section {
        padding: 12px;
    }
    .card-body h4 {
        font-size: 15px;
    }
    .card-body p {
        font-size: 12px;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .daohang {
        gap: 8px;
    }
    .daohang a {
        font-size: 14px;
        padding: 4px 8px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    .section-title h3 {
        font-size: 20px;
    }
}