/* ========================================
   织网 (WebWeave) - 响应式设计优化
   断点: 640px, 1024px, 1280px
   ======================================== */

/* === 移动端优化 (0-640px) === */
@media (max-width: 640px) {
  /* 基础布局 */
  body {
    font-size: 14px;
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }
  
  /* 容器 */
  .container {
    padding: 10px;
  }
  
  /* 导航栏 */
  .org-header {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }
  
  .org-header-left,
  .org-header-right {
    width: 100%;
    justify-content: center;
  }
  
  /* 侧边栏 */
  .org-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
  }
  
  .org-sidebar.active {
    left: 0;
  }
  
  /* 侧边栏遮罩 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  /* 移动端菜单按钮 */
  .mobile-menu-btn {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--sacred-gold);
    border: none;
    color: var(--holy-black);
    padding: 10px 15px;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--holy-glow-soft);
  }
  
  /* 内容区域 */
  .org-content {
    margin-left: 0;
    padding: 60px 10px 20px;
  }
  
  /* 卡片 */
  .scroll-card,
  .stela-card,
  .sacred-geometry-card {
    padding: 15px;
    margin-bottom: 15px;
  }
  
  /* 按钮 */
  .holy-button {
    padding: 8px 15px;
    font-size: 0.9rem;
  }
  
  /* 表格 */
  .holy-table {
    font-size: 0.85rem;
    overflow-x: auto;
    display: block;
  }
  
  .holy-table thead,
  .holy-table tbody,
  .holy-table tr {
    display: block;
  }
  
  .holy-table th,
  .holy-table td {
    display: block;
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid rgba(184, 134, 11, 0.3);
  }
  
  .holy-table th {
    background: rgba(184, 134, 11, 0.2);
    font-weight: bold;
  }
  
  /* 模态框 */
  .modal-content {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    margin: 5vh auto;
    padding: 15px;
  }
  
  /* 编辑器 */
  .editor-container {
    flex-direction: column;
    height: auto;
  }
  
  .component-panel {
    width: 100%;
    max-height: 200px;
    margin-bottom: 10px;
  }
  
  .canvas-container {
    width: 100%;
    height: 400px;
  }
  
  .property-panel {
    width: 100%;
    max-height: 300px;
  }
  
  /* 网格布局 */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* 隐藏不必要的元素 */
  .desktop-only {
    display: none !important;
  }
}

/* === 平板端优化 (641px-1024px) === */
@media (min-width: 641px) and (max-width: 1024px) {
  /* 侧边栏 */
  .org-sidebar {
    width: 200px;
  }
  
  .org-content {
    margin-left: 200px;
  }
  
  /* 网格布局 */
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 编辑器 */
  .component-panel {
    width: 200px;
  }
  
  .property-panel {
    width: 250px;
  }
  
  /* 卡片 */
  .scroll-card,
  .stela-card {
    padding: 20px;
  }
}

/* === 桌面端优化 (1025px-1280px) === */
@media (min-width: 1025px) and (max-width: 1280px) {
  .container {
    max-width: 1200px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === 大屏幕优化 (1281px+) === */
@media (min-width: 1281px) {
  .container {
    max-width: 1400px;
  }
}

/* === 触摸设备优化 === */
@media (hover: none) and (pointer: coarse) {
  /* 增大触摸目标 */
  .holy-button,
  .nav-item,
  .component-item {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 移除悬停效果 */
  .holy-button:hover,
  .nav-item:hover {
    transform: none;
  }
  
  /* 优化滚动 */
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* === 高DPI屏幕优化 === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 优化字体渲染 */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* === 横屏优化 === */
@media (orientation: landscape) and (max-height: 500px) {
  .org-sidebar {
    width: 180px;
  }
  
  .org-content {
    padding-top: 10px;
  }
  
  .modal-content {
    max-height: 95vh;
  }
}

/* === 打印样式 === */
@media print {
  .org-sidebar,
  .org-header,
  .holy-button,
  .mobile-menu-btn {
    display: none !important;
  }
  
  .org-content {
    margin-left: 0;
    padding: 0;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .scroll-card,
  .stela-card {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}
