/* 新的流程图样式 */
.flow-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8faff 0%, #e8f2ff 100%);
    position: relative;
    overflow: hidden;
}

.flow-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234F46E5' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    pointer-events: none;
}

.flow-container {
    position: relative;
    z-index: 2;
}

/* 选项卡样式 */
.mode-tabs {
    display: flex;
    justify-content: center;
    margin: 3rem 0 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: var(--text-light);
    position: relative;
    overflow: hidden;
}

.tab-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.tab-item:hover::before {
    left: 100%;
}

.tab-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.tab-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.tab-item.active .tab-icon {
    transform: scale(1.1);
}

/* 流程图展示区域 */
.flow-display {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 600px;
    position: relative;
}

.flow-content {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.flow-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 模式头部 */
.mode-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mode-header h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.mode-header p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.mode-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.feature-tag {
    padding: 0.5rem 1rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #667eea;
}

/* 流程图容器 */
.flowchart {
    position: relative;
    min-height: 400px;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.flow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.flow-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawPath 3s ease-in-out forwards;
    marker-end: url(#arrowhead);
}

@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

/* 确保SVG路径可见 */
.flow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: visible;
}

/* 箭头标记样式 */
.flow-svg marker polygon {
    fill: currentColor;
}

/* 连接线动画 */
.flow-connecting-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawConnectingLine 1.5s ease-in-out forwards;
    opacity: 0.9;
}

.flow-connecting-line:nth-child(3) { animation-delay: 0.3s; }
.flow-connecting-line:nth-child(4) { animation-delay: 0.6s; }
.flow-connecting-line:nth-child(5) { animation-delay: 0.9s; }
.flow-connecting-line:nth-child(6) { animation-delay: 1.2s; }
.flow-connecting-line:nth-child(7) { animation-delay: 1.5s; }

/* iframe模式特殊动画 */
.iframe-flow .flow-connecting-line:nth-child(3) { animation-delay: 0.4s; }
.iframe-flow .flow-connecting-line:nth-child(4) { animation-delay: 0.8s; }
.iframe-flow .flow-connecting-line:nth-child(5) { animation-delay: 1.2s; }
.iframe-flow .flow-connecting-line:nth-child(6) { animation-delay: 1.6s; }
.iframe-flow .flow-connecting-line:nth-child(7) { animation-delay: 2.0s; }

/* redirect模式特殊动画 */
.redirect-flow .flow-connecting-line {
    animation-duration: 1s;
}
.redirect-flow .flow-connecting-line:nth-child(3) { animation-delay: 0.2s; }
.redirect-flow .flow-connecting-line:nth-child(4) { animation-delay: 0.4s; }
.redirect-flow .flow-connecting-line:nth-child(5) { animation-delay: 0.6s; }
.redirect-flow .flow-connecting-line:nth-child(6) { animation-delay: 0.8s; }

@keyframes drawConnectingLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* 新的垂直流程步骤容器 */
.flow-steps-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.flow-step-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    padding: 1rem;
    opacity: 0;
    transform: translateX(-30px);
    animation: slideInRight 0.8s ease-out forwards;
}

.flow-step-item:nth-child(1) { animation-delay: 0.2s; }
.flow-step-item:nth-child(2) { animation-delay: 0.4s; }
.flow-step-item:nth-child(3) { animation-delay: 0.6s; }
.flow-step-item:nth-child(4) { animation-delay: 0.8s; }
.flow-step-item:nth-child(5) { animation-delay: 1.0s; }

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 新的水平流程步骤容器 */
.flow-steps-horizontal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    gap: 1rem;
}

.flow-step-horizontal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
    opacity: 0;
    transform: translateY(30px);
    animation: slideInUp 0.8s ease-out forwards;
}

