/* 全局响应式样式 - 手机端/电脑端自适应 */

/* 基础重置 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html {
  font-size: 16px;
}

body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 容器自适应 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 手机端（默认） */
@media screen and (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 0 12px;
  }
  
  /* 隐藏电脑端元素 */
  .desktop-only {
    display: none !important;
  }
  
  /* 表格横向滚动 */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* 侧边栏改为底部导航 */
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    padding: 8px 0 !important;
    display: flex !important;
    justify-content: space-around !important;
    z-index: 999 !important;
  }
  
  .sidebar .logo {
    display: none !important;
  }
  
  .sidebar .menu-item {
    padding: 8px 4px !important;
    font-size: 11px !important;
    flex-direction: column !important;
    gap: 2px !important;
  }
  
  .main {
    margin-left: 0 !important;
    padding: 16px 12px 80px !important;
  }
  
  /* 统计卡片改为2列 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  .stat-card {
    padding: 14px !important;
  }
  
  .stat-card .value {
    font-size: 20px !important;
  }
  
  /* 表单改为单列 */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  /* 按钮全宽 */
  .btn-full {
    width: 100% !important;
  }
  
  /* 弹窗适配 */
  .modal-content {
    width: 95% !important;
    max-width: 400px !important;
    padding: 20px !important;
  }
  
  /* 头部简化 */
  .header {
    padding: 12px 16px !important;
  }
  
  .header h1 {
    font-size: 18px !important;
  }
  
  /* 卡片间距 */
  .content-card {
    padding: 14px !important;
    margin-bottom: 12px !important;
  }
  
  /* 字体大小适配 */
  h1 { font-size: 20px !important; }
  h2 { font-size: 17px !important; }
  h3 { font-size: 15px !important; }
  
  /* 输入框高度 */
  input, select, textarea {
    font-size: 16px !important; /* 防止iOS自动缩放 */
    padding: 12px !important;
  }
  
  /* 按钮最小点击区域 */
  button, .btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 平板端 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .form-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 电脑端 */
@media screen and (min-width: 1025px) {
  .mobile-only {
    display: none !important;
  }
  
  .stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  .form-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 超宽屏 */
@media screen and (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
}

/* 横屏手机 */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    overflow-y: auto;
  }
}

/* 打印样式 */
@media print {
  .sidebar, .no-print {
    display: none !important;
  }
  .main {
    margin-left: 0 !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  * {
    border-width: 2px !important;
  }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
  /* 可选：深色模式适配 */
}

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

/* 图片自适应 */
img {
  max-width: 100%;
  height: auto;
}

/* 视频自适应 */
video {
  max-width: 100%;
  height: auto;
}

/* 防止文字溢出 */
p, h1, h2, h3, h4, h5, h6, span, div {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 代码块横向滚动 */
pre, code {
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}
