/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 移动端兼容性处理 */
html {
  /* 防止iOS Safari缩放 */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  /* 优化触摸滚动 */
  -webkit-overflow-scrolling: touch;
}

body {
  /* 防止元素溢出 */
  overflow-x: hidden;
  /* 优化字体渲染 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 防止点击高亮 */
  -webkit-tap-highlight-color: transparent;
}

/* 防止所有元素水平溢出 */
* {
  max-width: 100%;
}

/* 图片响应式处理 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 表格响应式处理 */
table {
  width: 100%;
  table-layout: fixed;
  word-wrap: break-word;
}

/* 输入框防止缩放 */
input, textarea, select {
  font-size: 16px; /* 防止iOS Safari自动缩放 */
  max-width: 100%;
}

/* 长文本处理 */
.text-overflow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-break {
  word-wrap: break-word;
  word-break: break-all;
  hyphens: auto;
}

/* 移动端级联选择器全局样式 */
.mobile-cascader-popper {
  max-width: calc(100vw - 32px) !important;
  left: 16px !important;
  right: 16px !important;
  transform: none !important;
  position: fixed !important;
}

.mobile-cascader-popper .el-cascader-panel {
  max-width: 100% !important;
  overflow-x: auto !important;
  display: flex !important;
}

.mobile-cascader-popper .el-cascader-menu {
  min-width: 120px !important;
  max-width: 150px !important;
  flex-shrink: 0 !important;
}

