/* 移动端优化样式 - 联信装机PWA */

/* 移动端基础调整 */
@media (max-width: 768px) {
    /* 导航栏移动端优化 */
    .navbar {
        padding: 12px 16px;
    }
    
    .nav-container {
        flex-wrap: wrap;
    }
    
    .nav-logo h1 {
        font-size: 18px;
    }
    
    .logo-sub {
        font-size: 10px;
    }
    
    .nav-menu {
        order: 3;
        width: 100%;
        margin-top: 12px;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 8px 12px;
        margin: 0 4px;
    }
    
    .nav-link i {
        margin-right: 4px;
    }
    
    .nav-actions {
        margin-left: auto;
    }
    
    /* 英雄区域移动端优化 */
    .hero-section {
        padding: 40px 20px;
        flex-direction: column;
    }
    
    .hero-content {
        width: 100%;
        text-align: center;
        margin-bottom: 40px;
    }
    
    .hero-badge {
        margin: 0 auto;
    }
    
    .hero-trust {
        justify-content: center;
    }
    
    .hero-blob {
        opacity: 0.25;
    }
    
    .hero-title {
        font-size: 28px;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 16px;
        margin: 12px 0 24px;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 20px;
        margin: 24px 0;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .stat-item h3 {
        font-size: 20px;
    }
    
    .stat-item p {
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .hero-image {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    /* 装机配置器移动端优化 */
    .builder-section {
        padding: 40px 20px;
    }
    
    .builder-container {
        flex-direction: column;
        gap: 24px;
    }
    
    .hardware-selector,
    .config-summary {
        width: 100%;
    }
    
    .selector-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        min-width: 80px;
    }
    
    .hardware-list {
        max-height: 300px;
    }
    
    .hardware-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .hardware-info h4 {
        font-size: 14px;
    }
    
    .hardware-specs {
        font-size: 11px;
    }
    
    .hardware-price {
        font-size: 16px;
    }
    
    /* 配置摘要移动端优化 */
    .config-details {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .config-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .component-header {
        font-size: 13px;
    }
    
    .component-selected {
        font-size: 12px;
    }
    
    .component-price {
        font-size: 14px;
    }
    
    .config-total {
        padding: 16px;
    }
    
    .total-row {
        font-size: 14px;
    }
    
    .grand-total {
        font-size: 18px;
    }
    
    .config-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* 产品区域移动端优化 */
    .products-section {
        padding: 40px 20px;
    }
    
    .products-filter {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 13px;
        flex: 1;
        min-width: 100px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .product-card {
        padding: 16px;
    }
    
    .product-title {
        font-size: 16px;
    }
    
    .product-specs {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 20px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 预设配置移动端优化 */
    .presets-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .preset-card {
        padding: 20px;
    }
    
    /* 页脚移动端优化 */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .footer-section ul {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* 购物车侧边栏移动端优化 */
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .cart-items {
        max-height: 50vh;
    }
    
    /* 触摸优化 */
    button, 
    .btn,
    .nav-link,
    .tab-btn,
    .filter-btn {
        min-height: 44px; /* 最小触摸目标尺寸 */
        touch-action: manipulation;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 滚动优化 */
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 安全区域适配 */
    .navbar,
    .footer {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
    
    .footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .stat-item {
        width: 100%;
        max-width: 200px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .section-header p {
        font-size: 14px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .guide-card,
    .preset-card {
        padding: 16px;
    }
    
    .nav-link {
        padding: 8px;
        font-size: 12px;
    }
    
    .tab-btn {
        padding: 8px;
        font-size: 11px;
    }
}

/* PWA特定样式 */
/* 添加到主屏幕提示 */
.install-btn {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
}

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

/* 离线状态指示器 */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    z-index: 10001;
    display: none;
}

.offline .offline-indicator {
    display: block;
}

/* 加载指示器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 触摸反馈 */
.touch-feedback {
    transition: transform 0.1s, opacity 0.1s;
}

.touch-feedback:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* 滚动条优化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* 防止文本选择 */
.nav-link,
.tab-btn,
.filter-btn,
.btn {
    user-select: none;
    -webkit-user-select: none;
}

/* 移动端字体优化 */
@media (max-width: 768px) {
    body {
        font-size: 15px;
        line-height: 1.5;
    }
    
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .btn-sm {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .btn-lg {
        font-size: 16px;
        padding: 14px 28px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 8px 16px;
    }
    
    .nav-menu {
        margin-top: 8px;
    }
    
    .hero-section {
        padding: 20px;
        min-height: auto;
    }
    
    .builder-container {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
    .install-btn {
        background: #1e40af;
    }
    
    .loading-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .nav-link.active {
        border-bottom: 3px solid currentColor;
    }
}