/* 生态系统服务流样式 - 莫兰迪色系 + 玻璃拟态 */

/* 莫兰迪色系变量 */
:root {
    --morandi-green: #5a7160;      /* 深灰绿 */
    --morandi-blue: #6b7b8c;       /* 灰蓝 */
    --morandi-brown: #8b7355;      /* 米棕 */
    --morandi-beige: #d8c9b5;      /* 米白 */
    --morandi-gray: #a3a9a6;       /* 高级灰 */
    --morandi-light: #f5f1e8;      /* 浅米色背景 */
    --morandi-accent: #7d9b76;     /* 点缀绿 */
}

/* 关键补丁：隐藏旧图表，防止视觉闪烁 */
#visualization-section { 
    display: none; 
}

/* 生态系统服务流主容器 */
.es-flow-section {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--morandi-light) 0%, #ffffff 100%);
    position: relative;
    overflow: hidden;
}

.es-flow-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--morandi-green), transparent);
}

/* 标题样式 */
.es-flow-section .section-title h2 {
    color: var(--morandi-green);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-align: center;
}

.es-flow-section .section-title p {
    color: var(--morandi-gray);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* SVG拓扑流线容器 */
.topology-container {
    max-width: 1200px;
    margin: 0 auto 4rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(139, 115, 85, 0.1);
    box-shadow: 0 8px 32px rgba(90, 113, 96, 0.08);
}

/* 流线图样式 */
.flow-topology {
    display: block;
    margin: 0 auto;
}

/* 节点样式 */
.node {
    fill: white;
    stroke-width: 3;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.node:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
}

.node-theory {
    stroke: var(--morandi-green);
}

.node-method {
    stroke: var(--morandi-blue);
}

.node-policy {
    stroke: var(--morandi-brown);
}

.node-label {
    fill: var(--morandi-green);
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

/* 流动路径 */
.flow-path {
    stroke-width: 2;
    stroke-dasharray: 5,5;
    fill: none;
    opacity: 0.6;
}

.path-1 {
    stroke: var(--morandi-green);
}

.path-2 {
    stroke: var(--morandi-blue);
}

/* 流动粒子 */
.flow-particle {
    fill: var(--morandi-accent);
    filter: drop-shadow(0 0 4px rgba(125, 155, 118, 0.5));
}

/* 三栏莫兰迪玻璃卡片网格 */
.es-flow-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 4rem;
}

/* 玻璃拟态卡片 */
.es-flow-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(90, 113, 96, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.es-flow-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.es-flow-card:hover {
    transform: translateY(-10px);
    box-shadow: 
        0 20px 40px rgba(90, 113, 96, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.es-flow-card:hover::before {
    opacity: 1;
}

/* 卡片颜色主题 */
.card-theory {
    color: var(--morandi-green);
    border-top: 4px solid var(--morandi-green);
}

.card-theory:hover {
    background: rgba(90, 113, 96, 0.05);
}

.card-method {
    color: var(--morandi-blue);
    border-top: 4px solid var(--morandi-blue);
}

.card-method:hover {
    background: rgba(107, 123, 140, 0.05);
}

.card-policy {
    color: var(--morandi-brown);
    border-top: 4px solid var(--morandi-brown);
}

.card-policy:hover {
    background: rgba(139, 115, 85, 0.05);
}

/* 卡片头部 */
.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-header i {
    font-size: 1.8rem;
    opacity: 0.9;
}

.card-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* 卡片内容 */
.card-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.card-content p strong {
    color: inherit;
    font-weight: 600;
}

.card-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #666;
    line-height: 1.5;
}

.card-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: currentColor;
    font-size: 1.2rem;
}

/* 卡片底部 */
.card-footer {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.card-tag {
    background: rgba(0, 0, 0, 0.05);
    color: currentColor;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 学术摘要区 */
.academic-summary {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid rgba(139, 115, 85, 0.1);
    box-shadow: 0 8px 32px rgba(90, 113, 96, 0.08);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    color: var(--morandi-green);
}

.summary-header i {
    font-size: 1.8rem;
}

.summary-header h3 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
}

.summary-content p {
    color: #555;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.summary-content p strong {
    color: var(--morandi-green);
}

/* 引用框 */
.citation-box {
    background: rgba(90, 113, 96, 0.05);
    border-left: 4px solid var(--morandi-green);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 12px 12px 0;
    position: relative;
}

.citation-box i.fa-quote-left {
    color: var(--morandi-green);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: block;
}

.citation-box p {
    font-style: italic;
    color: #555;
    line-height: 1.6;
    margin: 0;
    font-size: 1.1rem;
}

.citation-source {
    text-align: right;
    color: var(--morandi-gray);
    font-size: 0.9rem;
    margin-top: 1rem;
    font-style: italic;
}

/* 研究启示 */
.research-implications h4 {
    color: var(--morandi-green);
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.research-implications ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.research-implications li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    color: #555;
    line-height: 1.6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.research-implications li:last-child {
    border-bottom: none;
}

.research-implications li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--morandi-accent);
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .es-flow-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .flow-topology {
        transform: scale(0.9);
    }
}

@media (max-width: 768px) {
    .es-flow-section {
        padding: 3rem 1rem;
    }
    
    .es-flow-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .topology-container {
        padding: 1.5rem;
        margin-bottom: 3rem;
    }
    
    .flow-topology {
        transform: scale(0.8);
    }
    
    .academic-summary {
        padding: 1.5rem;
    }
    
    .es-flow-section .section-title h2 {
        font-size: 1.8rem;
    }
}

/* 流光边框动画 */
@keyframes borderFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.es-flow-card {
    background-clip: padding-box;
}

.es-flow-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        var(--morandi-green),
        var(--morandi-blue),
        var(--morandi-brown),
        var(--morandi-accent)
    );
    background-size: 400% 400%;
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: borderFlow 3s ease infinite;
}

