/* ========================================
   Tx Flex 布局通用工具类
   前缀: tx-
   ======================================== */

/* ========== 容器 display ========== */
.tx-flex {
  display: flex;
}

.tx-inline-flex {
  display: inline-flex;
}

/* ========== 方向 ========== */
.tx-flex-row {
  flex-direction: row;
}

.tx-flex-row-reverse {
  flex-direction: row-reverse;
}

.tx-flex-col {
  flex-direction: column;
}

.tx-flex-col-reverse {
  flex-direction: column-reverse;
}

/* ========== 换行 ========== */
.tx-flex-nowrap {
  flex-wrap: nowrap;
}

.tx-flex-wrap {
  flex-wrap: wrap;
}

.tx-flex-wrap-reverse {
  flex-wrap: wrap-reverse;
}

/* ========== 主轴对齐 (justify-content) ========== */
.tx-justify-start {
  justify-content: flex-start;
}

.tx-justify-end {
  justify-content: flex-end;
}

.tx-justify-center {
  justify-content: center;
}

.tx-justify-between {
  justify-content: space-between;
}

.tx-justify-around {
  justify-content: space-around;
}

.tx-justify-evenly {
  justify-content: space-evenly;
}

/* ========== 交叉轴对齐 (align-items) ========== */
.tx-items-start {
  align-items: flex-start;
}

.tx-items-end {
  align-items: flex-end;
}

.tx-items-center {
  align-items: center;
}

.tx-items-baseline {
  align-items: baseline;
}

.tx-items-stretch {
  align-items: stretch;
}

/* ========== 多行对齐 (align-content) ========== */
.tx-content-start {
  align-content: flex-start;
}

.tx-content-end {
  align-content: flex-end;
}

.tx-content-center {
  align-content: center;
}

.tx-content-between {
  align-content: space-between;
}

.tx-content-around {
  align-content: space-around;
}

.tx-content-stretch {
  align-content: stretch;
}

/* ========== 项目属性 ========== */
/* 排序 */
.tx-order-1 {
  order: 1;
}

.tx-order-2 {
  order: 2;
}

.tx-order-3 {
  order: 3;
}

.tx-order-first {
  order: -1;
}

.tx-order-last {
  order: 999;
}

/* 放大比例 */
.tx-grow {
  flex-grow: 1;
}

.tx-grow-0 {
  flex-grow: 0;
}

/* 缩小比例 */
.tx-shrink {
  flex-shrink: 1;
}

.tx-shrink-0 {
  flex-shrink: 0;
}

/* 固定宽度（不放大不缩小） */
.tx-flex-none {
  flex: none;
}

/* 自适应 */
.tx-flex-auto {
  flex: 1 1 auto;
}

/* 等分剩余空间 */
.tx-flex-1 {
  flex: 1;
}

/* 项目单独对齐 (align-self) */
.tx-self-auto {
  align-self: auto;
}

.tx-self-start {
  align-self: flex-start;
}

.tx-self-end {
  align-self: flex-end;
}

.tx-self-center {
  align-self: center;
}

.tx-self-baseline {
  align-self: baseline;
}

.tx-self-stretch {
  align-self: stretch;
}

