/* 左图右史布局（App Shell + Master-Detail）—— 规格见 _helper/左图右史布局.md
   四段式：顶栏固定 + 面包屑(.site-breadcrumb) + 中间主体（左图 / 右史） + 底部状态栏；
   整页不滚动（S2），滚动只发生在右栏内层（分栏页 .right-scroll）或主体自身（文本页 / ≤900px 降级）。
   由 theme_base_66 的 page_css 块按详情页引入（mapic/mapic_detail、mapic/pictile_detail、
   map_tor/data_detail_66），必须排在 osgeo_style.css 之后，
   用于覆盖其中 .map-div / .scrollable-content 的 fixed 半屏基线。
   两栏目详情页共用本文件，勿在单个模板里再写一份同规格样式。 */

:root {
  /* 由 theme_base_68 的脚本按 .osgeo-nav 实际高度同步（分类换行 / 移动端展开会变高） */
  --site-navbar-h: 58px;
  --site-statusbar-h: 30px;
}

html,
body {
  height: 100%;
  /* S2：整页不滚动，滚动只发生在内部滚动容器 */
  overflow: hidden;
}

/* S1/S3：顶栏贴 y=0、底栏贴视口底边，主体占满剩余空间（不留白、不出第二屏） */
body.mapic-shell {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--site-navbar-h, 58px);
}

/* S1/S3：面包屑独立段（顶栏与主体之间）。子模板未输出面包屑时整段隐藏，
   不占用主体高度；主体高度 = 视口 − 顶栏 − 面包屑 − 底栏 由 flex 自动得出。
   段的观感（内边距 / 灰底胶囊 / :empty 隐藏）由 theme_base_66 统一给出，
   保证 maplet 与 mapic 两个详情页的面包屑对齐方式一致；此处只管不被压缩。 */
.site-breadcrumb {
  flex: 0 0 auto;
}

/* 主体：文本页自身是滚动容器（R1/R4 同规格），分栏页改由 body.has-map 接管。
   同时是纵向 flex 容器：让版权页脚在内容不满一屏时仍贴住主体底边
   （osgeo_style 的 footer{margin-top:auto} 依赖父级为 flex 才生效） */
.map_zhuti {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

/* 文本页正文按内容高度参与布局，不被压缩（超出时由 .map_zhuti 滚动） */
.map_zhuti > .container-xxl {
  flex: 0 0 auto;
}

/* 内容不满一屏时版权页脚贴住主体底边：osgeo_style 的 footer{margin-top:auto}
   被 .foot-wrap{margin-top:20px} 覆盖，这里用更高特异性恢复 */
.map_zhuti > .foot-wrap {
  margin-top: auto;
}

body.has-map .map_zhuti {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* 底栏已是 body 级独立段：主体内不再留 pb-3 缝隙，两栏贴住状态栏上沿。
     theme_66 的 .map_zhuti 带 Bootstrap pb-3（padding-bottom:1rem!important），
     必须同为 !important 才盖得住，否则底栏上方会多出 16px 空白 */
  padding-bottom: 0 !important;
}

/* maplet 详情页主体容器（gislite_map_base 的 .main.ms-4.pt-3）在分栏页归零，
   与 mapic 的 .map_zhuti 同口径：左右贴边、顶部不留白（Bootstrap 工具类带 !important，
   需同为 !important 且更高特异性才能盖掉） */
body.has-map .main {
  margin-left: 0 !important;
  padding-top: 0 !important;
}

/* 分栏容器：左图（固定）+ 右史（独立滚动） */
.map-split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* —— 移动优先（≤900px，规格 M1/M2）：地图在上约 60vh，文本在下，
      主体区自身滚动，顶栏/底栏仍固定 —— */
.map-split > .map-div {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
  flex: 0 0 auto;
  width: auto;
  height: 60vh;
  min-height: 0;
  padding: 0.5rem;
  box-sizing: border-box;
  overflow: hidden;
}

.map-split > .map-div > #maplet {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.map-split > .scrollable-content {
  position: static;
  margin-left: 0;
  margin-top: 0;
  width: auto;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  overscroll-behavior: auto;
  padding-top: 0;
}

/* R1：右栏 = 固定区（.right-head：标题+元数据） + 独立滚动容器（.right-scroll：正文）。
   head 必须 flex-shrink:0——否则正文超高时会被负剩余空间压扁 */
.map-split .right-head {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.map-split .right-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: visible;
  overscroll-behavior: auto;
}

