/* ============================================
   震撼 CMS 移动端优化样式
   覆盖所有页面的移动端兼容性修复
   ============================================ */

/* ═══════════════════════════════════════
   AI 聊天弹窗 —— 替代内联硬编码样式
   ═══════════════════════════════════════ */
#aiChatModal {
    position: fixed;
    bottom: 80px;
    right: 50px;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 10000;
    display: none;
    flex-direction: column;
}
#aiChatModal .chat-header {
    background: #409eff;
    color: white;
    padding: 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#aiChatModal .chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f7fa;
    min-height: 0;
}
#aiChatModal .chat-footer {
    padding: 10px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
#aiChatModal .chat-input-row {
    display: flex;
    gap: 5px;
}
#aiChatModal .chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    min-width: 0;
}
#aiChatModal .chat-send-btn {
    background: #409eff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
}
.chat-msg-ai {
    background: #409eff;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 80%;
    word-break: break-word;
}
.chat-msg-user {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 80%;
    margin-left: auto;
    word-break: break-word;
}
.chat-msg-error {
    background: #f56c6c;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 80%;
    word-break: break-word;
}
.ai-chat-icon {
    width: 40px;
    height: 40px;
    background: #409eff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

/* ═══════════════════════════════════════
   平板适配（≤768px）
   ═══════════════════════════════════════ */
@media (max-width: 768px) {

    /* AI 聊天弹窗 —— 平板尺寸 */
    #aiChatModal {
        right: 20px;
        bottom: 70px;
        width: 300px;
        height: 400px;
    }

    /* 底部多列导航堆叠 */
    .footNav .col_nav {
        width: 50% !important;
        float: left !important;
        margin-bottom: 15px;
    }

    /* 新闻两栏布局强制单列 */
    .index_news .news_pbox,
    .index_news .inews_list {
        float: none !important;
        width: 100% !important;
        margin-left: 0 !important;
    }
    .index_news .news_pbox {
        margin-bottom: 20px;
    }

    /* 焦点图高度适配 */
    .sliderContainer,
    .royalSlider {
        height: 50vw !important;
        max-height: 300px;
    }

    /* 右侧浮动栏缩小 */
    .side-pannel {
        transform: scale(0.85);
        transform-origin: bottom right;
    }

    /* 内容区域减小内边距 */
    .sec_main .wrap {
        padding: 0 15px;
    }

    /* 标题字号 */
    .m_tit,
    .vision_tit {
        font-size: 22px !important;
    }
}

/* ═══════════════════════════════════════
   手机适配（≤480px）
   ═══════════════════════════════════════ */
@media (max-width: 480px) {

    /* AI 聊天弹窗 —— 全屏化 */
    #aiChatModal {
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
    }
    #aiChatModal .chat-header {
        border-radius: 0;
        padding: 12px 15px;
    }
    #aiChatModal .chat-body {
        flex: 1;
    }

    /* 底部导航单列 */
    .footNav .col_nav {
        width: 100% !important;
        float: none !important;
        margin-bottom: 10px;
    }
    .footNav .col_nav .col_tit {
        font-size: 14px;
    }
    .footNav .col_nav a {
        font-size: 12px;
    }

    /* 焦点图更矮 */
    .sliderContainer,
    .royalSlider {
        height: 45vw !important;
        max-height: 220px;
    }

    /* 右侧浮动栏进一步缩小 + 靠边 */
    .side-pannel {
        transform: scale(0.75);
        right: 2px;
        bottom: 2px;
    }

    /* AI 客服图标缩小 */
    .ai-chat-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    /* 页面通用间距 */
    .sec_main {
        padding: 10px 0;
    }
    .sec_main .wrap {
        padding: 0 12px;
    }

    /* 标题 */
    .m_tit,
    .vision_tit {
        font-size: 18px !important;
    }

    /* 新闻列表项 */
    .inews_list li {
        padding: 10px 0;
    }
    .inews_list li a {
        font-size: 14px;
    }

    /* 公司简介图溢出修复 */
    .conpany_intr .media {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* 底部版权 */
    .foot_txt p {
        font-size: 11px;
        line-height: 1.6;
    }

    /* 搜索框全宽 */
    .top_search {
        width: 100% !important;
        float: none !important;
        margin: 10px 0;
    }
}

/* ═══════════════════════════════════════
   超小屏适配（≤375px iPhone SE/mini）
   ═══════════════════════════════════════ */
@media (max-width: 375px) {

    /* AI 聊天弹窗全屏 */
    #aiChatModal .chat-input {
        padding: 6px 10px;
        font-size: 14px;
    }
    #aiChatModal .chat-send-btn {
        padding: 6px 12px;
        font-size: 14px;
    }

    /* 焦点图 */
    .sliderContainer,
    .royalSlider {
        height: 42vw !important;
        max-height: 180px;
    }

    /* 核心产业标签两列 */
    .menu-list li {
        width: 50% !important;
    }

    /* 通用字号下限 */
    body {
        font-size: 13px;
    }
    .m_tit,
    .vision_tit {
        font-size: 16px !important;
    }
}

/* ═══════════════════════════════════════
   横屏适配（手机横屏 height≤500px）
   ═══════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {

    /* AI 聊天弹窗适配横屏 */
    #aiChatModal {
        top: 10px !important;
        bottom: 10px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 12px;
    }
}

/* ═══════════════════════════════════════
   安全区域适配（iPhone X+ 底部 Home 条）
   ═══════════════════════════════════════ */
@supports (padding: env(safe-area-inset-bottom)) {
    .foot_copy {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .side-pannel {
        bottom: calc(5px + env(safe-area-inset-bottom));
    }
    @media (max-width: 480px) {
        #aiChatModal .chat-footer {
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }
    }
}