.es-flow-card:hover::after {
    opacity: 1;
}

/* 最后硬伤修复 */
/* 页脚清理 */
footer ul li:contains("全球生态补偿网络"),
footer a[href*="wri.org"] {
    display: none !important;
}

/* 按钮居中 */
.policy-actions {
    display: flex !important;
    justify-content: center !important;
}
/* 按钮绝对居中 - 微雕修正 */
.policy-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 2rem 0 !important;
    width: 100% !important;
    gap: 1rem !important;
}

/* 确保按钮在移动端也居中 */
@media (max-width: 768px) {
    .policy-actions {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .policy-actions .btn-primary,
    .policy-actions .btn-secondary {
        width: 100% !important;
        max-width: 300px !important;
        margin-bottom: 0.5rem !important;
    }
}

/* =========================================== */
/* 第一步：政策按钮强制居中（Priority 1: Alignment） */
/* =========================================== */

.policy-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 40px 0 !important;
    clear: both !important;
    gap: 1.5rem !important;
}

/* 确保按钮容器内的链接也居中 */
.policy-actions a {
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .policy-actions {
        flex-direction: column !important;
        gap: 1rem !important;
        margin: 30px 0 !important;
    }
    
    .policy-actions a {
        width: 100% !important;
        max-width: 300px !important;
        text-align: center !important;
    }
}

/* =========================================== */
/* 第二步：全站按钮"呼吸感"同步（Priority 2: Aesthetic） */
/* =========================================== */

/* 全站按钮基础样式 - 优雅米白色背景 + 莫兰迪绿文字 */
.policy-actions a,
.case-actions a,
.view-all-btn,
.btn-more,
.btn-secondary,
.btn-primary:not(.btn-full-viz):not(.btn-full-chat):not(.question-btn):not(.btn-send) {
    display: inline-block !important;
    padding: 12px 40px !important;
    background: rgba(248, 249, 250, 0.95) !important;
    color: #5a7d6a !important;
    border-radius: 50px !important;
    border: 1px solid rgba(26, 67, 46, 0.1) !important;
    text-decoration: none !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    text-align: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

/* 悬停状态 - 深邃森林绿背景 + 纯白文字 */
.policy-actions a:hover,
.case-actions a:hover,
.view-all-btn:hover,
.btn-more:hover,
.btn-secondary:hover,
.btn-primary:not(.btn-full-viz):not(.btn-full-chat):not(.question-btn):not(.btn-send):hover {
    transform: translateY(-3px) !important;
    background: #1a432e !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(26, 67, 46, 0.2) !important;
    border-color: #1a432e !important;
}

/* 活动状态 */
.policy-actions a:active,
.case-actions a:active,
.view-all-btn:active,
.btn-more:active,
.btn-secondary:active,
.btn-primary:not(.btn-full-viz):not(.btn-full-chat):not(.question-btn):not(.btn-send):active {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(26, 67, 46, 0.15) !important;
}

/* 焦点状态 */
.policy-actions a:focus,
.case-actions a:focus,
.view-all-btn:focus,
.btn-more:focus,
.btn-secondary:focus,
.btn-primary:not(.btn-full-viz):not(.btn-full-chat):not(.question-btn):not(.btn-send):focus {
    outline: 2px solid rgba(26, 67, 46, 0.3) !important;
    outline-offset: 2px !important;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .policy-actions a,
    .case-actions a,
    .view-all-btn,
    .btn-more,
    .btn-secondary,
    .btn-primary:not(.btn-full-viz):not(.btn-full-chat):not(.question-btn):not(.btn-send) {
        padding: 10px 32px !important;
        font-size: 0.95rem !important;
        width: 100% !important;
        max-width: 280px !important;
    }
}

/* =========================================== */
/* 最后一次精确对齐 - 强效补丁 */
/* =========================================== */

/* 针对最新政策文件的按钮容器执行物理居中 */
.policy-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 40px auto !important;
    padding: 20px 0 !important;
    clear: both !important;
    gap: 1.5rem !important;
    position: relative !important;
    z-index: 10 !important;
}

/* 确保按钮本身也居中 */
.policy-actions a {
    flex-shrink: 0 !important;
    margin: 0 !important;
    min-width: 200px !important;
    text-align: center !important;
}