.flow-step-horizontal:nth-child(1) { animation-delay: 0.1s; }
.flow-step-horizontal:nth-child(3) { animation-delay: 0.3s; }
.flow-step-horizontal:nth-child(5) { animation-delay: 0.5s; }
.flow-step-horizontal:nth-child(7) { animation-delay: 0.7s; }
.flow-step-horizontal:nth-child(9) { animation-delay: 0.9s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 连接器箭头 */
.step-connector {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

.step-connector:nth-child(2) { animation-delay: 0.3s; }
.step-connector:nth-child(4) { animation-delay: 0.5s; }
.step-connector:nth-child(6) { animation-delay: 0.7s; }
.step-connector:nth-child(8) { animation-delay: 0.9s; }

/* 步骤内容 */
.step-content {
    flex: 1;
    text-align: left;
}

.flow-step-horizontal .step-content {
    text-align: center;
}

/* 垂直箭头 */
.step-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    text-align: center;
    margin: 0.5rem 0;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

.flow-step-item:nth-child(1) .step-arrow { animation-delay: 0.5s; }
.flow-step-item:nth-child(2) .step-arrow { animation-delay: 0.7s; }
.flow-step-item:nth-child(3) .step-arrow { animation-delay: 0.9s; }
.flow-step-item:nth-child(4) .step-arrow { animation-delay: 1.1s; }

.flow-step-item.last .step-arrow {
    display: none;
}

@keyframes stepAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.step-node {
    width: 80px;
    height: 80px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    position: relative;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.step-node:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.step-node svg {
    width: 24px;
    height: 24px;
}

.step-number {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.step-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.step-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

.flow-step-horizontal .step-title {
    font-size: 1rem;
}

.flow-step-horizontal .step-desc {
    font-size: 0.8rem;
    max-width: 120px;
}

/* iframe模式左右布局 */
.iframe-mode-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 500px;
}

.mode-description {
    padding: 2rem 0;
}

.mode-description h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.mode-description > p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.core-features h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    margin-bottom: 2rem;
}

.feature-list li {
    padding: 0.5rem 0;
    color: var(--text-light);
    font-size: 1rem;
}

.feature-list li::before {
    content: '✓';
    color: #10B981;
    font-weight: bold;
    margin-right: 0.5rem;
}

.tech-highlights {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.highlight-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.highlight-text strong {
    display: block;
    color: var(--text-dark);
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.highlight-text span {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 圆形流程图 */
.circular-flow {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flow-circle {
    position: relative;
    width: 400px;
    height: 400px;
}

.flow-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 3;
}

.center-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.center-desc {
    font-size: 0.9rem;
    color: var(--text-light);
}

.circular-step {
    position: absolute;
    text-align: center;
    z-index: 2;
}

.circular-step .step-node {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    border: 3px solid rgba(79, 70, 229, 0.3);
}

.circular-step .step-title {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* SVG嵌入式流程节点样式 */
.svg-flow-step {
    text-align: center;
    width: 100px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    animation: nodeAppear 0.8s ease-out;
    animation-fill-mode: both;
    padding-top: 10px;
}

/* 节点出现动画 - 依次延迟显示 */
.svg-node-wrapper:nth-child(3) .svg-flow-step { animation-delay: 0.2s; }
.svg-node-wrapper:nth-child(4) .svg-flow-step { animation-delay: 0.4s; }
.svg-node-wrapper:nth-child(5) .svg-flow-step { animation-delay: 0.6s; }
.svg-node-wrapper:nth-child(6) .svg-flow-step { animation-delay: 0.8s; }
.svg-node-wrapper:nth-child(7) .svg-flow-step { animation-delay: 1.0s; }

@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* SVG节点悬停效果 */
.svg-flow-step:hover {
    animation: nodeHover 0.3s ease-in-out;
}

@keyframes nodeHover {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 确保SVG容器固定宽高比 */
.proxy-flow {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    aspect-ratio: 2 / 1; /* 保持2:1的宽高比 */
}

.proxy-flow .flow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* 对不支持aspect-ratio的浏览器的备用方案 */
@supports not (aspect-ratio: 2 / 1) {
    .proxy-flow {
        height: 0;
        padding-bottom: 50%; /* 2:1的宽高比 */
    }
}

/* SVG内部文字样式 */
.svg-flow-step .step-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 2px;
    line-height: 1;
}

.svg-flow-step .step-desc {
    font-size: 0.55rem;
    color: var(--text-light);
    margin-top: 1px;
    line-height: 1;
}

/* 不同模式的特殊样式 */
.proxy-flow .step-node {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.redirect-flow .step-node {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border: 3px solid rgba(79, 172, 254, 0.3);
}

/* 加强流程路径可见性 */
.redirect-flow .flow-connecting-line {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* 箭头标记增强 */
.redirect-flow marker polygon {
    fill: #4facfe;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mode-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tab-item {
        padding: 0.75rem 1.5rem;
        justify-content: center;
    }
    
    .flow-display {
        padding: 1.5rem;
        min-height: 500px;
    }
    
    .flowchart {
        min-height: 400px;
    }
    
    .mode-features {
        gap: 0.5rem;
    }
    
    .feature-tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .mode-header h3 {
        font-size: 1.6rem;
    }
    
    /* iframe模式移动端适配 */
    .iframe-mode-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .flow-circle {
        width: 300px;
        height: 300px;
    }
    
    .mode-description {
        order: 2;
    }
    
    .circular-flow {
        order: 1;
    }
    
    /* 水平流程移动端适配 */
    .flow-steps-horizontal {
        flex-direction: column;
        gap: 2rem;
        max-width: none;
    }
    
    .step-connector {
        transform: rotate(90deg);
        font-size: 1.5rem;
    }
    
    .flow-step-horizontal .step-content {
        text-align: center;
    }
    
    .flow-step-horizontal .step-desc {
        max-width: 200px;
    }
    
    /* 垂直流程优化 */
    .flow-step-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .step-arrow {
        font-size: 1.5rem;
    }
    
    .step-node {
        width: 60px;
        height: 60px;
    }
    
    .step-node svg {
        width: 20px;
        height: 20px;
    }
    
    .step-number {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        top: -6px;
        right: -6px;
    }
    
    .step-title {
        font-size: 0.9rem;
    }
    
    .step-desc {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .flowchart {
        min-height: 350px;
    }
    
    .flow-steps-horizontal {
        gap: 1.5rem;
    }
    
    .step-node {
        width: 50px;
        height: 50px;
    }
    
    .step-node svg {
        width: 16px;
        height: 16px;
    }
    
    .mode-header h3 {
        font-size: 1.4rem;
    }
    
    .step-title {
        font-size: 0.8rem;
    }
    
    .step-desc {
        font-size: 0.75rem;
    }
    
    .step-connector {
        font-size: 1.2rem;
    }
    
    .step-arrow {
        font-size: 1.2rem;
    }
}

/* 动画增强 */
.flow-content.active .flow-path {
    animation: drawPath 3s ease-in-out forwards;
}

.flow-content.active .step-node {
    animation: nodeGlow 3s ease-in-out infinite;
}

@keyframes nodeGlow {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 8px 35px rgba(102, 126, 234, 0.5);
    }
}

/* API对接流程保持原样 */
.api-integration {
    margin-top: 4rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.api-header {
    text-align: center;
    margin-bottom: 2rem;
}

.api-header h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.api-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.api-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: center;
}

.api-step {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.api-step-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.api-step h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.api-step p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* 技术优势 */
.tech-advantages {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tech-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    transition: all 0.3s ease;
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.tech-card-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.tech-card-icon svg {
    width: 32px;
    height: 32px;
}

.tech-card h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.tech-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}