:root {
  --bg: #0b1020;
  --panel: #121a33;
  --muted: #94a3b8;
  --text: #e6ebf5;
  --brand: #4f46e5;
  --brand-600: #6366f1;
  --accent: #22c55e;
  --danger: #ef4444;
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1000px 600px at 20% -10%, #1b254b 0%, transparent 70%) var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.main-content {
  display: flex;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 24px;
}

.sidebar {
  flex-shrink: 0;
  width: 200px;
}

.category-list {
  background: linear-gradient(180deg, #121a33, #0f1730);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 0;
  position: sticky;
  top: 80px;
}

.category-title {
  margin: 0 0 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.categories {
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-link {
  display: block;
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.category-link:hover {
  color: var(--text);
  background: rgba(79, 70, 229, 0.1);
  border-left-color: var(--brand);
}

.category-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(34, 197, 94, 0.1);
}

.main-section {
  flex: 1;
  min-width: 0;
}

.no-scroll { overflow: hidden; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(11,16,32,0.95), rgba(11,16,32,0.85));
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  color: white;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 1.25rem;
}

.page-title {
  margin: 24px 0 16px;
  font-size: 1.5rem;
}

.product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.product-card {
  background: linear-gradient(180deg, #121a33, #0f1730);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  width: calc(33.333% - 10.666px);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(0,0,0,0.45); }

.product-thumb {
  display: block;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #0b1228;
}
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-name {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.product-name:hover { color: var(--brand-600); text-decoration: underline; }

.product-price {
  color: var(--accent);
  font-weight: 700;
}

.product-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-label {
  color: var(--muted);
  font-size: 0.9rem;
}
.qty-input {
  width: 72px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1530;
  color: var(--text);
}
.add-to-cart {
  margin-left: auto;
}

.btn,
.btn-outline,
.btn-primary,
.icon-btn,
.link {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn {
  background: var(--brand);
  color: white;
}
.btn:hover { background: var(--brand-600); }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: #7886a8; }

.btn-primary {
  background: var(--accent);
  color: #082d16;
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.05); }

.icon-btn {
  background: transparent;
  color: #9fb0d1;
  font-size: 1.5rem;
  padding: 6px 10px;
}
.icon-btn:hover { color: #c7d2fe; }

.link {
  background: transparent;
  color: #9fb0d1;
  padding: 6px 0;
  text-decoration: underline;
}
.link:hover { color: #c7d2fe; }

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  padding: 0 6px;
  background: #1f2937;
  color: #fff;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

/* Cart Drawer and overlay that covers the page */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(2px);
  z-index: 80;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 92vw;
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.cart-drawer[aria-hidden="false"] { transform: translateX(0); }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cart-items {
  padding: 10px 16px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-empty {
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
}

.cart-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #0e1731;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cart-row-name {
  font-weight: 700;
}
.cart-row-meta {
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-qty {
  width: 72px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1530;
  color: var(--text);
}

.cart-row-total {
  font-weight: 700;
  color: #e5e7eb;
}

.cart-footer {
  border-top: 1px solid var(--border);
  padding: 14px 16px 18px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.05));
}
.cart-footer .totals {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkout-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Product Detail Page */
.product-detail-container {
  display: flex;
  gap: 40px;
  padding: 40px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.product-image-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image-section img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-details-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-detail-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--text);
}

.product-detail-price {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 24px;
}

.product-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 500px;
}

.product-detail-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 32px;
}

.qty-input-detail {
  width: 80px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-size: 1rem;
}

.qty-input-detail:focus {
  outline: none;
  border-color: var(--brand);
}

.btn-add-to-cart-detail {
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-add-to-cart-detail:hover {
  background: var(--brand-600);
  box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);
}

.btn-add-to-cart-detail:active {
  transform: scale(0.98);
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--brand);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--brand-600);
}

/* Breadcrumbs */
.breadcrumbs {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 8px 0 18px;
}
.breadcrumbs a {
  color: var(--brand-600);
  text-decoration: none;
}
.breadcrumbs .sep {
  margin: 0 8px;
  color: var(--muted);
}
.breadcrumbs .current {
  color: var(--text);
  font-weight: 600;
}

.product-features {
  color: var(--muted);
  font-size: 0.9rem;
}

.product-features p {
  margin: 8px 0;
}

/* Responsive layout tweaks */
@media (max-width: 960px) {
  .product-card { width: calc(50% - 8px); }
}
@media (max-width: 768px) {
  .product-detail-container {
    flex-direction: column;
    gap: 24px;
    padding: 24px 0;
  }

  .product-detail-title {
    font-size: 1.75rem;
  }

  .product-detail-price {
    font-size: 1.5rem;
  }
}
@media (max-width: 560px) {
  .product-card { width: 100%; }
  .product-actions { flex-wrap: wrap; }
  .qty-input { width: 64px; }
}