/* 覆盖任何可能的父容器限制 */
section .policy-actions,
.policy-grid + .policy-actions,
.policy-section .policy-actions {
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .policy-actions {
        flex-direction: column !important;
        gap: 1rem !important;
        margin: 30px auto !important;
        padding: 15px 0 !important;
    }
    
    .policy-actions a {
        width: 100% !important;
        max-width: 300px !important;
    }
}

/* =========================================== */
/* 按钮修正：容器居中 + 按钮定型 */
/* =========================================== */

/* 1. 容器负责居中 */
.policy-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 40px 0 !important;
    gap: 1.5rem !important;
}

/* 2. 按钮负责颜值（缩身回椭圆） */
.policy-actions a,
.view-all-btn {
    width: auto !important;          /* 严禁 100% */
    min-width: 220px !important;     /* 设定一个合适的最小宽度 */
    max-width: 280px !important;     /* 防止它变成长条 */
    padding: 12px 35px !important;
    text-align: center !important;
    display: inline-block !important;
    background: rgba(248, 249, 250, 0.95) !important;
    color: #5a7d6a !important;
    border-radius: 50px !important;  /* 保持完美椭圆 */
    border: 1px solid rgba(26, 67, 46, 0.1) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    flex-shrink: 0 !important;       /* 防止按钮被压缩 */
}

/* 3. 悬停效果 */
.policy-actions a:hover,
.view-all-btn:hover {
    transform: translateY(-3px) !important;
    background: #1a432e !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(26, 67, 46, 0.2) !important;
    border-color: #1a432e !important;
}

/* 4. 移动端优化 */
@media (max-width: 768px) {
    .policy-actions {
        flex-direction: column !important;
        gap: 1rem !important;
        margin: 30px 0 !important;
    }
    
    .policy-actions a,
    .view-all-btn {
        width: 100% !important;      /* 移动端可以全宽 */
        max-width: 300px !important;  /* 但限制最大宽度 */
        min-width: 0 !important;      /* 移除最小宽度限制 */
    }
}

/* 5. 覆盖所有可能的冲突样式 */
.policy-actions a[style*="width"],
.policy-actions a[class*="w-"],
.view-all-btn[style*="width"],
.view-all-btn[class*="w-"] {
    width: auto !important;
    min-width: 220px !important;
    max-width: 280px !important;
}

/* =========================================== */
/* 🚨 全局暴力修正 - 解决按钮截断、文字缺失、底部偏左 */
/* =========================================== */

/* 1. 彻底解决按钮截断（Fix Button Clipping） */
/* 确保卡片底部的操作按钮行不溢出，且文字完整 */
.policy-card-actions,
.card-footer,
.policy-actions-inner {
    display: flex !important;
    gap: 10px !important;
    justify-content: space-between !important;
    padding: 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
}

.policy-card-actions a,
.card-footer a,
.policy-btn,
.policy-actions-inner a {
    flex: 1 !important;              /* 平分空间 */
    white-space: nowrap !important;  /* 严禁文字换行 */
    overflow: visible !important;    /* 确保文字可见 */
    text-align: center !important;
    padding: 8px 5px !important;
    font-size: 14px !important;
    border-radius: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;         /* 防止挤压 */
    max-width: 100% !important;      /* 防止溢出 */
    text-overflow: ellipsis !important;
}

/* 2. 暴力解决底部按钮偏左（Force Center Alignment） */
/* 强制底部'查看全部'容器占据全宽并居中 */
.policy-actions {
    display: block !important;
    width: 100% !important;
    text-align: center !important;   /* 暴力居中法 */
    margin: 50px 0 !important;
    clear: both !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

.policy-actions a {
    display: inline-block !important; /* 配合父级 text-align center */
    width: auto !important;
    min-width: 240px !important;
    max-width: 320px !important;
    padding: 12px 40px !important;
    background: rgba(248, 249, 250, 0.95) !important;
    color: #5a7d6a !important;
    border-radius: 50px !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 悬停效果 */
.policy-actions a:hover {
    transform: translateY(-3px) !important;
    background: #1a432e !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(26, 67, 46, 0.2) !important;
    border-color: #1a432e !important;
}

/* 3. 覆盖所有可能的冲突样式 */
.policy-actions[style*="width"],
.policy-actions[class*="w-"],
.policy-actions a[style*="width"],
.policy-actions a[class*="w-"] {
    width: auto !important;
    min-width: 240px !important;
    max-width: 320px !important;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .policy-actions {
        margin: 40px 0 !important;
    }
    
    .policy-actions a {
        width: 90% !important;
        max-width: 300px !important;
        min-width: 0 !important;
    }
    
    .policy-card-actions,
    .card-footer,
    .policy-actions-inner {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .policy-card-actions a,
    .card-footer a,
    .policy-btn,
    .policy-actions-inner a {
        flex: 1 0 45% !important;
        min-width: 120px !important;
        font-size: 13px !important;
        padding: 6px 4px !important;
    }
}
