:root {
  --primary: #5b4bdb;
  --primary-dark: #4537b6;
  --text: #202033;
  --muted: #6d6d80;
  --surface: #ffffff;
  --bg: #f6f7fb;
  --border: #e7e7ef;
  --success: #16845b;
  --danger: #c73c3c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

.navbar {
  min-height: 70px;
  padding: 0 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}

nav { display: flex; gap: 20px; align-items: center; }
nav a { color: var(--muted); font-weight: 600; }
nav a:hover { color: var(--primary); }

.badge {
  display: inline-flex;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  background: var(--primary);
  color: white;
  font-size: 12px;
}

.hero {
  margin: 30px auto 55px;
  max-width: 1200px;
  min-height: 390px;
  border-radius: 28px;
  padding: 70px;
  display: flex;
  align-items: center;
  background:
    linear-gradient(120deg, rgba(91,75,219,.96), rgba(31,28,78,.92)),
    url("https://images.unsplash.com/photo-1441986300917-64674bd600d8?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: white;
}

.hero h1 {
  max-width: 650px;
  margin: 10px 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.05;
}

.hero p { max-width: 620px; font-size: 1.05rem; line-height: 1.7; opacity: .92; }
.eyebrow { font-weight: 800; letter-spacing: 2px; font-size: .8rem !important; }

.container { width: min(1200px, 90%); margin: auto; }
.page { padding: 50px 0; min-height: 75vh; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 25px;
}

.section-heading h2 { margin-bottom: 5px; }
.section-heading p { color: var(--muted); margin-top: 0; }

.filters { display: flex; gap: 10px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: white;
  font: inherit;
  outline: none;
}
.filters input { min-width: 240px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding-bottom: 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(25,25,60,.10); }

.product-image {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}

.card-body { padding: 16px; }
.category { color: var(--primary); font-size: .8rem; font-weight: 800; }
.card h3 { margin: 7px 0; }
.price { font-size: 1.15rem; font-weight: 800; }
.stock { color: var(--muted); font-size: .85rem; margin: 8px 0 14px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}
.primary { background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #eeeeF7; color: var(--text); }
.danger { background: #ffe9e9; color: var(--danger); }

.auth-page {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 35px 15px;
}

.auth-card {
  width: min(430px, 100%);
  background: white;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 15px 50px rgba(20,20,50,.07);
}
.auth-card h1 { margin-top: 0; }
.auth-card label { display: block; margin: 15px 0 6px; font-weight: 700; }
.auth-card button { width: 100%; margin-top: 20px; }
.message { min-height: 20px; color: var(--danger); font-weight: 600; }

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 45px;
  align-items: center;
  background: white;
  padding: 35px;
  border-radius: 22px;
  border: 1px solid var(--border);
}
.product-detail img { width: 100%; max-height: 520px; object-fit: cover; border-radius: 16px; }
.product-detail h1 { font-size: 2.7rem; margin: 8px 0; }
.detail-price { font-size: 1.7rem; font-weight: 800; margin: 18px 0; }
.detail-description { color: var(--muted); line-height: 1.8; }

.cart-layout {
  display: grid;
  grid-template-columns: 1.6fr .8fr;
  gap: 25px;
  margin-top: 25px;
}

.cart-item, .summary, .order-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
}

.cart-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.cart-item img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button { width: 32px; height: 32px; border: 1px solid var(--border); background: white; border-radius: 8px; cursor: pointer; }

.summary { height: fit-content; }
.summary h2 { margin-top: 0; }
.summary-row { display: flex; justify-content: space-between; margin: 12px 0; }
.total { font-size: 1.3rem; font-weight: 800; border-top: 1px solid var(--border); padding-top: 15px; }
.checkout-form { margin-top: 18px; }
.checkout-form textarea { min-height: 100px; resize: vertical; margin: 10px 0; }

.order-card { margin: 16px 0; }
.order-top { display: flex; justify-content: space-between; gap: 15px; }
.status { color: var(--success); font-weight: 800; }
.order-items { margin-top: 15px; padding-top: 10px; border-top: 1px solid var(--border); }
.empty { text-align: center; padding: 60px 15px; color: var(--muted); background: white; border-radius: 18px; }

footer { text-align: center; padding: 30px; color: var(--muted); }

@media (max-width: 950px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { margin: 20px 5%; padding: 45px; }
}

@media (max-width: 720px) {
  .navbar { padding: 15px 5%; align-items: flex-start; gap: 15px; }
  nav { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .hero { min-height: 330px; padding: 30px; border-radius: 20px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .filters { flex-direction: column; }
  .filters input { min-width: 0; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail, .cart-layout { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 65px 1fr; }
  .cart-item > :last-child { grid-column: 2; }
}