/* ========================================
   Performance & Visual Enhancement CSS
   Created: 2024-12-24
   Purpose: 优化页面性能和视觉效果
   ======================================== */

/* 图片懒加载占位符 */
.lazy-load-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 图片优化 */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 按钮悬停效果增强 */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* 卡片阴影优化 */
.product-card {
    will-change: transform, box-shadow;
}

/* 导航菜单优化 */
.basic-menu li a {
    position: relative;
    transition: color 0.3s ease;
}

.menu-area nav {
    position: relative;
    z-index: 9999;
}

.basic-menu li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #667eea;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.basic-menu li:hover a::after {
    width: 80%;
}

/* 渐变背景优化 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 响应式图片容器 */
.responsive-img-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 比例 */
    overflow: hidden;
}

.responsive-img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 文字对比度增强 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 高对比度链接 */
a {
    color: #333;
    text-decoration: none;
}

a:hover {
    color: #667eea;
}

/* 表单元素对比度 */
input, textarea, select {
    border: 2px solid #ddd;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* 菜单高亮样式 */
.menu-highlight a {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    padding: 8px 20px !important;
    border-radius: 20px;
    font-weight: 700;
}

.menu-highlight a:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
}

/* 项目列表图标样式 */
.project-details li a {
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.project-details li:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(5px);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .call-to-action h3 {
        font-size: 24px !important;
    }
    
    .call-to-action .btn {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .product-card {
        margin-bottom: 20px;
    }
}

/* 打印优化 */
@media print {
    .header-area,
    .footer,
    .call-to-action-area {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* 性能优化：减少重绘 */
* {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* GPU 加速 - 移除产品卡片以避免遮挡弹窗 */
.btn,
.basic-menu li {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* 悬浮CTA按钮 */
.floating-cta {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.floating-cta.show {
    opacity: 1;
    visibility: visible;
}

.floating-cta .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.floating-cta .btn:hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
    transform: translateY(-3px);
}

/* 区块间距优化 */
.section-spacing {
    padding: 80px 0;
}

.section-spacing-sm {
    padding: 50px 0;
}

/* 渐入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

/* 视觉焦点优化 */
:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 代码优化提示标记 */
.optimized {
    position: relative;
}

.optimized::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4caf50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
