@import './variables.scss';
@import './mixin.scss';
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './btn.scss';
@import './mobile.scss';

body {
  height: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}

label {
  font-weight: 700;
}

html {
  height: 100%;
  box-sizing: border-box;
}

#app {
  height: 100%;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

.no-padding {
  padding: 0px !important;
}

.padding-content {
  padding: 4px 0;
}

a:focus,
a:active {
  outline: none;
}

a,
a:focus,
a:hover {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

div:focus {
  outline: none;
}

.fr {
  float: right;
}

.fl {
  float: left;
}

.pr-5 {
  padding-right: 5px;
}

.pl-5 {
  padding-left: 5px;
}

.block {
  display: block;
}

.pointer {
  cursor: pointer;
}

.inlineBlock {
  display: block;
}

.clearfix {
  &:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
  }
}

aside {
  background: #eef1f6;
  padding: 8px 24px;
  margin-bottom: 20px;
  border-radius: 2px;
  display: block;
  line-height: 32px;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  color: #2c3e50;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  a {
    color: #337ab7;
    cursor: pointer;

    &:hover {
      color: rgb(32, 160, 255);
    }
  }
}

//main-container全局样式
.app-container {
  padding: 20px;
  
  @media (max-width: 768px) {
    padding: 10px;
  }
}

.components-container {
  margin: 30px 50px;
  position: relative;
}

.text-center {
  text-align: center
}

.sub-navbar {
  height: 50px;
  line-height: 50px;
  position: relative;
  width: 100%;
  text-align: right;
  padding-right: 20px;
  transition: 600ms ease position;
  background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);

  .subtitle {
    font-size: 20px;
    color: #fff;
  }

  &.draft {
    background: #d0d0d0;
  }

  &.deleted {
    background: #d0d0d0;
  }
}

.link-type,
.link-type:focus {
  color: #337ab7;
  cursor: pointer;

  &:hover {
    color: rgb(32, 160, 255);
  }
}

.filter-container {
  padding-bottom: 10px;

  .filter-item {
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 10px;
  }
}

// 移动端响应式优化
@media (max-width: 768px) {
  // 全局容器优化
  .app-container {
    padding: 10px !important;
  }

  .components-container {
    margin: 15px 10px !important;
  }

  // 表单优化
  .el-form {
    .el-form-item {
      margin-bottom: 18px;
    }
    
    .el-form-item__label {
      font-size: 14px;
      padding-bottom: 5px;
    }
    
    .el-input,
    .el-select,
    .el-date-picker {
      width: 100% !important;
    }
  }

  // 按钮组优化
  .el-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    
    .el-button {
      flex: 1;
      min-width: 80px;
    }
  }

  // 对话框优化
  .el-dialog {
    width: 95% !important;
    margin: 5vh auto !important;
    max-height: 90vh;
    overflow-y: auto;
    
    .el-dialog__body {
      padding: 15px;
      max-height: calc(90vh - 120px);
      overflow-y: auto;
    }
  }

  // 抽屉优化
  .el-drawer {
    width: 85% !important;
  }

  // 分页优化
  .pagination-container {
    padding: 10px 0;
    
    .el-pagination {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 5px;
      
      .el-pagination__sizes,
      .el-pagination__total,
      .el-pagination__jump {
        display: none; // 移动端隐藏部分分页信息
      }
    }
  }

  // 卡片优化
  .el-card {
    margin-bottom: 10px;
    
    .el-card__header {
      padding: 12px 15px;
      font-size: 14px;
    }
    
    .el-card__body {
      padding: 15px;
    }
  }

  // 标签页优化
  .el-tabs {
    .el-tabs__header {
      margin: 0 0 15px 0;
    }
    
    .el-tabs__item {
      padding: 0 12px;
      font-size: 14px;
    }
  }

  // 表格容器优化
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    
    .el-table {
      min-width: 600px; // 保持最小宽度，允许横向滚动
    }
  }

  // 搜索表单优化
  .search-form {
    .el-form-item {
      width: 100% !important;
      margin-right: 0 !important;
    }
  }

  // 操作按钮区域优化
  .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    
    .el-button {
      flex: 1;
      min-width: 80px;
    }
  }

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

  // 触摸优化
  * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  // 移动端卡片列表优化
  .mobile-card-list {
    background: #f5f7fa;
    padding: 12px;
  }
  
  // 移动端搜索表单优化
  .mobile-search-form {
    .search-bar {
      background: #fff;
      border-radius: 8px;
      margin-bottom: 12px;
    }
  }
  
  // 移动端按钮组优化
  .mobile-button-group {
    .mobile-buttons {
      background: #fff;
      border-radius: 8px;
      margin-bottom: 12px;
    }
  }
  
  // 移动端表格容器优化
  .table-container {
    @media (max-width: 768px) {
      .el-table {
        display: none; // 移动端隐藏表格，使用卡片视图
      }
    }
  }

  // 输入框优化（防止iOS自动缩放）
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
  }

  // 禁用文本选择（移动端长按优化）
  .no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
}

// 平板设备优化
@media (min-width: 769px) and (max-width: 1024px) {
  .app-container {
    padding: 15px !important;
  }

  .components-container {
    margin: 20px 30px !important;
  }
}