:root {
  --cg: #0f9f63;
  --dark: #061713;
  --muted: #66746f;
  --line: rgba(7, 28, 23, 0.1);
  --bg: #f5f8f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #07110f;
  background: var(--bg);
  font-family: Inter, system-ui, Arial, sans-serif;
}

.catalog-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 230px minmax(260px, 620px) 1fr;
  gap: 28px;
  align-items: center;
  min-height: 78px;
  padding: 0 max(24px, calc((100% - 1400px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.catalog-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--dark);
  text-decoration: none;
}

.catalog-brand > span {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 2px solid var(--cg);
  border-radius: 10px;
  color: var(--cg);
  font-weight: 950;
}

.catalog-brand b {
  line-height: 0.9;
}

.catalog-brand small {
  display: block;
  margin-top: 5px;
  color: var(--cg);
}

.catalog-header label {
  position: relative;
}

.catalog-header input {
  width: 100%;
  height: 44px;
  padding: 0 45px 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf9;
  outline: 0;
}

.catalog-header label i {
  position: absolute;
  right: 15px;
  top: 9px;
  font-size: 22px;
}

.catalog-header nav {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  align-items: center;
}

.catalog-header nav a {
  color: #34433e;
  text-decoration: none;
  font-weight: 800;
}

.catalog-cart {
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff !important;
  background: var(--cg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.catalog-cart b {
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--cg);
  background: #fff;
  font-size: 12px;
}

.catalog-shell {
  width: min(1400px, calc(100% - 40px));
  margin: 24px auto 60px;
}

.catalog-hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  align-items: center;
  min-height: 240px;
  padding: 38px 42px;
  border-radius: 22px;
  color: #fff;
  background: radial-gradient(circle at 80% 30%, rgba(40, 220, 140, 0.25), transparent 28%), linear-gradient(135deg, #061713, #0c6144);
}

.catalog-hero h1 {
  max-width: 750px;
  margin: 10px 0;
  font-size: clamp(28px, 3.8vw, 48px);
  line-height: 1.1;
}

.catalog-hero p {
  max-width: 650px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
}

.catalog-hero > div > span {
  color: #59e7a8;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 13px;
}

.hero-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 15px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.hero-stat strong {
  font-size: 30px;
  color: #58e7a7;
}

.hero-stat span {
  align-self: center;
}

.catalog-categories {
  display: flex;
  gap: 10px;
  margin: 24px 0;
  overflow-x: auto;
  padding-bottom: 6px;
}

.catalog-categories button {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: #fff;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-categories button:hover {
  border-color: var(--cg);
  color: var(--cg);
}

.catalog-categories button.active {
  color: #fff;
  border-color: var(--cg);
  background: var(--cg);
  box-shadow: 0 4px 12px rgba(15, 159, 99, 0.25);
}

.catalog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin: 30px 0 18px;
}

.catalog-heading h2,
.catalog-heading p {
  margin: 0;
}

.catalog-heading p {
  margin-top: 5px;
  color: var(--muted);
}

.catalog-heading select {
  height: 42px;
  padding: 0 35px 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* Product Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.catalog-product {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 43, 35, 0.04);
  transition: all 0.25s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.catalog-product:hover {
  transform: translateY(-6px);
  border-color: #a7f3d0;
  box-shadow: 0 16px 36px rgba(16, 43, 35, 0.1);
}

.product-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  background: linear-gradient(145deg, #f8fafc, #edf9f3);
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  overflow: hidden;
}

.product-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  transition: transform 0.3s ease;
}

.catalog-product:hover .product-visual img {
  transform: scale(1.08);
}

/* Correct Sprite Sizing for Product Cards */
.product-visual i.sprite {
  display: block;
  width: 110px;
  height: 140px;
  background-image: url("assets/grocery-sprite.png");
  background-repeat: no-repeat;
  background-size: 800% 200%;
  background-position-y: 100%;
  transition: transform 0.3s ease;
}

.catalog-product:hover .product-visual i.sprite {
  transform: scale(1.08);
}

/* Sprite Horizontal Positions */
.rice-pack { background-position-x: 0 !important; }
.oil-pack { background-position-x: 14.285% !important; }
.sugar-pack { background-position-x: 28.57% !important; }
.noodle-pack { background-position-x: 42.855% !important; }
.flour-pack { background-position-x: 57.14% !important; }
.canned-pack { background-position-x: 71.425% !important; }
.spices { background-position-x: 85.71% !important; }
.cereal { background-position-x: 100% !important; }

.catalog-product .badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 10px;
  border-radius: 8px;
  color: #fff;
  background: #ef494f;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(239, 73, 79, 0.3);
}

.product-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-body small {
  color: var(--cg);
  font-weight: 800;
  font-size: 11.5px;
  font-family: monospace;
}

.product-body h3 {
  margin: 6px 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.product-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.rating {
  display: flex;
  gap: 5px;
  margin: 10px 0 14px;
  color: #e79a12;
  font-weight: 800;
  font-size: 13px;
}

.product-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.product-bottom strong {
  font-size: 19px;
  font-weight: 900;
  color: #008a4b;
}

.product-bottom button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--cg);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-bottom button:hover {
  background: #0d8a56;
  transform: scale(1.03);
}

.empty-products {
  padding: 70px;
  text-align: center;
}

.catalog-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  padding: 14px 22px;
  border-radius: 12px;
  color: #fff;
  background: #071a15;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 4px solid var(--cg);
}

/* Responsive */
@media (max-width: 1100px) {
  .catalog-header {
    grid-template-columns: 190px 1fr;
  }
  .catalog-header nav {
    grid-column: 1/3;
  }
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .catalog-header {
    position: static;
    grid-template-columns: 1fr;
    padding: 15px;
  }
  .catalog-header nav {
    grid-column: 1;
    justify-content: flex-start;
    overflow: auto;
  }
  .catalog-shell {
    width: min(100% - 24px, 1400px);
  }
  .catalog-hero {
    grid-template-columns: 1fr;
    padding: 25px;
  }
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
  .catalog-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
