/* 移动端适配基础样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100px; /* 基准字体大小，用于rem计算 */
  height: 100%;
  -webkit-text-size-adjust: 100%; /* 禁止IOS调整字体大小 */
  -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

body {
  font-size: 0.14rem; /* 基础字体大小 */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f5f5f5;
  height: 100%;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
}

/* 响应式布局辅助类 */
.container {
  width: 100%;
  padding-right: 0.15rem;
  padding-left: 0.15rem;
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 768px) {
  .container {
    max-width: 750px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 970px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1170px;
  }
}

/* 移动端常用工具类 */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.align-center {
  align-items: center;
}

.align-start {
  align-items: flex-start;
}

.align-end {
  align-items: flex-end;
}

/* 响应式显示控制 */
@media (max-width: 767px) {
  .hidden-mobile {
    display: none !important;
  }

  .visible-mobile {
    display: block !important;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .hidden-tablet {
    display: none !important;
  }

  .visible-tablet {
    display: block !important;
  }
}

@media (min-width: 992px) {
  .hidden-desktop {
    display: none !important;
  }

  .visible-desktop {
    display: block !important;
  }
}

/* 常用间距工具 */
.mt-10 { margin-top: 0.1rem; }
.mt-20 { margin-top: 0.2rem; }
.mt-30 { margin-top: 0.3rem; }
.mt-40 { margin-top: 0.4rem; }

.mb-10 { margin-bottom: 0.1rem; }
.mb-20 { margin-bottom: 0.2rem; }
.mb-30 { margin-bottom: 0.3rem; }
.mb-40 { margin-bottom: 0.4rem; }

.pt-10 { padding-top: 0.1rem; }
.pt-20 { padding-top: 0.2rem; }
.pt-30 { padding-top: 0.3rem; }
.pt-40 { padding-top: 0.4rem; }

.pb-10 { padding-bottom: 0.1rem; }
.pb-20 { padding-bottom: 0.2rem; }
.pb-30 { padding-bottom: 0.3rem; }
.pb-40 { padding-bottom: 0.4rem; }

/* 安全区域适配（iPhone X及以上） */
@supports (padding: max(0px)) {
  .safe-area-top {
    padding-top: max(0.15rem, env(safe-area-inset-top));
  }

  .safe-area-bottom {
    padding-bottom: max(0.15rem, env(safe-area-inset-bottom));
  }

  .safe-area-left {
    padding-left: max(0.15rem, env(safe-area-inset-left));
  }

  .safe-area-right {
    padding-right: max(0.15rem, env(safe-area-inset-right));
  }
}

/* 防止长按菜单 */
* {
  -webkit-touch-callout: none; /* 禁止长按链接与图片弹出菜单 */
  -webkit-user-select: none; /* 禁止选中文本 */
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 允许输入框文本选择 */
input, textarea {
  -webkit-user-select: auto !important;
  -khtml-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  user-select: auto !important;
}

/* 移动端滚动条优化 */
::-webkit-scrollbar {
  width: 0.03rem;
  height: 0.03rem;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0.1rem;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 0.1rem;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 图片响应式 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 链接样式 */
a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:hover, a:active {
  text-decoration: none;
}

/* 输入框placeholder颜色 */
::-webkit-input-placeholder {
  color: #999;
}

::-moz-placeholder {
  color: #999;
}

:-ms-input-placeholder {
  color: #999;
}

:-moz-placeholder {
  color: #999;
}

/* 清除浮动 */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* 单行省略 */
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 多行省略（2行） */
.ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 移动端点击效果 */
.tap-active:active {
  opacity: 0.7;
}
