/* ========================================
   Discuz! X5.0 响应式三端适配 CSS
   PC端 / 平板 / 手机
   ======================================== */

/* ===== 基础响应式配置 ===== */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 隐藏/显示控制类 */
.dz-mobile-only { display: none !important; }
.dz-pc-only { display: block; }

/* ===== 手机端样式 (< 768px) ===== */
@media screen and (max-width: 767px) {
    /* 显示/隐藏切换 */
    .dz-mobile-only { display: block !important; }
    .dz-pc-only { display: none !important; }
    
    /* 基础布局 */
    .wp { 
        width: 100% !important; 
        min-width: 0 !important;
        padding: 0 10px !important; 
    }
    
    .discuzx5 { padding: 0; }
    
    /* 头部导航 */
    .dz_btm_layer {
        width: 100% !important;
        min-width: 0 !important;
        padding: 0 10px !important;
        height: auto !important;
    }
    
    .dz_layer_top {
        padding: 10px 0;
    }
    
    .dz_nav_logo {
        float: none !important;
        text-align: center;
        height: auto !important;
        margin: 0 !important;
        padding: 5px 0;
    }
    
    .dz_nav_logo img {
        max-width: 120px;
        height: auto !important;
    }
    
    /* 导航菜单 - 汉堡菜单 */
    .dz_layer_nav {
        float: none !important;
        width: 100% !important;
        height: auto !important;
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dz-bgf);
        z-index: 1000;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .dz_layer_nav.active {
        display: block;
    }
    
    .dz_layer_nav ul {
        padding: 0;
        margin: 0;
    }
    
    .dz_layer_nav ul li {
        float: none !important;
        width: 100%;
        border-bottom: 1px solid var(--dz-borderb);
    }
    
    .dz_layer_nav ul li a {
        display: block;
        width: 100%;
        height: 50px !important;
        line-height: 50px !important;
        margin: 0 !important;
        padding: 0 15px;
        text-align: left;
        font-size: 15px !important;
    }
    
    .dz_layer_nav ul li a:before,
    .dz_layer_nav ul li a:after {
        display: none !important;
    }
    
    /* 汉堡菜单按钮 */
    .dz-mobile-menu-btn {
        display: block !important;
        position: absolute;
        right: 10px;
        top: 10px;
        width: 30px;
        height: 24px;
        cursor: pointer;
        z-index: 1001;
    }
    
    .dz-mobile-menu-btn span {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--dz-color);
        margin: 5px 0;
        transition: all 0.3s;
        border-radius: 2px;
    }
    
    /* 用户登录区域 */
    .dz_layer_dl {
        float: none !important;
        padding: 10px;
        border-top: 1px solid var(--dz-borderb);
    }
    
    .header-searcher {
        float: none !important;
        margin: 10px 0 !important;
    }
    
    .header-searcher .search-input {
        width: 100% !important;
    }
    
    /* 主内容区 */
    #wp {
        padding: 10px !important;
    }
    
    #ct {
        padding: 0 !important;
    }
    
    /* 两栏/三栏布局变为单栏 */
    .ct2 .mn,
    .ct2 .sd,
    .ct3_a .mn,
    .ct3_a .sd {
        float: none !important;
        width: 100% !important;
        margin: 0 0 15px 0 !important;
        padding: 0 !important;
    }
    
    .ct2 .sd,
    .ct3_a .sd {
        display: none; /* 手机端默认隐藏侧边栏 */
    }
    
    /* 帖子列表 */
    .bm {
        margin-bottom: 10px !important;
        border-radius: 0 !important;
    }
    
    .bm_h {
        height: auto !important;
        min-height: 44px;
        padding: 10px 15px !important;
        line-height: 24px !important;
    }
    
    .bm_h h1, .bm_h h2, .bm_h h3 {
        font-size: 15px !important;
        line-height: 24px !important;
    }
    
    .bm_c {
        padding: 10px 15px !important;
    }
    
    /* 帖子列表项 */
    .forumportal_listc li.kmlist {
        padding: 12px 0 !important;
    }
    
    .forumportal_listc .kmtit {
        font-size: 15px !important;
        white-space: normal !important;
        line-height: 1.5 !important;
        height: auto !important;
    }
    
    .forumportal_listc .kmfoot {
        margin-top: 8px;
    }
    
    .forumportal_listc .kmfoot a {
        margin-right: 8px !important;
        font-size: 12px !important;
    }
    
    /* 表单元素 */
    .px, .pt, .ps, select {
        height: 44px !important;
        line-height: 44px !important;
        font-size: 16px !important; /* 防止iOS缩放 */
    }
    
    textarea {
        font-size: 16px !important;
    }
    
    .pn, .pnc, a.pn {
        height: 44px !important;
        line-height: 44px !important;
        padding: 0 15px !important;
        font-size: 16px !important;
        min-width: 44px;
    }
    
    /* 按钮全宽 */
    .tb .o a,
    .pgsbtn {
        width: 100%;
        text-align: center;
    }
    
    /* 分页 */
    .pg {
        text-align: center;
    }
    
    .pg a, .pg strong {
        min-width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
    }
    
    /* 底部 */
    .dz_footc {
        padding: 15px 10px;
    }
    
    .dz_footc_dico {
        float: none !important;
        text-align: center;
        padding: 10px 0;
        margin: 0 !important;
    }
    
    .dz_footc_dico .ewmimg {
        float: none !important;
        display: inline-block;
        margin: 0 5px !important;
    }
    
    .dz_footc_nav {
        margin-right: 0 !important;
        padding: 10px 0 !important;
        text-align: center;
        height: auto !important;
    }
    
    .dz_footc_nav a {
        float: none !important;
        display: inline-block;
        margin: 0 5px !important;
        font-size: 13px !important;
    }
    
    .dz_footc_nav .pipe {
        display: none !important;
    }
    
    .dz_footc_copy {
        text-align: center;
        padding: 10px 0 !important;
        font-size: 12px !important;
    }
    
    /* 右侧悬浮按钮 */
    .dz_rnav {
        position: fixed;
        bottom: 15px !important;
        right: 15px !important;
        left: auto !important;
        margin: 0 !important;
    }
    
    .dz_rnav a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 20px !important;
    }
    
    .dz_rnav a span.dz_tip_text {
        display: none !important;
    }
    
    /* 面包屑 */
    #pt {
        padding: 8px 0 !important;
        font-size: 12px !important;
    }
    
    /* Tab 切换 */
    .tb {
        height: auto !important;
        padding: 5px 0 !important;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .tb li {
        margin-right: 5px !important;
    }
    
    .tb a {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
    
    /* 弹窗 */
    .fwinmask .fwin {
        width: 95% !important;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .p_pop {
        width: 95% !important;
        max-width: 300px;
    }
    
    /* 隐藏PC端特定元素 */
    #scrolltop { display: none !important; }
    .a_mu, .a_h { display: none !important; }
    
    /* 图片自适应 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 触摸优化 */
    a, button, .pn {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===== 平板端样式 (768px - 1023px) ===== */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .dz-mobile-only { display: none !important; }
    .dz-pc-only { display: block; }
    
    .wp {
        width: 100% !important;
        min-width: 0 !important;
        padding: 0 15px !important;
    }
    
    .dz_wide .wp {
        width: 100% !important;
    }
    
    /* 头部 */
    .dz_btm_layer {
        width: 100% !important;
        min-width: 0 !important;
        padding: 0 15px !important;
    }
    
    .dz_layer_nav {
        width: 400px !important;
    }
    
    .dz_layer_nav ul li a {
        margin-right: 15px !important;
        font-size: 14px !important;
    }
    
    /* 搜索框 */
    .header-searcher .search-input {
        width: 200px !important;
    }
    
    /* 两栏布局 */
    .ct2 .mn {
        width: 65% !important;
    }
    
    .ct2 .sd {
        width: 32% !important;
    }
    
    .dz_wide .ct2 .mn {
        width: 70% !important;
    }
    
    .dz_wide .ct2 .sd {
        width: 28% !important;
    }
    
    /* 侧边栏 */
    .appl {
        width: 140px !important;
    }
    
    .dz_wide .appl {
        width: 160px !important;
    }
    
    .ct2_a .mn {
        width: 70% !important;
    }
}

/* ===== PC端样式 (>= 1024px) ===== */
@media screen and (min-width: 1024px) {
    .dz-mobile-only { display: none !important; }
    .dz-pc-only { display: block; }
    
    /* 保持原有PC布局 */
}

/* ===== 触摸设备优化 ===== */
@media (pointer: coarse) {
    /* 增大可点击区域 */
    a, button, .pn, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 优化滚动 */
    .tb, .dz_layer_nav ul {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 禁用hover效果 */
    a:hover {
        text-decoration: none;
    }
}

/* ===== 高分辨率屏幕适配 ===== */
@media screen and (min-width: 1440px) {
    .wp {
        max-width: 1200px;
    }
    
    .dz_wide .wp {
        width: 1200px;
    }
}

@media screen and (min-width: 1920px) {
    .wp {
        max-width: 1400px;
    }
    
    .dz_wide .wp {
        width: 1400px;
    }
}

/* ===== 横屏/竖屏适配 ===== */
@media screen and (max-width: 767px) and (orientation: landscape) {
    /* 手机横屏 */
    .dz_layer_nav {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .dz_rnav,
    .dz_footc_dico,
    #scrolltop {
        display: none !important;
    }
    
    .wp {
        width: 100% !important;
    }
}

/* ===== 辅助类 ===== */
/* 清除浮动 */
.dz-clearfix:after {
    content: "";
    display: table;
    clear: both;
}

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

/* 隐藏溢出文本 */
.dz-text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 多行文本截断 */
.dz-text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dz-text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 动画效果 ===== */
.dz-transition {
    transition: all 0.3s ease;
}

/* 汉堡菜单动画 */
.dz-mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.dz-mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.dz-mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}
