.products-page {
  padding: 2rem 5vw;
  min-height: calc(100vh - 200px);
}

.products-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.products-sidebar {
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.products-sidebar h2 {
  font-size: 1.25rem;
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.category-item:last-child {
  border-bottom: none;
}

.category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: color 0.2s ease;
}

.category-toggle:hover {
  color: var(--primary);
}

.category-toggle .chevron {
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.category-item.active .category-toggle .chevron {
  transform: rotate(180deg);
}

.product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.category-item.active .product-list {
  max-height: 500px;
  padding: 0.5rem 0 0.5rem 1rem;
}

.product-list li {
  margin: 0.25rem 0;
}

.product-list a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
  font-size: 0.9rem;
}

.product-list a:hover {
  background: rgba(31, 122, 236, 0.1);
  color: var(--primary);
}

.product-list a.active {
  background: rgba(31, 122, 236, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.products-content {
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 2.5rem;
  min-height: 500px;
}

.content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.placeholder-icon {
  margin-bottom: 1.5rem;
  opacity: 0.3;
}

.content-placeholder h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
}

.category-content h2,
.product-content h2 {
  font-size: 2rem;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.category-content>div {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--muted);
}

.product-header {
  margin-bottom: 2rem;
}

.product-header img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  border-radius: var(--radius);
  /* box-shadow: var(--shadow); Removed shadow from img to avoid boxing transparent areas awkwardly, or keep if preferred. Keeping for now but strictly controlled. */
  margin-top: 1.5rem;
  display: block;
}

.product-header img.switch-image {
  height: 220px;
  max-width: 80%;
  margin: 1.5rem auto 0 auto;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.product-details>div {
  padding: 1.5rem;
  background: rgba(248, 250, 252, 0.5);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.product-details h3 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.product-details p {
  line-height: 1.8;
  color: var(--muted);
  margin: 0.5rem 0;
}

.product-details ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: var(--muted);
  line-height: 1.8;
}

.product-details li {
  margin: 0.5rem 0;
}

.product-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.spec-item {
  padding: 0.75rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.spec-item strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.spec-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1024px) {
  .products-container {
    grid-template-columns: 1fr;
  }

  .products-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .products-page {
    padding: 1.5rem 1.25rem;
  }

  .products-content {
    padding: 1.5rem;
  }

  .product-header img {
    max-width: 100%;
  }

  .product-specs {
    grid-template-columns: 1fr;
  }
}

/* Dark Mode Optimizations */
[data-theme="dark"] .products-sidebar,
[data-theme="dark"] .products-content {
  background: var(--bg-alt);
  border-color: var(--line);
}

[data-theme="dark"] .product-details>div {
  background: rgba(255, 255, 255, 0.03);
  /* Lighter background for contrast */
  border-color: var(--line);
}

[data-theme="dark"] .product-details p,
[data-theme="dark"] .product-details ul,
[data-theme="dark"] .category-content>div {
  color: #a0aec0;
  /* Lighter text for readability */
}

[data-theme="dark"] .product-details h3,
[data-theme="dark"] .category-content h2,
[data-theme="dark"] .product-content h2 {
  color: #fff;
}

[data-theme="dark"] .spec-item {
  background: var(--bg);
  border-color: var(--line);
}

[data-theme="dark"] .spec-item strong {
  color: #fff;
}

[data-theme="dark"] .spec-item span {
  color: #cbd5e0;
}