* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Roboto", Arial, sans-serif;
  line-height: 1.6;
  color: #1f2937;
  background: #f7f7f8;
}

h1, h2, h3, h4 {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  color: #111827;
}

img { max-width: 100%; display: block; }
button, input, select {
  font: inherit;
  border: none;
  outline: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.site-header {
  background: #222;
  color: #fff;
  padding: 1rem 0;
}
.site-header .site-title { color: #2dd4bf; margin-bottom: 0.25rem; }
.byline { font-size: 0.9rem; opacity: 0.85; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}
.control-group label { font-size: 0.85rem; margin-right: 0.5rem; }
.control-group input, .control-group select {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.product-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.card-media { aspect-ratio: 4/3; overflow: hidden; background: #e5e7eb; }
.card-media .product-image { width: 100%; height: 100%; object-fit: cover; border-bottom: 1px solid #eee; }

.card-body { padding: 1rem; flex-grow: 1; }
.product-name { font-size: 1.1rem; margin-bottom: 0.5rem; }
.product-desc { font-size: 0.9rem; color: #4b5563; }
.card-footer {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eee;
}
.product-price { font-weight: 600; color: #16a34a; }

.btn {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-primary { background: #2dd4bf; color: #fff; }
.btn-primary:hover { background: #14b8a6; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover { color: #111827; }

.btn-toggle {
  width: 44px;
  height: 24px;
  background: #444;
  border-radius: 999px;
  position: relative;
}
.btn-toggle .toggle-dot {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform 0.3s ease;
}
.btn-toggle[aria-pressed="true"] { background: #2dd4bf; }
.btn-toggle[aria-pressed="true"] .toggle-dot { transform: translateX(20px); }

.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.cart-table th { background: #f1f5f9; }
.cart-item-qty input {
  width: 60px;
  padding: 0.25rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.grand-label { font-weight: bold; text-align: right; }
.grand-total { font-weight: bold; color: #16a34a; }

.site-footer {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

.empty-state {
  margin-top: 1rem;
  text-align: center;
  color: #6b7280;
}

body.dark { background: #1f2937; color: #f3f4f6; }
body.dark .site-header,
body.dark .site-footer { background: #111; }
body.dark .site-title { color: #2dd4bf; }
body.dark .product-card { background: #374151; color: #f3f4f6; }
body.dark .product-name { color: #e5e7eb; }
body.dark .product-desc { color: #cbd5e1; }
body.dark .card-footer { border-top-color: #4b5563; }
body.dark .cart-table th { background: #374151; }
body.dark .cart-table td { border-bottom-color: #4b5563; }
body.dark .btn-primary { background: #2dd4bf; color: #111; }
body.dark .btn-primary:hover { background: #14b8a6; }

@media (max-width: 640px) {
  .controls { flex-direction: column; align-items: flex-start; }
  .product-card { font-size: 0.9rem; }
  .cart-table th, .cart-table td { font-size: 0.85rem; }
}

@media (min-width: 960px) {
  .products-grid { grid-template-columns: repeat(3, 320px); justify-content: center; }
}
