/* =============================================
   spraydryerB2B 主题 - 响应式样式
   优化适配 1488px 容器宽度
   ============================================= */

/* ---------- 1520px 以下（小桌面显示器） ---------- */
@media (max-width: 1520px) {
    :root { --container: 1200px; }
    .products-grid { grid-template-columns: repeat(4, 1fr); }
    .suppliers-grid { grid-template-columns: repeat(3, 1fr); }
    .news-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 1200px 以下（平板横屏） ---------- */
@media (max-width: 1200px) {
    :root { --container: 1100px; }
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 1024px 以下（平板） ---------- */
@media (max-width: 1024px) {
    :root { --container: 100%; }
    .section { padding: 60px 0; }
    .hero-title { font-size: 2.5rem; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .archive-layout { grid-template-columns: 220px 1fr; gap: 24px; }
    .suppliers-grid { grid-template-columns: repeat(2, 1fr); }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .product-detail-grid { grid-template-columns: 1fr; gap: 32px; }
    .product-gallery { position: static; }
    .contact-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* ---------- 768px 以下（手机横屏 / 小平板） ---------- */
@media (max-width: 768px) {
    .section { padding: 48px 0; }
    .section-header h2 { font-size: 1.625rem; }
    .hero-section { min-height: auto; padding: 60px 0; }
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-stats { gap: 24px; flex-wrap: wrap; }
    .hero-stat-num { font-size: 1.5rem; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .suppliers-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .archive-layout { grid-template-columns: 1fr; }
    .archive-sidebar { position: static; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .stat-number { font-size: 2rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-brand p { max-width: 100%; }
    .product-detail-section { padding: 24px 0 60px; }
    .product-title { font-size: 1.375rem; }
    .cta-section { padding: 60px 0; }
    .cta-section h2 { font-size: 1.5rem; }
    .archive-controls { flex-direction: column; align-items: flex-start; gap: 12px; }
    .breadcrumb .container { font-size: .8125rem; }
    
    /* 移动端触摸优化 */
    button, 
    .btn, 
    input[type="submit"], 
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    a, button, input, select, textarea {
        font-size: 16px !important; /* 防止 iOS 自动缩放 */
    }
}

/* ---------- 480px 以下（手机） ---------- */
@media (max-width: 480px) {
    .hero-title { font-size: 1.625rem; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { 
        width: 100%; 
        justify-content: center;
        min-height: 48px; /* 增大触摸目标 */
    }
    .hero-stats { flex-direction: column; gap: 16px; }
    .hero-search { flex-direction: column; }
    /* 产品列表页手机端保持两列布局 */
    .products-grid { 
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    .suppliers-grid { grid-template-columns: 1fr; }
    
    /* 隐藏手机端产品列表页的视图切换按钮 */
    .view-toggle {
        display: none !important;
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .modal-content { padding: 24px; }
    .pagination .page-numbers { min-width: 32px; height: 32px; font-size: .8125rem; }
    .error-404 h1 { font-size: 4rem; }
    .product-detail-grid { gap: 24px; }
    .product-actions { flex-direction: column; }
    .product-actions .btn { 
        width: 100%; 
        justify-content: center;
        min-height: 48px;
    }
    
    /* 手机端额外优化 */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* 防止 iOS 自动缩放 */
        padding: 12px; /* 增大输入框 */
    }
    
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* 隐藏顶部"发送询盘"按钮，避免手机端空间不足 */
    .header-inquiry-btn {
        display: none !important;
    }
    
    /* 移动端顶部导航布局优化 */
    .header-main-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        padding: 0 15px;
    }
    
    .site-logo-wrap {
        flex: 0 0 auto;
        max-width: 60%;
        min-width: 0;
    }
    
    .site-logo-img {
        max-height: 40px !important;
        width: auto !important;
        max-width: 100%;
    }
    
    .header-actions-v3 {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    /* 隐藏登录/注册文字链接，只保留移动端菜单按钮 */
    .header-login-link,
    .header-register-btn {
        display: none !important;
    }
    
    /* 调整搜索按钮大小 */
    .header-search-toggle {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
    }
    
    /* 移动端菜单按钮优化 */
    .mobile-menu-toggle-v3 {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    /* 产品卡片移动端优化 */
    .product-card {
        display: flex;
        flex-direction: column;
        height: auto !important;
        min-height: auto !important;
        position: relative;
    }
    
    .product-card-body {
        flex: 1;
        padding: 10px 8px;
        overflow: hidden;
    }
    
    .product-card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px;
        gap: 6px;
        border-top: 1px solid var(--border);
    }
    
    /* 修复收藏按钮在移动端的显示 */
    .product-card .favorite-btn-top {
        width: 32px !important;
        height: 32px !important;
        top: 8px !important;
        right: 8px !important;
        position: absolute !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 50% !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
        z-index: 100 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    .product-card .favorite-btn-top svg {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        fill: none !important;
        stroke: #9ca3af !important;
        stroke-width: 2 !important;
        stroke-linecap: round !important;
        stroke-linejoin: round !important;
        pointer-events: none !important;
    }
    
    .product-card .favorite-btn-top:hover {
        background: #fff !important;
    }
    
    .product-card .favorite-btn-top:hover svg {
        stroke: #ef4444 !important;
    }
    
    .product-card .favorite-btn-top.is-favorite {
        background: #ef4444 !important;
    }
    
    .product-card .favorite-btn-top.is-favorite svg {
        fill: #ffffff !important;
        stroke: #ffffff !important;
    }
    
    /* 手机端隐藏【首页】商品卡的发送询盘按钮，产品列表页不受影响 */
    .home-product-card .inquiry-btn-sm {
        display: none !important;
    }
    
    /* 产品列表页移动端详细优化 */
    .product-thumb {
        position: relative;
    }
    
    .product-thumb img {
    
    .product-thumb img {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        object-fit: cover;
    }
    
    .product-thumb-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .product-card-title {
        font-size: 13px;
        line-height: 1.3;
        margin: 6px 0;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .product-category-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .product-model-alias {
        font-size: 11px;
        margin: 4px 0;
    }
    
    .product-price {
        margin: 6px 0;
    }
    
    .price-label {
        font-size: 10px;
    }
    
    .price-value {
        font-size: 14px;
        font-weight: 600;
    }
    
    .product-supplier-inline {
        font-size: 11px;
        margin: 6px 0;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .supplier-avatar-mini {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .supplier-avatar-mini img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
    }
    
    .supplier-name-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }
    
    .product-specs-mini {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin: 6px 0;
    }
    
    .spec-tag {
        font-size: 10px;
        padding: 2px 4px;
        background: var(--gray-50);
        border-radius: 3px;
        display: inline-flex;
        align-items: center;
        gap: 2px;
    }
    
    .compare-checkbox-label {
        font-size: 11px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .inquiry-btn {
        font-size: 11px;
        padding: 6px 10px;
        white-space: nowrap;
    }

    /* 搜索面板移动端优化 */
    .header-search-panel .container {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 15px;
    }
    
    .header-search-input-v3 {
        flex: 1;
        min-width: 0;
        font-size: 16px !important; /* 防止 iOS 自动缩放 */
    }
    
    .header-search-submit {
        flex: 0 0 auto;
        padding: 8px 12px;
    }
    
    .header-search-close {
        flex: 0 0 auto;
        padding: 8px;
    }
    
    /* 分类条移动端优化 */
    .category-bar-inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }
    
    .category-bar-inner::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }
    
    /* 用户下拉菜单移动端优化 */
    .user-dropdown-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 9999;
        background: #fff;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    }
    
    .user-dropdown.is-open .user-dropdown-menu {
        transform: translateX(0);
    }
}

/* ---------- 打印样式 ---------- */
@media print {
    .site-header, .breadcrumb, .product-actions,
    .inquiry-modal, .footer-bottom, .cta-section { display: none !important; }
    body { font-size: 12pt; color: #000; background: #fff; }
    .container { max-width: 100%; padding: 0; }
}
