/* --- CSS Variables & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Theme Palette: Modern Emerald & Gold */
  --bg-color: #0f172a;        /* Deep slate dark background */
  --card-bg: #1e293b;        /* Lighter slate for cards */
  --header-bg: #064e3b;      /* Rich Deep Emerald Green */
  --primary-accent: #d97706; /* Rich Gold / Amber */
  --accent-hover: #b45309;   
  --text-main: #f8fafc;      /* Crisp white */
  --text-sub: #94a3b8;       /* Muted gray */
  --border-color: #334155;   /* Dark subtle borders */
  --input-bg: #0f172a;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* ==========================================
   NAVBAR & HEADER STYLING
   ========================================== */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background-color: var(--header-bg);
  border-bottom: 2px solid var(--primary-accent);
  position: relative; /* Anchor point for dropdown menu */
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.nav-brand a {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Navbar Buttons */
.nav-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-outline {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: #ffffff;
}

.btn-gold {
  color: #ffffff;
  background-color: var(--primary-accent);
}

.btn-gold:hover {
  background-color: var(--accent-hover);
}

/* Toggle (Hamburger) Icon */
.nav-toggle {
  display: none; /* Hidden on Desktop */
  background: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  font-size: 1.4rem;
  border-radius: 6px;
  cursor: pointer;
}

/* --- Hero Banner --- */
.hero {
  background: linear-gradient(180deg, var(--header-bg) 0%, var(--bg-color) 100%);
  color: #ffffff;
  text-align: center;
  padding: 50px 20px 40px;
}

.hero h2 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-sub);
}

/* --- Shop Section --- */
.shop-section {
  max-width: 1200px;
  margin: 20px auto 60px;
  padding: 0 20px;
}

.title {
  font-size: 1.75rem;
  margin-bottom: 24px;
  color: var(--text-main);
}

/* Search Box & Category Filter Inputs */
#searchBox,
#categoryFilter,
#sortFilter {
  background-color: var(--card-bg);
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 24px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

#searchBox {
  width: 100%;
  max-width: 350px;
  margin-right: 0;
}

#searchBox::placeholder {
  color: var(--text-sub);
}

.product-suggestions {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  background-color: var(--card-bg);
  position: absolute;
  width: 100%;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.product-suggestions li {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-main);
}

.product-suggestions li:hover,
.product-suggestions li:focus {
  background-color: rgba(255, 255, 255, 0.08);
}

.product-suggestions .no-suggestion {
  color: var(--text-sub);
  cursor: default;
}

.search-input-wrap {
  position: relative;
  width: 100%;
}

#categoryFilter {
  cursor: pointer;
}

#searchBox:focus,
#categoryFilter:focus,
#sortFilter:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

/* --- Product Grid & Cards --- */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.product-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-content {
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(217, 119, 6, 0.4);
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  background-color: #000000;
}

.product-card h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.product-card .price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-accent);
  margin-bottom: 12px;
}

.product-card button {
  width: 100%;
  background-color: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.product-card button:hover {
  background-color: var(--accent-hover);
}

.product-card .stock-label {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text-sub);
}

.product-card.out-of-stock-card {
  opacity: 0.75;
}

.product-card .add-cart-btn[disabled] {
  background-color: #6b7280;
  cursor: not-allowed;
}

/* --- Cart Box --- */
.cart {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  margin: 40px auto;
  box-shadow: var(--shadow-md);
}

.cart h2 {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.cart h3 {
  margin-top: 16px;
  text-align: right;
  font-size: 1.2rem;
  color: var(--primary-accent);
}

.cart button {
  width: 100%;
  margin-top: 16px;
  background-color: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
}

.cart button:hover {
  background-color: var(--accent-hover);
}

/* ==========================================
   MOBILE RESPONSIVE BREAKPOINT (MAX-WIDTH: 768PX)
   ========================================== */
@media (max-width: 768px) {
  /* Show Hamburger Button on Mobile */
  .nav-toggle {
    display: block;
  }

  /* Absolute position the dropdown menu overlay */
  .nav-menu {
    display: none; /* Hidden by default */
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--header-bg);
    padding: 16px;
    border-bottom: 2px solid var(--primary-accent);
    box-shadow: var(--shadow-md);
    gap: 12px;
  }

  /* Show menu when toggled by JS */
  .nav-menu.active {
    display: flex;
  }

  /* Full-width menu buttons on mobile */
  .nav-btn {
    width: 100%;
    text-align: center;
    padding: 12px 0;
    display: block;
  }

  /* Responsive Form controls */
  #searchBox {
    max-width: 100%;
    margin-right: 0;
  }

  #categoryFilter {
    width: 100%;
  }
}