/* 响应式设计优化 - 移动端布局和触摸交互 */

/* 基础移动设备调整 */
@media screen and (max-width: 576px) {
    /* 检测触摸设备并添加触摸类 */
    @media (hover: none) and (pointer: coarse) {
        body::before {
            content: "touch-device";
            display: none;
        }
    }
    
    /* 添加移动端菜单 */
    /* 说明：原 @import url('mobile-menu.css') 因写在其它规则之后被浏览器忽略，
       移动端抽屉样式已直接内联在本文件与 style.css 中，故移除该失效引用。 */
    
    /* 全局调整 */
    body {
        font-size: 16px;
        line-height: 1.5;
    }

    /* 手机断点页眉实测高约 75px，供吸顶子栏对齐 */
    :root {
        --nav-h: 75px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
    
    /* 导航栏移动端优化 */
    .navbar {
        padding: 10px 0;
    }
    
    .navbar .container {
        flex-direction: column;
        padding: 5px;
    }
    
    .logo {
        margin-bottom: 10px;
    }
    
    .logo img {
        height: 35px;
    }
    
    .logo span {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        width: 100%;
        display: none;
    }

    /* 点击汉堡按钮展开抽屉菜单：覆盖式（绝对定位），不撑高固定页眉，
       使页眉高度恒为收起态，body 顶部留白同步更稳定。 */
    .nav-menu.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .nav-menu ul {
        flex-direction: column;
        width: 100%;
        padding: 0;
    }
    
    .nav-menu li {
        margin: 5px 0;
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        width: 100%;
        padding: 12px 15px;
        text-align: center;
        border-radius: 5px;
    }
    
    /* 移动端菜单按钮 */
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        z-index: 1001;
        background: none;
        border: none;
        cursor: pointer;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: var(--primary-color);
        margin: 5px 0;
        transition: var(--transition);
    }
    
    /* Hero区域移动端优化 */
    .hero {
        height: 400px;
        margin-bottom: 40px;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero .tagline {
        font-size: 1.1rem;
        padding: 0 20px;
        line-height: 1.4;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 1rem;
        min-width: 150px;
    }
    
    /* 页面标题移动端优化 */
    .page-title {
        height: 300px;
    }
    
    .page-title h1 {
        font-size: 2.5rem;
    }
    
    .page-title .tagline {
        font-size: 1.2rem;
        padding: 0 15px;
    }
    
    /* 公司简介移动端优化 */
    .company-intro {
        padding: 40px 0;
    }
    
    .intro-content {
        flex-direction: column;
        gap: 25px;
    }
    
    .intro-text {
        text-align: center;
    }
    
    .intro-text p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .intro-image {
        max-width: 90%;
    }
    
    /* 产品展示移动端优化 */
    .product-grid, .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .product-card {
        margin-bottom: 20px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-name {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .product-price {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .product-description {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .btn-small {
        width: 100%;
    }
    
    /* 品牌优势移动端优化 */
    .brand-advantages {
        padding: 40px 0;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .advantage-item {
        padding: 20px;
    }
    
    .advantage-icon {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }
    
    .advantage-item h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .advantage-item p {
        font-size: 0.95rem;
    }
    
    /* 客户评价移动端优化 */
    .testimonials {
        padding: 40px 0;
    }
    
    .testimonial-slider {
        flex-direction: column;
        gap: 20px;
    }
    
    .testimonial {
        padding: 20px;
    }
    
    .testimonial p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* 产品筛选移动端优化 */
    .product-filter {
        padding: 20px 0;
        position: sticky;
        top: var(--nav-h);   /* 跟随手机页眉高度(75px)吸顶，不被遮挡 */
        z-index: 999;
    }
    
    .filter-tabs {
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 5px;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) transparent;
    }
    
    .filter-tabs::-webkit-scrollbar {
        height: 5px;
    }
    
    .filter-tabs::-webkit-scrollbar-thumb {
        background-color: var(--primary-color);
        border-radius: 3px;
    }
    
    .filter-tab {
        padding: 8px 16px;
        font-size: 0.9rem;
        white-space: nowrap;
        min-width: fit-content;
    }
    
    /* 产品详情模态框移动端优化 */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        flex-direction: column;
        padding: 15px;
    }
    
    .modal-product-image {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .modal-product-image img {
        width: 100%;
        height: auto;
    }
    
    .modal-product-info {
        width: 100%;
    }
    
    /* 购物车页面移动端优化 */
    .cart-items {
        gap: 15px;
    }
    
    .cart-item {
        flex-direction: column;
        padding: 15px;
    }
    
    .cart-item-image {
        width: 100%;
        height: 200px;
        margin-bottom: 15px;
    }
    
    .cart-item-details {
        width: 100%;
    }
    
    .cart-item-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
    }
    
    .cart-summary {
        padding: 20px;
        width: 100%;
    }
    
    .cart-summary h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .cart-summary-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
    }
    
    /* 表单页面移动端优化 */
    .contact-form, .checkout-form {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 1rem;
    }
    
    textarea.form-control {
        min-height: 100px;
    }
    
    /* 页脚移动端优化 */
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 25px;
    }
    
    .footer-logo {
        margin-bottom: 15px;
    }
    
    .footer-links {
        width: 100%;
    }
    
    .link-group {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .footer-bottom {
        padding-top: 20px;
    }
    
    .social-links {
        gap: 10px;
    }
}

/* 平板设备调整 */
@media screen and (min-width: 577px) and (max-width: 992px) {
    /* 平板断点页眉实测高约 90px，供吸顶子栏对齐 */
    :root {
        --nav-h: 90px;
    }

    .container {
        padding: 0 20px;
    }
    
    .hero, .page-title {
        height: 450px;
    }
    
    .hero h1 {
        font-size: 2.8rem;
    }
    
    .hero .tagline {
        font-size: 1.3rem;
    }
    
    .product-grid, .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .testimonial-slider {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 20px;
        padding-bottom: 10px;
    }
    
    .testimonial {
        min-width: 400px;
    }
    
    .filter-tabs {
        justify-content: flex-start;
    }
}

/* 触摸优化 - 已移动到 touch.css 文件 */
/* 此处只保留必要的响应式调整，其他触摸样式请参考 touch.css */

/* 高分辨率设备优化 */
@media only screen and (-webkit-min-device-pixel-ratio: 2), 
       only screen and (min-resolution: 192dpi) {
    .logo img, .footer-logo img {
        image-rendering: -webkit-optimize-contrast;
    }
    
    .product-image img, .intro-image img {
        image-rendering: crisp-edges;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8f9fa;
        --light-color: #333333;
        --border-color: #495057;
    }
    
    body {
        background-color: #212529;
        color: var(--dark-color);
    }
    
    .card, .product-card, .advantage-item, .testimonial, .form-control {
        background-color: #343a40;
        color: var(--dark-color);
    }
    
    .navbar {
        background-color: #343a40;
    }
    
    .nav-menu a {
        color: #adb5bd;
    }
    
    .nav-menu a:hover, .nav-menu a.active {
        color: var(--primary-color);
        background-color: rgba(44, 95, 45, 0.2);
    }
    
    .product-filter {
        background-color: #343a40;
    }
    
    .form-control {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .form-control:focus {
        background-color: #495057;
        border-color: var(--primary-color);
    }
}

/* 横屏模式优化 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .hero {
        height: 300px;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero .tagline {
        font-size: 1.1rem;
        display: none;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
}

/* 移动端菜单样式已内联于本文件顶部的窄屏媒体查询中；
   此处不再 @import mobile-menu.css（该写法会被浏览器忽略且其规则已覆盖）。 */