/* 网络优化相关样式 */

/* 加载指示器 */
.loading-translation {
    position: relative;
}

.loading-translation::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #28a745, #007bff);
    background-size: 200% 100%;
    animation: loading-progress 2s infinite;
    z-index: 10000;
}

@keyframes loading-progress {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 慢网络模式优化 */
.slow-network {
    /* 减少动画和过渡效果 */
}

.slow-network * {
    animation-duration: 0.1s !important;
    transition-duration: 0.1s !important;
}

.slow-network .hero-slider .swiper-slide {
    transition: none !important;
}

.slow-network .fade-in,
.slow-network .slide-up,
.slow-network .zoom-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* 图片懒加载占位符 */
img[loading="lazy"] {
    background: #f0f0f0;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* 离线状态样式 */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f44336;
    color: white;
    text-align: center;
    padding: 10px;
    z-index: 10000;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.offline-indicator::before {
    content: '⚠️ ';
    margin-right: 5px;
}

/* 网络状态指示器 */
.network-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.network-status.show {
    opacity: 1;
}

.network-status.fast::before {
    content: '🟢 ';
}

.network-status.slow::before {
    content: '🟡 ';
}

.network-status.offline::before {
    content: '🔴 ';
}

/* 慢网络模式下的图片优化 */
.slow-network img {
    filter: contrast(0.9) brightness(1.1);
}

/* 减少视觉复杂度 */
.slow-network .hero-slider {
    background: #f8f9fa !important;
}

.slow-network .hero-slider .swiper-slide {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* 简化阴影效果 */
.slow-network .card,
.slow-network .product-item,
.slow-network .service-item {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* 禁用复杂的背景 */
.slow-network .hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* 简化导航效果 */
.slow-network .main-nav a:hover {
    transform: none !important;
}

/* 错误状态样式 */
.error-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.error-message::before {
    content: '⚠️ ';
    margin-right: 5px;
}

/* 重试按钮 */
.retry-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background-color 0.2s ease;
}

.retry-button:hover {
    background: #0056b3;
}

.retry-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .slow-network .hero-slider {
        height: 300px !important;
    }
    
    .network-status {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .offline-indicator {
        font-size: 13px;
        padding: 8px;
    }
}

/* 打印样式优化 */
@media print {
    .loading-translation::before,
    .network-status,
    .offline-indicator,
    .error-message {
        display: none !important;
    }
}
