/* ============================================================
   律兜培训部 — 移动端/平板响应式适配
   ============================================================ */

/* ===== 平板 (≤1024px) ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .settings-grid { grid-template-columns: 1fr !important; }
  .card-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .table-card { overflow-x: auto; }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
  .course-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .news-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .chat-sidebar { width: 220px; }
  .chat-main { margin-left: 220px; }
  .dl-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .player-panel { width: 100% !important; }
}

/* ===== 手机横屏 (≤768px) ===== */
@media (max-width: 768px) {
  body { font-size: 14px; }
  h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .card-grid { grid-template-columns: 1fr !important; }
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; min-width: 600px; }
  th, td { padding: 6px 8px; white-space: nowrap; }
  .course-grid { grid-template-columns: 1fr !important; }
  .news-grid { grid-template-columns: 1fr !important; }
  .dl-grid { grid-template-columns: 1fr !important; }
  .player-panel { width: 100% !important; height: auto !important; }
  .player-panel iframe { height: 300px !important; }
  .stat-card { padding: 12px 14px; }
  .stat-card-num { font-size: 22px; }
  .stat-card-title { font-size: 12px; }
  .form-input, .form-select, textarea { font-size: 16px !important; padding: 10px 12px !important; }
  .btn, .btn-sm, .btn-submit { font-size: 14px; padding: 10px 18px; min-height: 40px; }
  .modal-overlay { padding: 10px; }
  .modal-content { width: 95% !important; max-width: 95vw !important; padding: 16px; border-radius: 12px; }
  .modal-actions { flex-direction: column; gap: 8px; }
  .modal-actions button { width: 100%; }
  .login-card { width: 90% !important; padding: 24px 20px; }
  .login-logo { width: 48px; height: 48px; }
  .detail-layout { flex-direction: column; }
  .detail-sidebar { width: 100% !important; border-right: none; border-bottom: 1px solid var(--border); }
  .detail-main { width: 100% !important; padding: 16px; }
  .slide-container { width: 100% !important; height: auto !important; }
  .slide-iframe { height: 300px !important; }
}

/* ===== 手机竖屏 (≤480px) ===== */
@media (max-width: 480px) {
  body { font-size: 13px; }
  h1 { font-size: 18px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 6px; }
  .stat-card { padding: 10px 12px; }
  .stat-card-num { font-size: 20px; }
  .stat-card-title { font-size: 11px; }
  .stat-card-change { font-size: 10px; }
  table { font-size: 11px; min-width: 480px; }
  th, td { padding: 5px 6px; }
  .btn, .btn-sm, .btn-submit { font-size: 13px; padding: 8px 14px; min-height: 36px; }
  .modal-content { padding: 14px; }
  .modal-title { font-size: 16px; }
  .login-card { width: 95% !important; padding: 20px 16px; }
  .topbar { padding: 8px 12px; }
  .topbar-title { font-size: 14px; }
  .carousel { height: 180px; }
  .carousel-item { height: 180px; }
  .channel-card { flex-direction: column; }
  .channel-thumb { width: 100%; height: 160px; }
  .policy-card { flex-direction: column; }
  .policy-thumb { width: 100%; height: 140px; }
  .post-card { padding: 12px; }
  .post-title { font-size: 15px; }
  .news-card { padding: 12px; }
  .news-title { font-size: 14px; }
  .tab-wrap { overflow-x: auto; white-space: nowrap; }
  .tab { font-size: 12px; padding: 6px 14px; }
  .footer { padding: 16px 10px; font-size: 11px; }
}

/* ===== 触摸优化（全局） ===== */
@media (hover: none) and (pointer: coarse) {
  .btn, .btn-sm, .btn-outline, .btn-submit, button, a {
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
  }
  tbody tr { min-height: 40px; }
  .table-card, .main, .content-area {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  tbody tr:hover { background: transparent; }
}

/* ===== 安全区域适配 ===== */
@supports (padding: max(0px)) {
  .sidebar { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .main { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .footer { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* ===== 打印样式 ===== */
@media print {
  .sidebar, .topbar, .footer, .btn, button, .tab-wrap, .modal-overlay { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: white !important; color: black !important; }
  table { border: 1px solid #ccc; }
  th { background: #eee !important; color: black !important; }
}

/* ===== 大屏优化 (>1600px) ===== */
@media (min-width: 1600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .course-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .news-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .content { max-width: 1400px; margin: 0 auto; }
}
