/* 响应式设计样式 */

/* 断点定义 */
:root {
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* 移动设备优先 */

/* 基础样式 */
.container {
  width: 100%;
  padding: 0 16px;
  margin: 0 auto;
}

/* 卡片布局 */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* 表格响应式 */
.table-responsive {
  overflow-x: auto;
  width: 100%;
}

/* 按钮组 */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 导航栏 */
.navbar {
  padding: 12px 16px;
}

.navbar-menu {
  display: none;
}

.navbar-mobile-menu {
  display: block;
}

/* 侧边栏 */
.sidebar {
  width: 100%;
  position: fixed;
  left: -100%;
  top: 64px;
  height: calc(100vh - 64px);
  z-index: 1000;
  transition: left 0.3s ease;
}

.sidebar.open {
  left: 0;
}

/* 内容区域 */
.content {
  padding: 16px;
}

/* 表单布局 */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-col {
  flex: 1;
}

/* 中等屏幕（平板） */
@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-group {
    flex-direction: row;
  }

  .navbar {
    padding: 16px 24px;
  }

  .content {
    padding: 24px;
  }

  .form-row {
    flex-direction: row;
  }
}

/* 大屏幕（桌面） */
@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .navbar-menu {
    display: flex;
  }

  .navbar-mobile-menu {
    display: none;
  }

  .sidebar {
    width: 256px;
    position: relative;
    left: 0;
    top: 0;
    height: 100vh;
  }

  .content {
    margin-left: 256px;
  }
}

/* 超大屏幕 */
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }

  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 触控设备优化 */
@media (hover: none) and (pointer: coarse) {
  button {
    padding: 12px 16px;
    font-size: 16px;
  }

  input, select, textarea {
    padding: 12px;
    font-size: 16px;
  }

  .card {
    padding: 20px;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0066cc;
    --text-color: #000000;
    --background-color: #ffffff;
  }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e5e7eb;
    --background-color: #1f2937;
  }
}

/* 移动端触摸交互优化 */
@media (max-width: 768px) {
  /* 触摸目标尺寸优化 - 最小44px */
  .touch-target,
  .ant-btn,
  .ant-card,
  .ant-menu-item,
  .ant-tabs-tab,
  .ant-dropdown-menu-item,
  .ant-picker-cell {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 触摸反馈 */
  .touch-feedback {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
  }
  
  .touch-feedback:active {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* 禁止选择 */
  .no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* 允许选择 */
  .allow-select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }
  
  /* 滑动列表 */
  .swipe-list {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  
  .swipe-item {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  /* 轻触反馈 */
  .tap-highlight {
    position: relative;
  }
  
  .tap-highlight::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }
  
  .tap-highlight:active::after {
    opacity: 1;
  }
  
  /* 下拉刷新 */
  .pull-to-refresh {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 滚动条隐藏但可滚动 */
  .scrollable {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  .scrollable::-webkit-scrollbar {
    display: none;
  }
  
  /* 模态框全屏 */
  .ant-modal.fullscreen-mobile {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .ant-modal.fullscreen-mobile .ant-modal-content {
    height: 100vh;
    border-radius: 0;
  }
  
  /* 移动端抽屉 */
  .ant-drawer.mobile-drawer {
    width: 85% !important;
    max-width: 400px;
  }
  
  /* 移动端表单 */
  .ant-form.mobile-form .ant-form-item {
    margin-bottom: 16px;
  }
  
  .ant-form.mobile-form .ant-form-item-label > label {
    font-size: 14px;
  }
  
  /* 移动端表格 */
  .ant-table.mobile-table .ant-table-thead > tr > th,
  .ant-table.mobile-table .ant-table-tbody > tr > td {
    padding: 12px 8px;
    font-size: 13px;
  }
  
  /* 移动端按钮 */
  .ant-btn.mobile-btn {
    height: 44px;
    padding: 0 16px;
    font-size: 15px;
  }
  
  /* 移动端输入框 */
  .ant-input.mobile-input,
  .ant-input-number.mobile-input {
    height: 44px;
    font-size: 16px;
  }
  
  /* 防止iOS缩放 */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
  }
  
  /* 移除iOS默认样式 */
  input,
  textarea,
  select {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
  }
  
  /* 安全的点击区域 */
  .safe-area-top {
    padding-top: env(safe-area-inset-top);
  }
  
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .safe-area-left {
    padding-left: env(safe-area-inset-left);
  }
  
  .safe-area-right {
    padding-right: env(safe-area-inset-right);
  }
}