/* Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Open+Sans:wght@400;500&display=swap");

:root {
  --primary: #4caf50;
  --secondary: #8bc34a;
  --dark: #388e3c;
  --light: #f1f8e9;
  --text: #333;
  --white: #fff;
  --primary-green: #2a5a3a;
  --light-green: #e8f5e9;
  --dark-green: #1e5631;
  --text-dark: #333;
  --text-medium: #555;
  --text-light: #777;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Open Sans", sans-serif;
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  flex: 0 0 auto;
}

.logo img {
  height: 80px;
  width: auto;
}

/* Navigation */
nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

nav ul {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 1.1rem;
  transition: color 0.3s;
}

nav a:hover,
nav a.active {
  color: var(--primary);
}

/* Header Icons */
.header-icons {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.header-icons a {
  color: #4a2c2a;
  font-size: 1.4rem;
  transition: all 0.3s;
  position: relative;
}

.header-icons a:hover {
  color: #4caf50;
  transform: translateY(-2px);
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #4caf50;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 200;
}

.menu-toggle span {
  width: 2rem;
  height: 0.25rem;
  background: var(--text);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

/* Prevent background scroll when menu open */
.no-scroll {
  overflow: hidden;
}

/* Animate hamburger into "X" */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Product Catalog Styles */
.products-hero {
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url("../Images/productBack.jpg") center/cover;
  color: white;
  text-align: center;
  padding: 100px 20px;
  margin-bottom: 50px;
}

.products-hero h1 {
  font-size: 3rem;
  color: white;
  margin-bottom: 20px;
}

/* Product Catalog Layout */
.product-catalog {
  padding: 2rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.catalog-intro {
  text-align: center;
  margin-bottom: 3rem;
}

.catalog-intro h1 {
  color: var(--dark-green);
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.catalog-intro p {
  color: var(--text-medium);
  max-width: 700px;
  margin: 0 auto 2rem;
}

/* Category Filters */
.category-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  background: var(--white);
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary-green);
  color: var(--white);
  border-color: var(--primary-green);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* Product Card Container */
.product-card {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* Product Image Container - position relative for badge */
.product-image-container {
  position: relative;
  height: 200px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  transition: transform 0.6s ease;
}

.product-card:hover .product-image {
  transform: scale(1.07);
}

/* Stock Badge */
.stock-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: rgba(244, 67, 54, 0.85); /* semi-transparent red */
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
  user-select: none;
}

/* Product Info - flexible vertical layout with spacing */
.product-info {
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

/* Category text */
.product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary-green);
  margin: 0;
}

/* Product Name */
.product-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

/* Product Description */
.product-description {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
}

/* Footer with price and button */
.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

/* Price */
.price {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--dark-green);
}

/* Add to Cart Button */
.cart-btn {
  background: var(--primary-green);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.cart-btn:hover,
.cart-btn:focus-visible {
  background: var(--dark-green);
  box-shadow: 0 6px 12px rgba(30, 86, 49, 0.4);
  outline: none;
}

.cart-btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

/* FOOTER WITH BACKGROUND IMAGE */
.footer-with-bg {
  position: relative;
  padding: 3rem 5% 1rem;
  color: #f5deb3;
  overflow: hidden;
}

.footer-with-bg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../Images/footerBack.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
}

.footer-with-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: -1;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.footer-section {
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: #f8f1e7;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-family: "Poppins", sans-serif;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #f5deb3;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: #8b5e32;
}

.social-icons {
  display: flex;
  gap: 1rem;
  font-size: 1.8rem;
  margin: 1rem 0;
}

.footer-section i {
  margin-right: 8px;
  width: 20px;
  text-align: center;
}

.footer-bottom {
  border-top: 1px solid rgba(245, 222, 179, 0.2);
  padding-top: 1.5rem;
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
}

.footer-bottom a {
  color: #f5deb3;
  text-decoration: none;
  font-size: 0.9rem;
}

/* RESPONSIVE DESIGN */
/* Tablets */
@media (max-width: 1024px) {
  .products-hero h1 {
    font-size: 2.5rem;
  }

  nav ul {
    gap: 1rem;
  }

  nav a {
    font-size: 1rem;
  }
}

/* Smaller Tablets and Large Phones */
@media (max-width: 768px) {
  header {
    padding: 0.8rem 5%;
  }

  .logo img {
    height: 60px;
  }

  .menu-toggle {
    display: flex;
  }

  nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 70%;
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    justify-content: center;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 99;
  }

  nav.active {
    left: 0;
  }

  nav ul {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }

  nav a {
    font-size: 1.2rem;
  }

  .header-icons {
    gap: 1rem;
  }

  .header-icons a {
    font-size: 1.2rem;
  }

  .products-hero h1 {
    font-size: 2rem;
  }

  .products-hero {
    padding: 80px 20px;
  }

  .catalog-intro h1 {
    font-size: 1.8rem;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }

  .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .footer-bottom ul {
    justify-content: center;
  }
}

/* Mobile Phones */
@media (max-width: 480px) {
  header {
    padding: 0.6rem 5%;
  }

  .logo img {
    height: 50px;
  }

  .products-hero h1 {
    font-size: 1.8rem;
  }

  .products-hero {
    padding: 60px 20px;
  }

  .catalog-intro h1 {
    font-size: 1.6rem;
  }

  .category-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
  }
}

/* Very Small Phones */
@media (max-width: 360px) {
  .products-hero h1 {
    font-size: 1.5rem;
  }

  .header-icons {
    gap: 0.8rem;
  }

  .header-icons a {
    font-size: 1.1rem;
  }

  .product-info {
    padding: 1.5rem 1rem 1rem;
  }

  .product-name {
    font-size: 1.1rem;
  }

  .price {
    font-size: 1.1rem;
  }

  .cart-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* High-resolution displays */
@media (min-resolution: 192dpi) {
  .logo img {
    filter: contrast(1.1);
  }
}

/* Print styles */
@media print {
  header,
  .products-hero,
  .footer-with-bg::before,
  .footer-with-bg::after {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
  }

  .footer-with-bg {
    color: #000;
    background: #fff;
  }

  .footer-section a {
    color: #000;
  }
}