/* ========== 常用组合工具 ========== */
/* 完全居中（水平+垂直） */
.tx-flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 垂直居中，水平两端对齐 */
.tx-flex-between-center {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 垂直居中，水平起点 */
.tx-flex-start-center {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* 垂直居中，水平终点 */
.tx-flex-end-center {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* 垂直居中，水平均匀分布 */
.tx-flex-around-center {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

/* 垂直居中，水平均匀间隔 */
.tx-flex-evenly-center {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

/* 垂直列居中 */
.tx-flex-col-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* 垂直列两端对齐 */
.tx-flex-col-between {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 网格等分布局 */
.tx-flex-grid {
  display: flex;
  flex-wrap: wrap;
}

.tx-flex-grid > * {
  flex: 1;
}

/* ========== 间距工具 (gap) ========== */
.tx-gap-0 {
  gap: 0;
}

.tx-gap-1 {
  gap: 0.25rem;
}

.tx-gap-2 {
  gap: 0.5rem;
}

.tx-gap-3 {
  gap: 0.75rem;
}

.tx-gap-4 {
  gap: 1rem;
}

.tx-gap-5 {
  gap: 1.25rem;
}

.tx-gap-6 {
  gap: 1.5rem;
}

.tx-gap-8 {
  gap: 2rem;
}

.tx-gap-10 {
  gap: 2.5rem;
}

.tx-gap-12 {
  gap: 3rem;
}

/* 行/列独立间距 */
.tx-gap-x-1 {
  column-gap: 0.25rem;
}

.tx-gap-x-2 {
  column-gap: 0.5rem;
}

.tx-gap-x-4 {
  column-gap: 1rem;
}

.tx-gap-y-1 {
  row-gap: 0.25rem;
}

.tx-gap-y-2 {
  row-gap: 0.5rem;
}

.tx-gap-y-4 {
  row-gap: 1rem;
}

/* ========== 边距工具 (margin/padding 辅助) ========== */
.tx-m-0 {
  margin: 0;
}

.tx-m-1 {
  margin: 0.25rem;
}

.tx-m-2 {
  margin: 0.5rem;
}

.tx-m-4 {
  margin: 1rem;
}

.tx-m-auto {
  margin: auto;
}

.tx-mt-auto {
  margin-top: auto;
}

.tx-mb-auto {
  margin-bottom: auto;
}

.tx-ml-auto {
  margin-left: auto;
}

.tx-mr-auto {
  margin-right: auto;
}

.tx-p-0 {
  padding: 0;
}

.tx-p-1 {
  padding: 0.25rem;
}

.tx-p-2 {
  padding: 0.5rem;
}

.tx-p-4 {
  padding: 1rem;
}

/* ========================================
   经典布局模式
   ======================================== */

/* 圣杯布局（三列等高等宽） */
.tx-l-holy-grail {
  display: flex;
}

.tx-l-holy-grail > * {
  flex: 1;
}

/* 粘性底部布局 */
.tx-l-sticky-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.tx-l-sticky-footer > main,
.tx-l-sticky-footer > .tx-main {
  flex: 1;
}

/* 两列布局（左侧固定，右侧自适应） */
.tx-l-sidebar-fixed {
  display: flex;
}

.tx-l-sidebar-fixed > .tx-sidebar,
.tx-l-sidebar-fixed > [class*="tx-sidebar"] {
  flex: none;
  width: 250px;
}

.tx-l-sidebar-fixed > .tx-content,
.tx-l-sidebar-fixed > [class*="tx-content"] {
  flex: 1;
}

/* 两列布局（左侧自适应，右侧固定） */
.tx-l-sidebar-fixed-reverse {
  display: flex;
}

.tx-l-sidebar-fixed-reverse > .tx-content {
  flex: 1;
}

.tx-l-sidebar-fixed-reverse > .tx-sidebar {
  flex: none;
  width: 250px;
}

/* 卡片网格布局 */
.tx-l-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tx-l-card-grid > * {
  flex: 1 1 calc(33.333% - 1rem);
  min-width: 250px;
}

/* 导航栏布局 */
.tx-l-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ========== 响应式断点辅助 ========== */
@media (max-width: 768px) {
  .tx-flex-col-mobile {
    flex-direction: column;
  }
  
  .tx-flex-wrap-mobile {
    flex-wrap: wrap;
  }
  
  .tx-justify-center-mobile {
    justify-content: center;
  }
  
  .tx-items-center-mobile {
    align-items: center;
  }
  
  .tx-l-card-grid > * {
    flex-basis: calc(50% - 1rem);
  }
}

@media (max-width: 480px) {
  .tx-l-card-grid > * {
    flex-basis: 100%;
  }
}

/* ========== 辅助工具 ========== */
/* 隐藏滚动条（保持滚动功能） */
.tx-scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tx-scrollbar-none::-webkit-scrollbar {
  display: none;
}

/* 文本截断 */
.tx-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 最小高度100vh */
.tx-min-h-screen {
  min-height: 100vh;
}

/* 宽度100% */
.tx-w-full {
  width: 100%;
}

/* 高度100% */
.tx-h-full {
  height: 100%;
}