/*
* demo.css
* File include item demo only specific css only
******************************************************************************/

.menu .app-brand.demo {
  height: 64px;
  margin-top: 12px;
}

.app-brand-logo.demo svg {
  width: 22px;
  height: 38px;
}

.app-brand-text.demo {
  font-size: 1.75rem;
  letter-spacing: -0.5px;
  text-transform: lowercase;
}

/* ! For .layout-navbar-fixed added fix padding top tpo .layout-page */
/* Detached navbar */
.layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page {
  padding-top: 76px !important;
}
/* Default navbar */
.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page {
  padding-top: 64px !important;
}

/* Navbar page z-index issue solution */
.content-wrapper .navbar {
  z-index: auto;
}

/*
* Content
******************************************************************************/

.demo-blocks > * {
  display: block !important;
}

.demo-inline-spacing > * {
  margin: 1rem 0.375rem 0 0 !important;
}

/* ? .demo-vertical-spacing class is used to have vertical margins between elements. To remove margin-top from the first-child, use .demo-only-element class with .demo-vertical-spacing class. For example, we have used this class in forms-input-groups.html file. */
.demo-vertical-spacing > * {
  margin-top: 1rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-lg > * {
  margin-top: 1.875rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-lg.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-xl > * {
  margin-top: 5rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-xl.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.rtl-only {
  display: none !important;
  text-align: left !important;
  direction: ltr !important;
}

[dir='rtl'] .rtl-only {
  display: block !important;
}

/*
* Layout demo
******************************************************************************/

.layout-demo-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  margin-top: 1rem;
}
.layout-demo-placeholder img {
  width: 900px;
}
.layout-demo-info {
  text-align: center;
  margin-top: 1rem;
}

/*
 * 通用：小屏幕下将宽表格折叠为卡片式显示
 * 仅对带有 .table-mobile-stacked 的表格生效
 */
@media (max-width: 767.98px) {
  .table-mobile-stacked thead {
    display: none;
  }

  .table-mobile-stacked tbody {
    display: block;
  }

  .table-mobile-stacked tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid #e4e4e4;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #ffffff;
  }

  .table-mobile-stacked tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: 0;
    white-space: normal;
  }

  .table-mobile-stacked tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #666666;
    margin-right: 0.5rem;
    flex: 0 0 auto;
    max-width: 7em;
    white-space: nowrap;
  }
} /* ← 补上缺失的右花括号：之前它把下面整段手机端 CSS 吞进了 767px 媒体查询导致平板/手机样式大面积失效 */

/*
 * 全局手机端适配（所有后台页面共用 demo.css）
 * 目标：管理员在手机浏览器也能正常录入、点按钮、看表格
 */
@media (max-width: 991.98px) {
  .container-xxl {
    padding-left: 12px;
    padding-right: 12px;
  }
  .card-body {
    padding: 14px 12px;
  }
  /* 顶部标题栏在手机上纵向排列，按钮独占一行 */
  .d-flex.justify-content-between.align-items-center.mb-3,
  .dp-page-head {
    flex-wrap: wrap;
    gap: 10px;
  }
  /* 表单一行一列，输入框放大到可点 */
  form.row > [class*="col-"] {
    margin-bottom: 2px;
  }
  .form-control,
  .form-select {
    min-height: 42px;
    font-size: 15px;
  }
  textarea.form-control {
    min-height: 88px;
  }
  /* 按钮组允许换行，手机上更好点 */
  .btn-group {
    flex-wrap: wrap;
  }
  .btn {
    min-height: 38px;
  }
  /* 弹窗在手机上接近全屏 */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  .modal-dialog-centered {
    min-height: calc(100% - 1rem);
  }
  /* 详情类大弹窗内容可滚动 */
  .modal-dialog-scrollable .modal-body {
    max-height: calc(100vh - 120px);
  }
  /* 顶部导航标题过长时省略 */
  #layout-navbar .navbar-brand {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 62vw;
  }
  /* 所有横向表格允许手指滑动，且不挤压 */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  .table {
    font-size: 13px;
  }
  .table th,
  .table td {
    white-space: nowrap;
  }
  .table td.wrap,
  .table th.wrap {
    white-space: normal;
  }
  /* 筛选栏按钮独占一行 */
  .drv-filter-card .btn,
  .card-body .btn-primary,
  .card-body .btn-secondary {
    min-height: 40px;
  }
  /* 页脚不占空间 */
  .content-footer {
    padding-bottom: 24px;
  }
}

/* 小屏手机：筛选表单强制单列 */
@media (max-width: 575.98px) {
  form.row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
  .row.g-2 > [class*="col-8"],
  .row.g-2 > [class*="col-4"] {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* 弹窗底部按钮上下排 */
  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-footer .btn {
    width: 100%;
    margin-left: 0 !important;
    padding: 11px 0;
  }
}

/* ============================================================
 * 统一样式：所有后台页面一致的手机端抽屉菜单 + 页面结构
 * 解决“手机和电脑看起来像两个站点 / 有的页面能滑出菜单有的不行”
 * ============================================================ */
@media (max-width: 1199.98px) {
  /* 侧栏变抽屉：默认收起，点击汉堡滑出 */
  .layout-menu {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    margin-right: 0 !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1100;
    width: 260px;
  }
  html.layout-menu-expanded .layout-menu {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }
  .layout-page {
    padding-left: 0 !important;
    width: 100%;
  }
  /* 遮罩：菜单展开时显示，点击关闭 */
  .layout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1090;
    display: none;
  }
  html.layout-menu-expanded .layout-overlay {
    display: block;
  }
  /* 顶部栏在手机上始终可见汉堡按钮 */
  .layout-menu-toggle {
    display: flex !important;
  }
  /* 统一的页面头：标题 + 操作按钮，手机上换行不挤 */
  .jshy-page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .jshy-page-head .jshy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .jshy-page-head .jshy-actions .btn {
    min-height: 40px;
  }
  /* 没有 .table-mobile-stacked 的老表格：保底横滑，不把页面撑爆 */
  .card .table:not(.table-mobile-stacked) {
    font-size: 13px;
  }
}

