:root {
  --red: #e2001a;
  --red-dark: #b5000f;
  --navy: #1c2b4a;
  --bg: #ffffff;
  --bg-soft: #f4f4f5;
  --border: #e2e2e5;
  --text: #202124;
  --muted: #6b7280;
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

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

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

button, input { font-family: inherit; font-size: inherit; }

/* ---------- header ---------- */

.topbar {
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  padding: 6px 12px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.site-header__row {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.logo span { color: var(--navy); }

.search {
  flex: 1;
  display: flex;
  border: 2px solid var(--navy);
  border-radius: 3px;
  overflow: hidden;
}
.search input {
  flex: 1;
  border: none;
  padding: 10px 14px;
  outline: none;
}
.search button {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0 18px;
  cursor: pointer;
  font-size: 18px;
}

.account-actions {
  display: flex;
  gap: 18px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.category-nav {
  background: var(--red);
  display: flex;
  gap: 22px;
  padding: 10px 20px;
  overflow-x: auto;
}
.category-nav a {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- layout helpers ---------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.section-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--navy);
}

/* ---------- hero / flash sale ---------- */

.hero {
  background: linear-gradient(120deg, var(--navy) 0%, #2b4066 100%);
  color: #fff;
  border-radius: 6px;
  padding: 34px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.hero__eyebrow {
  color: #ffd7dc;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.25;
  max-width: 520px;
}
.hero p { color: #cfd8e6; margin: 0 0 18px; max-width: 480px; }
.hero .btn { background: var(--red); }

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn--outline {
  background: transparent;
  border: 2px solid var(--navy);
  color: var(--navy);
}

/* ---------- product grid / cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.card__media {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  padding: 10px;
  position: relative;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 3px;
}

.card__body { padding: 12px 14px 16px; flex: 1; display: flex; flex-direction: column; }
.card__brand { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.card__name { font-size: 14px; font-weight: 600; margin: 3px 0 8px; flex: 1; }
.card__price { display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 17px; font-weight: 800; color: var(--navy); }
.price--old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.stock-note { font-size: 12px; color: var(--red); font-weight: 600; margin-top: 6px; }

/* ---------- product detail ---------- */

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.product-detail__media {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  padding: 20px;
}
.product-detail__brand { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.product-detail h1 { margin: 4px 0 14px; font-size: 26px; color: var(--navy); }
.product-detail .price { font-size: 28px; }
.rating { color: var(--muted); font-size: 13px; margin: 10px 0 20px; }
.stock-box {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 14px;
}
.stock-box.low { border-color: var(--red); background: #fff2f3; color: var(--red-dark); font-weight: 600; }

.qty-form { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.qty-form input[type="number"] {
  width: 70px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* ---------- forms (login / register) ---------- */

.auth-card {
  max-width: 420px;
  margin: 10px auto 60px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
}
.auth-card h1 { font-size: 22px; color: var(--navy); margin-top: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.form-error {
  background: #fff2f3;
  color: var(--red-dark);
  border: 1px solid #ffc3c9;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.auth-switch { margin-top: 16px; font-size: 13.5px; color: var(--muted); }

/* ---------- cart ---------- */

.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.cart-table th, .cart-table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.cart-total { text-align: right; font-size: 18px; font-weight: 700; color: var(--navy); }

/* ---------- misc pages ---------- */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state h1 { color: var(--navy); }

.dd-note {
  border: 1px dashed #c9ccd3;
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 20px;
}

/* ---------- footer ---------- */

.site-footer {
  background: var(--navy);
  color: #cfd8e6;
  margin-top: 40px;
}
.site-footer__grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.site-footer h4 { color: #fff; font-size: 14px; margin: 0 0 10px; }
.site-footer p { font-size: 13px; margin: 4px 0; color: #b7c1d4; }
.site-footer a { color: #b7c1d4; }
.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  text-align: center;
  font-size: 12px;
  padding: 14px;
  color: #8fa0bc;
}

@media (max-width: 720px) {
  .site-header__row { flex-wrap: wrap; }
  .search { order: 3; width: 100%; }
  .product-detail { grid-template-columns: 1fr; }
}
