/* ========================================
   创为铁路 - 响应式样式
   Responsive Styles
   ======================================== */

/* ========================================
   1. 大平板 (max-width: 1199px)
   ======================================== */
@media (max-width: 1199px) {
    :root {
        --header-height: 70px;
    }
    
    .container {
        max-width: 960px;
    }
    
    /* 首页 */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-content {
        gap: var(--space-2xl);
    }
    
    .products-bento {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .bento-item,
    .bento-item:nth-child(1),
    .bento-item:nth-child(2),
    .bento-item:nth-child(3),
    .bento-item:nth-child(4) {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .honors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 产品列表 */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 产品详情 */
    .product-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .product-gallery {
        position: relative;
        top: 0;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* 新闻 */
    .article-layout {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        order: -1;
    }
    
    .sidebar-widget {
        display: none;
    }
    
    /* 关于我们 */
    .about-intro-grid,
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .about-intro-image {
        order: -1;
    }
    
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .partners-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* 联系页 */
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-sidebar {
        order: -1;
    }
    
    /* 底部 */
    .footer-main {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   2. 平板 (max-width: 991px)
   ======================================== */
@media (max-width: 991px) {
    :root {
        --header-height: 64px;
    }
    
    .container {
        max-width: 720px;
        padding: 0 var(--space-md);
    }
    
    /* 头部导航 */
    /* 修复移动端导航菜单 */
    .header {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98);
    }

    .nav-toggle {
        display: flex;
    }
    
    .nav-list {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        padding: var(--space-lg);
        gap: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .nav-list.nav-active {
        transform: translateX(0);
    }
    
    .nav-item > a {
        padding: var(--space-md);
        border-bottom: 1px solid var(--border-light);
        border-radius: 0;
    }
    
    .nav-item:hover > a {
        background: transparent;
    }
    
    .sub-nav {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: var(--space-lg);
        display: none;
    }
    
    .nav-item.open .sub-nav {
        display: block;
    }
    
    /* Hero区 */
    .hero {
        height: auto;
        min-height: 400px;
    }
    
    .hero-content {
        padding: var(--space-2xl) 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    /* 特色功能 */
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    /* 本托布局调整为单列 */
    .products-bento {
        grid-template-columns: 1fr;
    }
    
    .bento-item,
    .bento-item:nth-child(1),
    .bento-item:nth-child(2),
    .bento-item:nth-child(3),
    .bento-item:nth-child(4) {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    /* 统计数字 */
    .about-stats {
        flex-wrap: wrap;
        gap: var(--space-xl);
    }
    
    /* 荣誉网格 */
    .honors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    /* 新闻 */
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .news-card-featured {
        grid-template-columns: 1fr;
    }
    
    .news-card-horizontal {
        grid-template-columns: 200px 1fr;
    }
    
    /* CTA按钮 */
    .cta-buttons {
        flex-direction: column;
    }
    
    /* 产品列表 */
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    /* 产品详情 */
    .product-meta-list {
        grid-template-columns: 1fr;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .cases-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-block {
        flex-direction: column;
        text-align: center;
    }
    
    /* 文章布局 */
    .article-nav {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .article-nav-next {
        text-align: left;
    }
    
    /* 时间线 */
    .timeline::before {
        left: 0;
    }
    
    .timeline-item {
        width: 100%;
        padding-left: var(--space-xl);
        padding-right: 0;
        margin-left: 0;
        text-align: left !important;
    }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        margin-left: 0;
        padding-left: var(--space-xl);
        text-align: left;
    }
    
    .timeline-item::before {
        left: -8px !important;
        right: auto !important;
    }
    
    /* 企业文化 */
    .culture-grid {
        grid-template-columns: 1fr;
    }
    
    /* 团队 */
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 合作伙伴 */
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 联系卡 */
    .contact-cards-grid {
        grid-template-columns: 1fr;
        margin-bottom: 0;
    }
    
    .contact-main {
        padding-top: var(--space-3xl);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .cta-card {
        flex-direction: column;
        text-align: center;
    }
    
    /* 底部：快速导航和产品中心并列 */
    .footer-main {
        grid-template-columns: 1fr 1fr;
        text-align: center;
        gap: var(--space-xl);
    }
    
    .footer-brand {
        grid-column: 1 / -1;
    }
    
    .footer-logo img {
        margin: 0 auto;
    }
    
    .footer-contact-mini {
        align-items: center;
    }
    
    .footer-qrcode {
        grid-column: 1 / -1;
    }
    
    .qrcode-wrap {
        margin: 0 auto var(--space-sm);
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    .copyright {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

/* ========================================
   3. 手机 (max-width: 767px)
   ======================================== */
@media (max-width: 767px) {
    /* Hero区 */
    .hero {
        min-height: 280px;
    }
    
    .page-header-img {
        min-height: 280px;
    }
    :root {
        --header-height: 60px;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    /* Logo */
    .logo img {
        height: 36px;
    }
    
    /* Hero */
    .hero-content {
        padding: var(--space-xl) 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero .btn {
        width: 100%;
    }
    
    .hero-prev,
    .hero-next {
        display: none;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    /* 区域通用 */
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .features-section,
    .about-intro,
    .products-showcase,
    .honors-section,
    .testimonials-section,
    .cta-section,
    .news-section,
    .contact-main,
    .about-intro-section,
    .timeline-section,
    .culture-section,
    .team-section,
    .partners-section,
    .faq-section {
        padding: var(--space-3xl) 0;
    }
    
    /* 特色功能 */
    .feature-icon {
        width: 60px;
        height: 60px;
    }
    
    .feature-item {
        padding: var(--space-md);
    }
    
    /* 关于我们 */
    .about-stats {
        justify-content: space-around;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .about-features-row {
        gap: var(--space-md);
    }
    
    /* 产品卡片 */
    .product-card {
        margin-bottom: var(--space-md);
    }
    
    /* 荣誉 */
    .honors-grid {
        grid-template-columns: 1fr;
    }
    
    .honor-item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        text-align: left;
    }
    
    .honor-image {
        width: 80px;
        height: 80px;
        margin: 0;
    }
    
    /* 评价 */
    .testimonial-item {
        padding: var(--space-md);
    }
    
    .testimonial-item blockquote {
        font-size: 1rem;
    }
    
    /* 新闻 */
    .news-card-horizontal {
        grid-template-columns: 1fr;
    }
    
    .newsletter-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-xl);
    }
    
    .newsletter-form {
        flex-direction: column;
        width: 100%;
    }
    
    .newsletter-form input {
        width: 100%;
    }
    
    .newsletter-form .btn {
        width: 100%;
    }
    
    /* 面包屑 */
    .breadcrumb-wrapper {
        display: none;
    }
    
    /* 页面头部 */
    .page-header {
        padding: var(--space-2xl) 0;
    }
    
        .page-header-img {
        min-height: 400px;
    }
    
    /* 分类筛选 */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--space-sm);
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-tab {
        white-space: nowrap;
    }
    
    .filter-search input {
        width: 100%;
    }
    
    /* 产品详情 */
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tabs-header {
        overflow-x: auto;
    }
    
    .tab-btn {
        white-space: nowrap;
        flex: none;
    }
    
    /* 文章 */
    .article-meta-top {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-share {
        flex-wrap: wrap;
    }
    
    /* 团队 */
    .team-grid {
        grid-template-columns: 1fr;
    }
    
    /* 合作伙伴 */
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .partner-logo {
        height: 60px;
        font-size: 0.85rem;
    }
    
    /* 联系页 */
    .contact-card {
        padding: var(--space-xl);
    }
    
    .contact-card-icon {
        width: 48px;
        height: 48px;
    }
    
    .contact-value {
        font-size: 1.125rem;
    }
    
    .form-captcha .captcha-input {
        flex-direction: column;
        align-items: stretch;
    }
    
    .captcha-img {
        height: 50px;
        align-self: flex-start;
    }
    
    /* 404 */
    .error-code {
        font-size: 5rem;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .quick-links {
        gap: var(--space-sm);
    }
    
    /* 底部 */
    .footer {
        padding-top: var(--space-2xl);
    }
    
    .footer-main {
        padding-bottom: var(--space-2xl);
    }
}

/* ========================================
   4. 小手机 (max-width: 479px)
   ======================================== */
@media (max-width: 479px) {
    /* Hero区 */
    .hero {
        min-height: 280px;
    }
    
    .page-header-img {
        min-height: 280px;
    }
    /* 产品列表改为单列，相关产品保持2列 */
    .products-grid,
    .cases-grid {
        grid-template-columns: 1fr;
    }

    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* 统计 */
    .about-stats {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .stat-item {
        text-align: center;
    }
    
    /* 产品meta */
    .product-meta-list {
        grid-template-columns: 1fr;
    }
    
    .meta-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }
    
    /* 底部 */
    .footer-bottom {
        font-size: 0.8rem;
    }
}

/* ========================================
   5. 横屏优化
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 280px;
    }
    
    .hero-content {
        padding: var(--space-lg) 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .scroll-indicator {
        display: none;
    }
}

/* ========================================
   6. 打印样式
   ======================================== */
@media print {
    .header,
    .footer,
    .nav-toggle,
    .hero-swiper,
    .cta-section,
    .product-actions,
    .product-share,
    .article-share,
    .article-sidebar,
    .cta-block,
    .related-products,
    .newsletter-section {
        display: none !important;
    }
    
    .header-spacer {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    article {
        page-break-inside: avoid;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 90%;
        opacity: 0.7;
    }
}

/* ========================================
   7. 高对比度模式支持
   ======================================== */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #003399;
        --text-primary: #000;
        --border-gray: #666;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* ========================================
   8. 减少动画偏好
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .scroll-indicator {
        animation: none;
    }
}

/* ========================================
   9. 暗黑模式支持（可选）
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-white: #1a1a1a;
        --bg-light: #2d2d2d;
        --bg-gray: #3d3d3d;
        --text-primary: #f0f0f0;
        --text-secondary: #b0b0b0;
        --border-light: #404040;
        --border-gray: #505050;
    }
}

@media (max-width: 767px) {
    /* Hero区 */
    .hero {
        min-height: 280px;
    }
    
    .page-header-img {
        min-height: 280px;
    }
    .related-products-grid .related-card:nth-child(n+3) {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .nav-toggle {
        display: none !important;
    }
    
    .nav-list {
        position: static !important;
        transform: none !important;
        flex-direction: row !important;
        background: transparent !important;
        padding: 0 !important;
        gap: var(--space-xs) !important;
        overflow: visible !important;
    }
    
    .nav-item > a {
        padding: var(--space-sm) var(--space-md);
        border-bottom: none;
        border-radius: var(--radius-sm);
        font-size: 0.875rem;
    }
    
    .nav-item:hover > a {
        background: var(--primary-light);
    }
}

@media (max-width: 767px) {
    /* Hero区 */
    .hero {
        min-height: 280px;
    }
    
    .page-header-img {
        min-height: 280px;
    }
    .footer-nav ul li a,
    .footer-products ul li a {
        display: inline-block;
        min-width: 44px;
        min-height: 44px;
        line-height: 44px;
        padding: 0 var(--space-md);
    }
    
    .btn {
        min-height: 44px;
        padding: var(--space-sm) var(--space-lg);
    }
    
    .tab-btn {
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
    }
    
    .page-link {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   移动端触控区域优化 - P0/P1/P2

.nav-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

.footer-nav a,
.footer-products a,
.footer-links a,
.footer-contact-mini span {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.filter-item,
.filter-tab {
    min-height: 44px;
}

.search-btn {
    min-width: 44px;
    min-height: 44px;
}

.page-numbers a,
.pagination a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button, .btn {
    min-height: 44px;
    min-width: 44px;
}

/* ========================================
   EMERGENCY: Mobile Menu Fix ======================================== */
@media screen and (max-width: 991px) {
    .nav-toggle {
        display: flex !important;
    }
    
    .nav-list {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        flex-direction: column;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .nav-list.nav-active {
        transform: translateX(0);
    }
}

/* 移动端触摸目标尺寸优化 - 48px最小尺寸 */
@media (max-width: 991px) {
    .nav-item a {
        min-height: 48px !important;
        padding: 12px 20px !important;
    }
    
    .nav-toggle {
        width: 48px !important;
        height: 48px !important;
    }
}
