/* 移动端优化样式 - 防止水平滚动 */

/* 网站名称样式 - 禁止换行但显示完整内容 */
.site-name {
    white-space: nowrap;
    overflow: visible;
    display: inline-block;
    min-width: 0;
}

/* 基础重置 */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器优化 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    overflow-x: hidden;
}

/* 大屏幕容器优化 */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* 超大屏幕容器优化 */
@media (min-width: 1600px) {
    .container {
        max-width: 1440px;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

/* 宽屏容器优化 */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* 图片响应式 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 表格响应式 */
table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* 移动端特定优化 */
@media (max-width: 768px) {
    /* 防止水平滚动 */
    body {
        overflow-x: hidden;
        width: 100vw;
        max-width: 100vw;
    }
    
    html {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    /* 容器最大宽度限制 */
    .container {
        max-width: 100vw;
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* 全局元素宽度限制 */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* 特定元素宽度限制 */
    section, div, article, aside, main, header, footer {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 网格布局优化 */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* 文字大小优化 */
    h1 {
        font-size: 1.75rem !important;
        line-height: 2rem !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.75rem !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.5rem !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    /* 按钮优化 */
    .btn, button {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 16px;
    }
    
    /* 表单优化 */
    input, textarea, select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 0.75rem;
        max-width: 100%;
    }
    
    /* 导航栏优化 */
    #navbar {
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: hidden;
        width: 100%;
    }
    
    /* 移动端菜单优化 */
    #mobileMenu {
        max-width: 100vw;
        overflow-x: hidden;
        width: 100%;
    }
    
    #mobileMenu .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 轮播图优化 */
    .carousel-item {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 产品卡片优化 */
    .product-card {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* 产品卡片样式 - 与products.php保持一致 */
    .grid .group {
        height: 100% !important;
    }
    
    .grid .group .bg-white {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .grid .group .flex-1 {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .grid .group .mt-auto {
        margin-top: auto !important;
    }
    
    /* 确保产品卡片阴影完整显示 */
    .product-section {
        overflow: visible !important;
        padding-bottom: 3rem !important;
    }
    
    .product-grid {
        overflow: visible !important;
        padding-bottom: 4rem !important;
    }
    
    .product-card-container {
        overflow: visible !important;
        padding: 1rem !important;
    }
    
    .product-card-container * {
        overflow: visible !important;
    }
    
    /* 旗帜滚动容器优化 */
    .flags-scroll-container {
        max-width: 100vw;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 强制所有内容不超出屏幕 */
    .w-full, .w-screen {
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    /* 防止flex容器溢出 */
    .flex, .flex-col, .flex-row {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 防止grid容器溢出 */
    .grid {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* 防止文字溢出 */
    .line-clamp-2, .line-clamp-3 {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* 分类筛选优化 */
    .category-filter {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .category-filter > div {
        min-width: max-content;
        padding-bottom: 0.5rem;
    }
    
    /* 新闻卡片优化 */
    .news-card {
        width: 100%;
        max-width: 100%;
    }
    
    /* 联系表单优化 */
    .contact-form {
        width: 100%;
        max-width: 100%;
    }
    
    .contact-form input,
    .contact-form textarea {
        width: 100%;
        max-width: 100%;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        max-width: 100vw;
        width: 100%;
    }
    
    h1 {
        font-size: 1.5rem !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    h2 {
        font-size: 1.25rem !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    .btn, button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    #mobileMenu .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* 更严格的宽度控制 */
    body, html {
        max-width: 100vw;
        width: 100%;
        overflow-x: hidden;
    }
    
    /* 所有元素强制不超出屏幕 */
    * {
        max-width: 100vw !important;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .btn, button, a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 禁用悬停效果 */
    .product-card:hover,
    .news-card:hover {
        transform: none;
    }
    
    /* 优化滚动 */
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 优化触摸反馈 */
    .btn:active,
    button:active,
    a:active {
        transform: scale(0.98);
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    /* 可以根据需要添加深色模式样式 */
}

/* 打印样式 */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        overflow: visible !important;
        width: auto !important;
    }
    
    .container {
        max-width: none !important;
        overflow: visible !important;
    }
}

/* 特定组件优化 */
/* 轮播图容器 */
.carousel-container {
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}

/* 轮播图指示器优化 */
.carousel-indicator {
    transition: all 0.3s ease;
}

/* 移动端轮播图指示器优化 */
@media (max-width: 768px) {
    .carousel-indicator {
        width: 6px !important;
        height: 6px !important;
        margin: 0 2px;
    }
    
    /* 轮播图指示器容器优化 */
    .carousel-indicator + .carousel-indicator {
        margin-left: 4px;
    }
}

/* 手机端隐藏轮播图指示器 */
@media (max-width: 480px) {
    .carousel-indicator {
        display: none !important;
    }
    
    /* 隐藏轮播图指示器容器 */
    .carousel-indicator + .carousel-indicator {
        display: none !important;
    }
}

/* 中等屏幕轮播图指示器优化 */
@media (max-width: 1024px) and (min-width: 769px) {
    .carousel-indicator {
        width: 8px !important;
        height: 8px !important;
        margin: 0 3px;
    }
    
    /* 轮播图指示器容器优化 */
    .carousel-indicator + .carousel-indicator {
        margin-left: 6px;
    }
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 新闻网格 */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 联系表单网格 */
.contact-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .contact-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* 工具类 */
.no-horizontal-scroll {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.mobile-optimized {
    word-break: break-word;
    overflow-wrap: break-word;
}

.touch-friendly {
    min-height: 44px;
    min-width: 44px;
} 