:root {
  --color-primary: #6366f1;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-surface: #fff;
  --color-background: #f3f4f6;
  --color-border: #e5e7eb;
  --sidebar-width: 250px;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 1. 顶层应用布局 (App Layout)*/
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-background);
  color: var(--color-text);
  height: 100vh;
  /* ✨ Your code here */
  display: grid;
  grid-template-rows: var(--header-height) 1fr auto;
  grid-template-areas: "header header" "body body" "footer footer";
}

.app-header {
  grid-area: header;
}
.app-body {
  grid-area: body;
}
.app-footer {
  grid-area: footer;
}

/* 2. 应用头部 (App Header)*/
.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 2rem;
  /* ✨ Your code here */
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header__nav {
  display: flex;
  gap: 1.5rem;
}
.app-header__logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
  text-decoration: none;
}

.app-header__nav-link {
  text-decoration: none;
  color: var(--color-text-light);
  font-weight: 500;
  transition: color 0.2s ease;
}

.app-header__nav-link:hover {
  color: var(--color-primary);
}

.app-header__hamburger {
  display: none;
}

/* 3. 主体内容区 (App Body) */
.app-body {
  display: flex;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
 min-width: 0;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  padding: 2rem;
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar__title {
  font-size: 1.2rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.filter-group {
  margin-bottom: 2rem;
}

.filter-group__title {
  font-weight: bold;
  margin-bottom: 1rem;
  display: block;
}

.filter-group__item {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-text-light);
}

.main-content {
  padding: 2rem;
  overflow-y: auto;
  flex-grow:1;
}

.main-content__header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-content__title {
  font-size: 2rem;
  font-weight: 800;
}

.main-content__filter-toggle {
  display: none;
}

.main-content__filter-toggle > span {
  margin-left: 8px;
  vertical-align: middle;
}

/* 4. 产品网格 (Product Grid)*/
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(280px,1fr));
  gap: 2rem;
}
/*5. 产品卡片 (Product Card) - 高级挑战*/
.product-card {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  min-height: 380px;
  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;
}

.product-card > * {
  grid-column: 1/-1;
  grid-row: 1/-1;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card__image {
  transform: scale(1.05);
}

.product-card__overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 60%);
  z-index: 1;
}

.product-card__content {
  z-index: 2;
  padding: 1.5rem;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.product-card__title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.product-card__price {
  font-size: 1.1rem;
  margin-top: 0.5rem;
  opacity: 0.9;
}

.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: 1.5rem;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .app-header__nav {
    display: none;
  }

  .app-header__hamburger,
  .main-content__filter-toggle {
    display: flex;
    align-items: center;
    background: none;
    border: 1px solid var(--color-border);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
  }

  .sidebar {
    display: none;
  }

  .app-header {
    padding: 0 1rem;
  }
  .main-content {
    padding: 1rem;
  }
}