@media (max-width: 480px) {
  .mobile-cascader-popper {
    max-width: calc(100vw - 20px) !important;
    left: 10px !important;
    right: 10px !important;
  }
  
  .mobile-cascader-popper .el-cascader-menu {
    min-width: 100px !important;
    max-width: 120px !important;
    font-size: 14px !important;
  }
  
  .mobile-cascader-popper .el-cascader-menu__item {
    padding: 8px 10px !important;
    line-height: 1.2 !important;
    font-size: 14px !important;
  }
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 链接样式 */
a {
  color: #409eff;
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: #66b1ff;
}

/* 工具类 */
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.float-left {
  float: left;
}

.float-right {
  float: right;
}

.d-block {
  display: block;
}

.d-inline {
  display: inline;
}

.d-inline-block {
  display: inline-block;
}

.d-flex {
  display: flex;
}

.d-none {
  display: none;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

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

.flex-1 {
  flex: 1;
}

/* 间距工具类 */
.m-0 { margin: 0; }
.m-5 { margin: 5px; }
.m-10 { margin: 10px; }
.m-15 { margin: 15px; }
.m-20 { margin: 20px; }
.m-30 { margin: 30px; }

.mt-0 { margin-top: 0; }
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-0 { margin-bottom: 0; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.ml-0 { margin-left: 0; }
.ml-5 { margin-left: 5px; }
.ml-10 { margin-left: 10px; }
.ml-15 { margin-left: 15px; }
.ml-20 { margin-left: 20px; }
.ml-30 { margin-left: 30px; }

.mr-0 { margin-right: 0; }
.mr-5 { margin-right: 5px; }
.mr-10 { margin-right: 10px; }
.mr-15 { margin-right: 15px; }
.mr-20 { margin-right: 20px; }
.mr-30 { margin-right: 30px; }

.p-0 { padding: 0; }
.p-5 { padding: 5px; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.pt-0 { padding-top: 0; }
.pt-5 { padding-top: 5px; }
.pt-10 { padding-top: 10px; }
.pt-15 { padding-top: 15px; }
.pt-20 { padding-top: 20px; }
.pt-30 { padding-top: 30px; }

.pb-0 { padding-bottom: 0; }
.pb-5 { padding-bottom: 5px; }
.pb-10 { padding-bottom: 10px; }
.pb-15 { padding-bottom: 15px; }
.pb-20 { padding-bottom: 20px; }
.pb-30 { padding-bottom: 30px; }

.pl-0 { padding-left: 0; }
.pl-5 { padding-left: 5px; }
.pl-10 { padding-left: 10px; }
.pl-15 { padding-left: 15px; }
.pl-20 { padding-left: 20px; }
.pl-30 { padding-left: 30px; }

.pr-0 { padding-right: 0; }
.pr-5 { padding-right: 5px; }
.pr-10 { padding-right: 10px; }
.pr-15 { padding-right: 15px; }
.pr-20 { padding-right: 20px; }
.pr-30 { padding-right: 30px; }

/* 宽度高度工具类 */
.w-100 { width: 100%; }
.w-75 { width: 75%; }
.w-50 { width: 50%; }
.w-25 { width: 25%; }

.h-100 { height: 100%; }
.h-75 { height: 75%; }
.h-50 { height: 50%; }
.h-25 { height: 25%; }

.min-h-100 { min-height: 100vh; }

/* 颜色工具类 */
.text-primary { color: #409eff; }
.text-success { color: #67c23a; }
.text-warning { color: #e6a23c; }
.text-danger { color: #f56c6c; }
.text-info { color: #909399; }
.text-muted { color: #c0c4cc; }

.bg-primary { background-color: #409eff; }
.bg-success { background-color: #67c23a; }
.bg-warning { background-color: #e6a23c; }
.bg-danger { background-color: #f56c6c; }
.bg-info { background-color: #909399; }
.bg-light { background-color: #f8f9fa; }
.bg-white { background-color: #ffffff; }

/* 边框工具类 */
.border { border: 1px solid #ebeef5; }
.border-top { border-top: 1px solid #ebeef5; }
.border-bottom { border-bottom: 1px solid #ebeef5; }
.border-left { border-left: 1px solid #ebeef5; }
.border-right { border-right: 1px solid #ebeef5; }
.border-0 { border: 0; }

.rounded { border-radius: 4px; }
.rounded-circle { border-radius: 50%; }
.rounded-0 { border-radius: 0; }

/* 阴影工具类 */
.shadow-sm {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.shadow {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

.shadow-lg {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
}

.shadow-none {
  box-shadow: none;
}

/* 过渡动画 */
.transition {
  transition: all 0.3s ease;
}

.transition-fast {
  transition: all 0.15s ease;
}

.transition-slow {
  transition: all 0.5s ease;
}

/* 鼠标样式 */
.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

/* 溢出处理 */
.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 响应式隐藏 */
@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hidden-desktop {
    display: none !important;
  }
}

/* 自定义动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.5s ease-out;
}

/* 移动端响应式工具类 */
@media (max-width: 768px) {
  /* 容器适配 */
  .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  
  /* 字体大小适配 */
  .mobile-text-sm { font-size: 12px !important; }
  .mobile-text-base { font-size: 14px !important; }
  .mobile-text-lg { font-size: 16px !important; }
  .mobile-text-xl { font-size: 18px !important; }
  
  /* 间距适配 */
  .mobile-p-2 { padding: 8px !important; }
  .mobile-p-4 { padding: 16px !important; }
  .mobile-m-2 { margin: 8px !important; }
  .mobile-m-4 { margin: 16px !important; }
  
  /* 弹性布局适配 */
  .mobile-flex-col { flex-direction: column !important; }
  .mobile-flex-wrap { flex-wrap: wrap !important; }
  
  /* 宽度适配 */
  .mobile-w-full { width: 100% !important; }
  .mobile-w-auto { width: auto !important; }
  
  /* 隐藏/显示 */
  .mobile-hidden { display: none !important; }
  .mobile-block { display: block !important; }
  
  /* 按钮适配 */
  .mobile-btn-full {
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  
  /* 卡片适配 */
  .mobile-card-compact {
    padding: 12px !important;
    margin: 8px 0 !important;
    border-radius: 8px !important;
  }
  
  /* 表单适配 */
  .mobile-form-item {
    margin-bottom: 16px !important;
  }
  
  .mobile-form-label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }
  
  /* 网格适配 */
  .mobile-grid-1 { grid-template-columns: 1fr !important; }
  .mobile-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
  
  /* 触摸优化 */
  .mobile-touch-target {
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* 小屏幕设备适配 */
@media (max-width: 480px) {
  .small-mobile-text-xs { font-size: 11px !important; }
  .small-mobile-p-1 { padding: 4px !important; }
  .small-mobile-m-1 { margin: 4px !important; }
  
  /* 更紧凑的布局 */
  .small-mobile-compact {
    padding: 8px !important;
    margin: 4px 0 !important;
  }
}

/* 横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
  .landscape-compact {
    padding: 8px !important;
    margin: 4px 0 !important;
  }
  
  .landscape-hidden {
    display: none !important;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .retina-border {
    border-width: 0.5px !important;
  }
}

/* 安全区域适配（刘海屏等） */
@supports (padding: max(0px)) {
  .safe-area-inset-top {
    padding-top: max(20px, env(safe-area-inset-top)) !important;
  }
  
  .safe-area-inset-bottom {
    padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
  }
  
  .safe-area-inset-left {
    padding-left: max(15px, env(safe-area-inset-left)) !important;
  }
  
  .safe-area-inset-right {
    padding-right: max(15px, env(safe-area-inset-right)) !important;
  }
}