/* 售货机详情页 - 手机端布局修复 */

/* 基础容器修复 - 防止横向溢出 */
@media (max-width: 768px) {
    /* 确保所有容器不超出屏幕宽度 */
    .detail-container,
    .detail-container *,
    .inner,
    .header-content-wrap,
    .content-section,
    .left-content,
    .album-wrap,
    .detail-info,
    .project-title,
    .project-info,
    .project-desc,
    .bottom-layout,
    .tab-navigation,
    .tab-content,
    .recommended-projects,
    .guide-menu-title {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* 主容器 */
    .detail-container {
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .detail-container .inner {
        width: 100%;
        max-width: 100%;
        padding: 0 15px;
        margin: 0 auto;
    }
    
    /* 面包屑导航 */
    .i-link-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 10px 0;
        margin-bottom: 15px;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-wrap: nowrap;
    }
    
    .i-link-wrap::-webkit-scrollbar {
        height: 3px;
    }
    
    .i-link-wrap::-webkit-scrollbar-thumb {
        background: #FF6B35;
        border-radius: 3px;
    }
    
    .i-link-item {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 13px;
    }
    
    .i-link-item a,
    .i-link-item span {
        white-space: nowrap;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .i-link-item.last-item a,
    .i-link-item.last-item span {
        max-width: 200px;
    }
    
    .link-arrow {
        flex-shrink: 0;
        width: 12px;
        height: 12px;
    }
    
    /* 头部内容区域 */
    .header-content-wrap {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        margin-bottom: 20px;
    }
    
    /* 相册区域 */
    .album-wrap {
        width: 100%;
        padding: 15px;
        margin: 0;
        border-radius: 8px;
    }
    
    .main-image-container {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 1;
        margin-bottom: 15px;
    }
    
    .main-image-container img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    .thumbnail-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 0;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .thumbnail-item {
        flex-shrink: 0;
        width: 60px;
        height: 60px;
    }
    
    /* 详情信息区域 */
    .detail-info {
        width: 100%;
        padding: 20px 15px;
        background: #fff;
        border-radius: 8px;
    }
    
    .project-title {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .project-title .name {
        font-size: 20px;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 项目信息 */
    .project-info {
        width: 100%;
    }
    
    .project-info .row {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .project-info .row-item {
        width: 100%;
    }
    
    .project-info-item {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .project-info-item .item-type {
        font-size: 13px;
        font-weight: 600;
        color: #666;
    }
    
    .project-info-item .item-value {
        font-size: 14px;
        color: #333;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 项目优势 */
    .project-advantages {
        width: 100%;
        margin-top: 20px;
    }
    
    .advantages-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .advantage-item {
        width: 100%;
        padding: 12px;
        display: flex;
        gap: 10px;
        align-items: flex-start;
    }
    
    .advantage-icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    
    .advantage-text {
        flex: 1;
        font-size: 14px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 底部操作按钮 */
    .bottom-layout {
        width: 100%;
        margin-top: 20px;
    }
    
    .operation-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .inquiry-btn,
    .custom-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .inquiry-btn {
        background: #FF6B35;
        color: #fff;
    }
    
    .custom-btn {
        background: #fff;
        color: #FF6B35;
        border: 2px solid #FF6B35;
    }
    
    /* 内容区域 */
    .content-section {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 20px;
    }
    
    /* 左侧内容 */
    .left-content {
        width: 100%;
    }
    
    /* 标签导航 */
    .tab-navigation {
        display: flex;
        gap: 5px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 10px 0;
        margin-bottom: 15px;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-navigation::-webkit-scrollbar {
        height: 3px;
    }
    
    .tab-item {
        flex-shrink: 0;
        padding: 10px 15px;
        font-size: 14px;
        background: #f8f9fa;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .tab-item.active {
        background: #FF6B35;
        color: #fff;
    }
    
    /* 标签内容 */
    .tab-content {
        width: 100%;
        padding: 15px;
        background: #fff;
        border-radius: 8px;
        display: none;
    }
    
    .tab-content.active {
        display: block;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 15px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 项目介绍 */
    .project-introduction {
        width: 100%;
    }
    
    .project-introduction h2,
    .project-introduction h3 {
        font-size: 16px;
        margin: 15px 0 10px 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .project-introduction p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .project-introduction ul,
    .project-introduction ol {
        padding-left: 20px;
        margin-bottom: 15px;
    }
    
    .project-introduction li {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 8px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .project-introduction img {
        width: 100%;
        height: auto;
        max-width: 100%;
        border-radius: 8px;
        margin: 15px 0;
    }
    
    /* 相关文章 */
    .related-articles {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .article-item {
        display: flex;
        gap: 12px;
        width: 100%;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        text-decoration: none;
    }
    
    .article-thumb {
        flex-shrink: 0;
        width: 80px;
        height: 80px;
        border-radius: 6px;
        overflow: hidden;
    }
    
    .article-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .article-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 5px;
        min-width: 0;
    }
    
    .article-title {
        font-size: 14px;
        font-weight: 600;
        color: #333;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .article-meta {
        font-size: 12px;
        color: #999;
        display: flex;
        gap: 10px;
    }
    
    /* 推荐项目 */
    .guide-menu-title {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .guide-menu-title .title {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .menu-title {
        font-size: 16px;
        font-weight: 600;
    }
    
    .guide-menu-tab {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 10px 0;
        list-style: none;
        margin: 0;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .guide-menu-tab::-webkit-scrollbar {
        height: 3px;
    }
    
    .menu-item {
        flex-shrink: 0;
    }
    
    .menu-txt {
        display: block;
        padding: 8px 15px;
        background: #f8f9fa;
        border-radius: 6px;
        font-size: 13px;
        text-decoration: none;
        color: #333;
    }
    
    .recommended-projects {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }
    
    .project-card {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        text-decoration: none;
        width: 100%;
    }
    
    .project-card-thumb {
        width: 100%;
        aspect-ratio: 16/10;
        overflow: hidden;
    }
    
    .project-card-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .project-card-info {
        padding: 15px;
    }
    
    .project-card-title {
        font-size: 15px;
        font-weight: 600;
        color: #333;
        margin-bottom: 8px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .project-card-desc {
        font-size: 13px;
        color: #666;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* 右侧边栏 - 手机端隐藏或移到底部 */
    .content-section {
        display: flex;
        flex-direction: column;
    }
    
    /* 侧边栏在手机端的样式 */
    .vending-sidebar {
        width: 100%;
        max-width: 100%;
        margin-top: 20px;
    }
    
    .vending-sidebar .widget {
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
        padding: 15px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .widget-title {
        font-size: 16px;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #FF6B35;
    }
    
    .widget-title h5 {
        font-size: 16px;
        margin: 0;
    }
    
    .hot-projects-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .hot-project-item {
        width: 100%;
    }
    
    .hot-project-link {
        display: flex;
        gap: 12px;
        text-decoration: none;
        width: 100%;
    }
    
    .hot-project-image {
        flex-shrink: 0;
        width: 80px;
        height: 80px;
        border-radius: 6px;
        overflow: hidden;
    }
    
    .hot-project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .hot-project-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 5px;
        min-width: 0;
    }
    
    .hot-project-title {
        font-size: 14px;
        margin: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .hot-project-category,
    .hot-project-date {
        font-size: 12px;
        color: #999;
    }
    
    .ad-banner {
        width: 100%;
    }
    
    .ad-banner a {
        display: block;
        width: 100%;
    }
    
    .ad-banner img {
        width: 100%;
        height: auto;
        max-width: 100%;
        border-radius: 6px;
    }
    
    /* 确保body和html不会横向滚动 */
    html,
    body {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    /* 修复可能导致溢出的元素 */
    img,
    video,
    iframe,
    table {
        max-width: 100%;
        height: auto;
    }
    
    /* 修复长文本溢出 */
    h1, h2, h3, h4, h5, h6,
    p, span, div, a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* 修复表格溢出 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 修复预格式化文本溢出 */
    pre,
    code {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}

/* 额外的安全措施 - 适用于所有屏幕尺寸 */
* {
    box-sizing: border-box;
}

/* 防止特定元素造成溢出 */
@media (max-width: 768px) {
    /* 强制所有容器不超出视口 */
    body,
    html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative;
    }
    
    /* 修复可能的固定宽度元素 */
    [style*="width"] {
        max-width: 100% !important;
    }
    
    /* 重置所有可能导致溢出的元素 */
    .detail-container,
    .detail-container *:not(svg):not(path):not(use) {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 修复可能的负边距 */
    .detail-container > * {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* 允许内部元素有边距，但限制在父容器内 */
    .detail-container .inner > * {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* 修复可能的padding导致的溢出 */
    .detail-container .inner {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* 修复grid布局可能的溢出 */
    .content-section,
    .header-content-wrap {
        grid-template-columns: 1fr !important;
        width: 100% !important;
    }
    
    /* 修复flex布局可能的溢出 */
    .i-link-wrap,
    .tab-navigation,
    .guide-menu-tab,
    .thumbnail-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 隐藏可能导致溢出的滚动条 */
    .i-link-wrap::-webkit-scrollbar,
    .tab-navigation::-webkit-scrollbar,
    .guide-menu-tab::-webkit-scrollbar {
        height: 2px;
    }
    
    /* 修复SVG图标可能的溢出 */
    svg {
        max-width: 100%;
        height: auto;
    }
    
    /* 修复按钮可能的溢出 */
    button,
    .btn,
    .inquiry-btn,
    .custom-btn {
        max-width: 100%;
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* 修复输入框可能的溢出 */
    input,
    textarea,
    select {
        max-width: 100%;
    }
    
    /* 修复iframe和embed元素 */
    iframe,
    embed,
    object {
        max-width: 100%;
    }
    
    /* 修复可能的绝对定位元素 */
    .detail-container [style*="position: absolute"],
    .detail-container [style*="position:absolute"] {
        max-width: 100%;
    }
    
    /* 确保所有文本内容不会溢出 */
    .detail-container p,
    .detail-container h1,
    .detail-container h2,
    .detail-container h3,
    .detail-container h4,
    .detail-container h5,
    .detail-container h6,
    .detail-container span,
    .detail-container div,
    .detail-container a,
    .detail-container li {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto;
        max-width: 100%;
    }
    
    /* 修复可能的min-width导致的溢出 */
    * {
        min-width: 0 !important;
    }
    
    /* 但保留某些元素的最小宽度 */
    .thumbnail-item,
    .advantage-icon,
    .hot-project-image {
        min-width: auto !important;
    }
    
    .thumbnail-item {
        min-width: 60px !important;
    }
    
    .advantage-icon {
        min-width: 20px !important;
    }
    
    .hot-project-image {
        min-width: 80px !important;
    }
}

/* 针对特别小的屏幕（如iPhone SE） */
@media (max-width: 375px) {
    .detail-container .inner {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .album-wrap,
    .detail-info,
    .tab-content,
    .vending-sidebar .widget {
        padding: 10px !important;
    }
    
    .thumbnail-item {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
    }
    
    .hot-project-image {
        width: 70px !important;
        height: 70px !important;
        min-width: 70px !important;
    }
}
