/* ============================================================
   6SQ 海外站 · 响应式移动端层
   设计参考：主站 m3 手机版（顶栏 + 横排 tab + 单列卡片流 + 底部固定导航）
   生效范围：仅 ≤767px 手机；桌面端完全不受影响
   风格约束：不用阴影/渐变，纯细线边框 + 品牌绿
   ============================================================ */

/* 底部 tab 导航默认桌面端隐藏，仅移动端（≤767px）显示 */
.m-tabbar { display: none; }

@media (max-width: 767px) {

  /* 容器满宽，收紧安全边距 */
  .container { padding-left: 10px; padding-right: 10px; }

  /* —— 顶部栏吸顶（sticky，不占魔法 padding） —— */
  .aw-top-menu-wrap {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #E3E8E6;
  }
  .aw-top-menu-wrap > .container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* 桌面端那个只包隐藏 logo/nav 的外层空容器，移动端不占位 */
  body > .container:empty { display: none; }

  /* 隐藏无接线的汉堡按钮（导航改为常驻横排 tab） */
  .navbar-toggle { display: none !important; }

  /* 第一行：搜索框（主）+ 用户/发布（辅） */
  .aw-search-box.hidden-xs {
    display: block !important;
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
  }
  .aw-search-box .navbar-search { width: 100%; }
  .aw-search-box .search-query {
    width: 100%;
    box-sizing: border-box;
    height: 38px;
  }

  /* 用户栏只保留头像，名字隐藏 */
  .aw-user-nav {
    order: 2;
    flex: 0 0 auto;
    margin-left: 8px;
  }
  .aw-user-nav .aw-user-nav-dropdown img {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: block;
  }
  .aw-user-nav .aw-user-nav-dropdown font { display: none; }
  /* 未登录时的登录/注册按钮缩小间距 */
  .aw-user-nav .login,
  .aw-user-nav .register { padding: 6px 10px; font-size: 13px; }

  /* 发布按钮：简化文字/图标 */
  .aw-publish-btn {
    order: 3;
    flex: 0 0 auto;
    margin-left: 8px;
  }
  .aw-publish-btn a#header_publish {
    display: inline-block;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 4px;
    white-space: nowrap;
  }

  /* 主导航横条在移动端隐藏：页面切换由底部固定 tab 承担（对标 m4） */
  .aw-top-nav.navbar { display: none !important; }
  .bs-navbar-collapse.collapse {
    display: none !important;
  }
  .aw-top-nav.navbar .nav.navbar-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
    border-bottom: 1px solid #E3E8E6;
  }
  .aw-top-nav.navbar .nav.navbar-nav > li { flex: 0 0 auto; }
  .aw-top-nav.navbar .nav.navbar-nav > li > a {
    padding: 8px 14px;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent !important;
    color: #1F2329;
  }
  /* 覆盖 header.tpl.htm 内联 .active 绿底白字 */
  .aw-top-nav.navbar .nav.navbar-nav > li > a.active,
  .aw-top-nav.navbar .nav.navbar-nav > li > a:hover,
  .aw-top-nav.navbar .nav.navbar-nav > li > a:focus {
    border-bottom-color: #3B7C33 !important;
    color: #2C5E27 !important;
    background: transparent !important;
  }

  /* —— 底部固定 tab 导航（对标 m4 .nav） —— */
  .m-tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1031;
    height: 52px;
    background: #fff;
    border-top: 1px solid #E3E8E6;
    padding: 0;
    margin: 0;
  }
  .m-tabbar .m-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #5B6470;
    text-decoration: none;
    font-size: 11px;
    line-height: 1;
  }
  .m-tabbar .m-tab i.icon {
    font-size: 20px;
    line-height: 1;
  }
  .m-tabbar .m-tab.active { color: #2C5E27; }
  .m-tabbar .m-tab.active i.icon { color: #3B7C33; }

  /* 内容区底部留白，防被固定底栏遮挡 */
  body { padding-bottom: 52px; }

  /* —— 列表卡片对标 m4：覆盖 list.tpl.htm 内联浅绿底/左侧徽章 —— */
  .aw-main-content {
    background: #fff !important;
    border-right: 1px solid #E3E8E6 !important;
  }
  .aw-common-list .aw-item {
    position: static !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid #E3E8E6;
  }
  .aw-common-list .aw-question-replay-count { display: none !important; }
  .aw-common-list .aw-question-content h4 {
    font-size: 16px;
    line-height: 1.45;
    margin: 0 0 6px;
  }
  .aw-common-list .aw-question-content .text-color-999 {
    font-size: 12px;
  }

  /* —— 内容区单列满宽 —— */
  .aw-main-content,
  .col-md-9,
  .col-sm-12 { width: 100% !important; padding-left: 0; padding-right: 0; }

  /* 移动端不显示侧栏（m3 无侧栏；如需保留可删此条，侧栏会堆叠到内容下方） */
  .aw-side-bar { display: none; }

  /* 列表 / 卡片 移动适配 */
  body { font-size: 15px; }
  img { max-width: 100%; height: auto; }
  .aw-item { padding: 12px 0; border-bottom: 1px solid #E3E8E6; }
  .aw-item .aw-title,
  .aw-question-title { font-size: 16px; line-height: 1.4; }
  .aw-feed-list .aw-item a,
  .aw-content-wrap a { min-height: 44px; }

  /* 表格 / 代码块 横向滚动，避免撑破视口 */
  .aw-question-detail table,
  .aw-answer table,
  pre {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 分类导航 → 胶囊（m3 channels 风格） */
  .category .list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
  }
  .category .list li { display: inline-block; }
  .category .list li a {
    display: block;
    padding: 6px 10px;
    background: #F4F7F4;
    border: 1px solid #E3E8E6;
    border-radius: 4px;
    font-size: 13px;
    color: #1F2329;
  }

  /* —— 塔层 tab 横排可滚（m3 风格） —— */
  /* 修正：aw-nav-tabs 是直接加在 ul 上的类（<ul class="nav nav-tabs aw-nav-tabs">），不是父容器 */
  .nav.nav-tabs.aw-nav-tabs,
  .aw-tabs ul {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #E3E8E6;
  }
  .nav.nav-tabs.aw-nav-tabs > li,
  .aw-tabs li { flex: 0 0 auto; white-space: nowrap; }
  .nav.nav-tabs.aw-nav-tabs > li > a,
  .aw-tabs li a {
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 12px;
    margin: 0;
    background: transparent;
  }
  .nav.nav-tabs.aw-nav-tabs > li.active > a,
  .nav.nav-tabs.aw-nav-tabs > li > a:hover,
  .aw-tabs li.active a,
  .aw-tabs li a:hover {
    border-bottom-color: #3B7C33;
    color: #2C5E27;
    background: transparent;
  }

  /* —— footer 单列 —— */
  .p88-foot .p88-foot-main { grid-template-columns: 1fr; gap: 18px; padding: 28px 16px; }
  .p88-foot .qr { justify-content: flex-start; }
  .p88-foot .qr img { width: 140px; height: 140px; }
  .p88-copy { font-size: 12px; line-height: 1.7; }

  /* —— 登录注册卡片 / 表单整宽 —— */
  .aw-login-wrap,
  .aw-register-wrap,
  .col-md-6.col-md-offset-3,
  .aw-publish-container,
  #question_form textarea,
  #question_form input[type=text] { width: 100% !important; box-sizing: border-box; }

  /* —— question 详情正文排版 —— */
  .aw-question-detail .aw-question-content,
  .aw-question-detail .aw-question-description { font-size: 15px; line-height: 1.7; }
  .aw-answer-content { font-size: 15px; line-height: 1.7; }
  .aw-question-recommend .aw-question-title { font-size: 15px; }

  /* —— 个人主页 mobile 修复 —— */
  /* hero 已改为纯色渐变（无背景图），手机端保留色块但压缩高度、文字居中 */
  .aw-icon-top { display: block !important; height: 110px; }
  .aw-icon-top .aw-username { padding: 14px 16px !important; text-align: center; }
  .aw-icon-top .aw-username strong { font-size: 18px; }
  .aw-user-detail-box > .mod-head {
    padding: 16px 0;
    overflow: hidden;
    text-align: center;
  }
  .aw-user-detail-box > .mod-head > img,
  .aw-user-detail-box > .mod-head a > img {
    float: none !important;
    display: block;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 4px;
  }
  .aw-user-detail-box > .mod-head h1 {
    font-size: 18px;
    line-height: 1.5;
    margin: 0 0 10px;
    word-break: break-word;
  }
  .aw-user-detail-box > .mod-head h1 img,
  .aw-user-detail-box > .mod-head h1 .icon-v,
  .aw-user-detail-box > .mod-head h1 .aw-vip-badge {
    vertical-align: middle;
    margin: 0 2px;
  }
  .aw-user-detail-box > .mod-head .operate {
    float: none !important;
    display: block;
    text-align: center;
    margin-bottom: 10px;
  }
  .aw-user-detail-box > .mod-head .operate .btn {
    margin: 4px 2px;
  }
  .aw-user-detail-box > .mod-head .text-color-999,
  .aw-user-detail-box > .mod-head .aw-user-flag,
  .aw-user-detail-box > .mod-head .aw-user-flag > span {
    display: inline-block;
    font-size: 13px;
    line-height: 1.6;
    margin: 2px 4px;
  }
  .aw-user-detail-box .aw-nav-tabs.nav-tabs > li.hidden-xs,
  .aw-user-detail-box .aw-nav-tabs.nav-tabs > li.hidden-sm { display: none !important; }

  /* —— 设置页 mobile 修复 —— */
  .aw-user-setting .tabbable > .nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .aw-user-setting .tabbable > .nav-tabs > li {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  /* setting_header.tpl.htm 里 h2 放在 ul 内部，移动端把它藏掉，避免 tab 被挤下来 */
  .aw-user-setting .tabbable > .nav-tabs > h2 { display: none; }
  .aw-user-setting .form-horizontal .form-group { margin-left: 0; margin-right: 0; }
  .aw-user-setting .form-horizontal .row { margin-left: 0; margin-right: 0; }
  .aw-user-setting .form-horizontal .col-lg-4,
  .aw-user-setting .form-horizontal .col-md-4,
  .aw-user-setting .form-horizontal .col-sm-4,
  .aw-user-setting .form-horizontal .col-xs-4 {
    width: 100% !important;
    padding-left: 0;
    padding-right: 0;
  }
  .aw-user-setting .form-horizontal .form-control,
  .aw-user-setting .form-horizontal input[type="password"],
  .aw-user-setting .form-horizontal input[type="text"] {
    width: 100% !important;
    box-sizing: border-box;
    height: 42px;
  }
  .aw-user-setting .mod-footer .btn.pull-right {
    float: none !important;
    width: 100%;
    height: 44px;
    margin-top: 12px;
  }
}

/* ============================================================
   6SQ 海外站 · ≤480px 小屏细化（更早手机）
   ============================================================ */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .btn { font-size: 14px; }

  /* 发布按钮更醒目、问题标题更大 */
  .aw-item .aw-title,
  .aw-question-title { font-size: 17px; line-height: 1.45; }
  .aw-feed-list .aw-item,
  .aw-question-recommend .aw-item { padding: 14px 0; }

  /* logo/返回等收窄 */
  .aw-logo img { max-height: 40px; }

  /* 头像操作行可换行 */
  .aw-actions .aw-btn,
  .aw-res-btn a { white-space: nowrap; }

  /* 详情页 tag/按钮不留出 */
  .aw-question-detail .mod-head { padding: 12px 4px; }
}
