/* ========================================
   工具大全 - 布局系统
   ======================================== */

/* 容器 */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: var(--max-width-narrow);
}

/* 页面区块 */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-10) 0;
}

.section-lg {
  padding: var(--space-20) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-header h2 {
  margin-bottom: var(--space-3);
}

.section-header p {
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* 栅格 */
.grid {
  display: grid;
  gap: var(--space-6);
}

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

/* 弹性布局 */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* 工具页布局 */
.tool-page-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-8);
  align-items: start;
}

.tool-page-wide .tool-page-layout {
  grid-template-columns: 1fr;
}

.tool-input-panel {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.tool-result-panel {
  position: sticky;
  top: 80px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* 固定头部 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
}

/* 响应式 */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .tool-page-layout {
    grid-template-columns: 1fr;
  }
  .tool-result-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  :root {
    --space-16: 48px;
    --space-20: 56px;
  }
  .container {
    padding: 0 var(--space-4);
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .section-header h2 {
    font-size: var(--text-2xl);
  }
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-2xl); }
  .tool-input-panel,
  .tool-result-panel {
    padding: var(--space-5);
  }
}
