:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #fafafa;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --success: #059669;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.site-header .logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
}
.site-header nav a {
  margin-left: 24px;
  color: var(--ink);
  font-weight: 500;
}
.cart-link { color: var(--accent) !important; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
  min-height: 60vh;
}

/* Hero */
.hero {
  text-align: center;
  padding: 64px 16px;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 8px; }
.hero p { color: var(--muted); margin-bottom: 24px; }

.cta-btn, .checkout-btn, .checkout-submit-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cta-btn:hover, .checkout-btn:hover, .checkout-submit-btn:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 16px;
  text-align: center;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.product-card img { border-radius: 6px; margin-bottom: 12px; }
.product-card h3 { font-size: 1rem; margin: 0 0 4px; color: var(--ink); }
.product-card .price { color: var(--accent); font-weight: 700; margin: 0 0 12px; }

.add-to-cart-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  width: 100%;
  transition: background 0.15s ease, transform 0.1s ease;
}
.add-to-cart-btn:hover { background: #000; }
.add-to-cart-btn.added {
  background: var(--success);
  transform: scale(1.03);
}

/* Product detail */
.product-detail {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}
.product-detail img {
  flex: 1 1 360px;
  border-radius: 8px;
}
.product-info { flex: 1 1 320px; }
.product-info h1 { margin-top: 0; }
.product-info .price { font-size: 1.5rem; color: var(--accent); font-weight: 700; }
.product-info .product-desc { color: var(--muted); }
.product-info .add-to-cart-btn { width: auto; padding: 12px 32px; }
.back-link { display: block; margin-top: 20px; }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; margin-top: 24px; }
.cart-table th, .cart-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.remove-from-cart-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  color: #dc2626;
}
.cart-empty { color: var(--muted); margin-top: 24px; }
.cart-total {
  text-align: right;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 24px 0;
}
.checkout-btn { float: right; }

/* Checkout */
.checkout-summary { margin-bottom: 24px; }
.checkout-items { list-style: none; padding: 0; }
.checkout-items li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.checkout-total { font-weight: 700; font-size: 1.1rem; }

#checkout-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
}
#checkout-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}
#checkout-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}
.checkout-submit-btn { margin-top: 8px; align-self: flex-start; }

.order-confirmation {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}
.order-confirmation h2 { color: var(--success); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 8px; padding: 16px; }
  main { padding: 20px; }
  .hero h1 { font-size: 1.8rem; }
}