.map-split .main-content {
  padding: 0.75rem 1rem 2rem;
}

/* —— ≥901px（规格 S4/L1/R1/R3/R4）：左右各半、等高铺满主体，
      左栏随滚动完全不动，右栏 overflow-y:auto + overscroll-behavior:contain —— */
@media (min-width: 901px) {
  .map-split {
    flex-direction: row;
  }
  .map-split > .map-div {
    flex: 0 0 50%;
    width: 50%;
    height: auto;
    align-self: stretch;
  }
  .map-split > .scrollable-content {
    flex: 0 0 50%;
    width: 50%;
    height: auto;
    overflow: hidden;
  }
  /* R1：右栏固定区（标题+元数据）不随正文滚动；
     max-height 兜底——标题/元数据过长时自身可滚，避免把正文区压没 */
  .map-split .right-head {
    flex: 0 0 auto;
    max-height: 50%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }
  .map-split .right-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* L3：未声明地图（如舆图下无切片条目）时左栏整块不占位，右栏铺满主体区 */
.map-split.map-split-empty > .map-div {
  display: none;
}

.map-split.map-split-empty > .scrollable-content {
  flex: 1 1 100%;
  width: 100%;
}

/* L3：参数容器 #mapdiv 恒不占位（它在右栏正文里，原选择器误写成 .map-div 后代） */
.map-split #mapdiv {
  display: none;
}

/* S1/I4：底部状态栏（贴视口底，实时反映当前图层 / 缩放 / 中心点） */
.site-statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  min-height: var(--site-statusbar-h, 30px);
  padding: 0.2rem 0.75rem;
  background-color: #232b33;
  color: #dde0e9;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow: hidden;
}

.site-statusbar .status-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  white-space: nowrap;
}

.site-statusbar .status-value {
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-statusbar .status-label {
  color: #9aa4b2;
}

/* 无地图页面（首页 / 列表 / 登录等）只保留站点信息，不展示空的地图状态 */
body.no-map .status-map {
  display: none;
}

/* M1：≤900px 堆叠后由主体区自身滚动（map_zhuti 接管，顶/底栏仍固定）；
   .map-split 只增长不收缩（flex-shrink:0），保证长文本不被裁切 */
@media (max-width: 900px) {
  body.has-map .map_zhuti {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .map-split {
    flex: 1 0 auto;
  }
  /* M3：底栏压成单行——隐藏冗余信息 + 省略号，不挤占主体高度 */
  .site-statusbar {
    gap: 0.5rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
  }
  .site-statusbar .status-item {
    flex: 0 1 auto;
  }
  /* 无地图页必须保留站点信息，否则底栏全空；有真实地图时隐藏版权行，
     把单行空间留给图层名。按 no-map 判定——分栏页模板写的是 has-map，
     但舆图无切片（app.js 判定无 map_obj）时会再补上 no-map，此时同样要显示站点信息 */
  .site-statusbar .status-optional {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body:not(.no-map) .site-statusbar .status-optional {
    display: none;
  }
}

/* I1/I2：右栏地图清单点击行 → 左栏切换地图；行内“查看详情”链接不触发行切换 */
/* I1：右栏切片清单行 = 可点的“切换左侧地图”项。
   行尾常驻一个主色浅底的切换图标（悬停 / 激活时反白成实底），配合光标、
   hover 底色与激活行左侧竖条，让用户一眼看出行是可点的 */
body.has-map #pic-tile-list > li {
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  border-left: 3px solid transparent;
  transition:
    background-color 0.15s ease-in-out,
    border-left-color 0.15s ease-in-out;
}

body.has-map #pic-tile-list > li:hover {
  background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.08);
}

body.has-map #pic-tile-list .pic-tile-switch {
  margin-left: 0.5rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.75em;
  line-height: 1;
  border-radius: 0.25rem;
  color: var(--bs-primary, #0d6efd);
  background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.12);
  transition:
    background-color 0.15s ease-in-out,
    color 0.15s ease-in-out;
}

body.has-map #pic-tile-list > li:hover .pic-tile-switch,
body.has-map #pic-tile-list > li.row-active .pic-tile-switch {
  color: #ffffff;
  background-color: var(--bs-primary, #0d6efd);
}

body.has-map #pic-tile-list > li.row-active {
  background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.12);
  border-left-color: var(--bs-primary, #0d6efd);
}

body.has-map #pic-tile-list > li a {
  cursor: pointer;
}
