﻿/*
Theme Name: FreshMart
Description: Fresh grocery store theme built for WooCommerce â€” hero, category tiles, deals banner and a live cart drawer powered by the WooCommerce Store API.
Version: 1.1.7
Author: FreshMart
Text Domain: freshmart
License: GPLv2 or later
*/

:root {
  --gold: #c9a227;
  --gold-dark: #9a7b1e;
  --black: #0f0f10;
  --bg: #f7f7f6;
  --card: #ffffff;
  --text: #17181c;
  --muted: #6b7280;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

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

html { scroll-behavior: smooth; }

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

.header {
  background: var(--card);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 74px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo span { color: var(--gold); }
.logo-img {
  height: 52px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  display: block;
}
.logo-text { font-weight: 800; }

.search-box {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--muted);
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--text);
}

.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  transition: color 0.15s;
}
.nav a:hover { color: var(--gold); }

.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  transition: background 0.15s;
  text-decoration: none;
}
.cart-btn:hover { background: #f3f4f6; }

.cart-count {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--gold);
  color: #111;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.hero {
  background: var(--black);
  padding: 70px 0;
}
.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.hero-tag {
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  font-weight: 800;
  color: #fff;
}
.hero h1 span { color: var(--gold); }
.hero-sub {
  color: rgba(255, 255, 255, 0.65);
  margin: 16px 0 26px;
  font-size: 17px;
  max-width: 480px;
}
.hero-art { font-size: clamp(90px, 14vw, 170px); }

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gold); color: #111; }
.btn-primary:hover { background: var(--gold-dark); box-shadow: 0 6px 16px rgba(201, 162, 39, 0.4); color: #111; }
.btn-light { background: #fff; color: #111; }

.categories { padding: 56px 20px 24px; }
.categories h2, .products-section h2 { font-size: 26px; margin-bottom: 22px; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.category-card {
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--gold);
}
.category-card .emoji { font-size: 36px; display: block; margin-bottom: 8px; }
.category-card .name { font-weight: 600; font-size: 14px; }

.products-section { padding: 36px 20px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.chip.active, .chip:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.product-card {
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.product-img {
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #faf8f2, #f3efe3);
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
}

.product-info { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-weight: 600; font-size: 15px; }
.product-name a { color: inherit; text-decoration: none; }
.product-unit { color: var(--muted); font-size: 12.5px; }
.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
}
.price { font-weight: 700; font-size: 17px; color: var(--gold-dark); }

.add-btn {
  background: var(--gold);
  border: none;
  color: #111;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.12s;
}
.add-btn:hover { background: var(--gold-dark); transform: scale(1.08); color: #111; }

.badge {
  display: inline-block;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-sale { background: #111; color: var(--gold); }
.badge-org { background: #ffffff; color: #111; border: 1px solid #d1d5db; }

.empty-msg { text-align: center; color: var(--muted); padding: 48px 0; font-size: 16px; }

.deals-banner {
  margin: 30px auto 60px;
  background: linear-gradient(110deg, #1c1c1e, #000000);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.deals-banner h2 { font-size: 26px; margin-bottom: 8px; color: var(--gold); }
.deals-banner strong { color: var(--gold); }
.deals-banner p { opacity: 0.9; }

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
  z-index: 90;
}
.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 92vw;
  height: 100vh;
  background: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.28s ease;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
}
.cart-sidebar.open { right: 0; }

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}
.close-btn {
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.close-btn:hover { color: var(--text); }

.cart-items { flex: 1; overflow-y: auto; padding: 16px 20px; }

.cart-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed #e5e7eb;
}
.cart-item-img {
  width: 52px;
  height: 52px;
  background: #f5f2e8;
  border-radius: 10px;
  overflow: hidden;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: contain; }
.cart-item-name { font-weight: 600; font-size: 14px; }
.cart-item-price { color: var(--muted); font-size: 13px; }

.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-controls button {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.qty-controls button:hover { border-color: var(--gold); color: var(--gold); }
.qty-controls span { font-weight: 600; min-width: 18px; text-align: center; }
.cart-item-remove {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 12px;
  margin-top: 4px;
  text-decoration: underline;
  padding: 0;
}
.cart-item-remove:hover { color: #dc2626; }

.cart-empty { text-align: center; color: var(--muted); padding: 60px 10px; }
.cart-empty .big { font-size: 44px; display: block; margin-bottom: 10px; }

.cart-foot { border-top: 1px solid #e5e7eb; padding: 18px 20px; }
.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  margin-bottom: 14px;
}
.checkout-btn { width: 100%; text-align: center; }

.footer {
  background: #0a0a0a;
  color: #9ca3af;
  padding: 48px 20px 20px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  padding-bottom: 28px;
}
.footer h3 { color: var(--gold); margin-bottom: 10px; }
.footer h4 { color: #fff; margin-bottom: 12px; font-size: 15px; }
.footer a {
  display: block;
  color: #9ca3af;
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 14px;
}
.footer a:hover { color: var(--gold); }
.copyright { text-align: center; border-top: 1px solid #374151; padding-top: 18px; font-size: 13px; }

.site-main { min-height: 40vh; padding: 40px 20px; }
.page-title { font-size: 28px; margin-bottom: 24px; }
.entry-content a { color: var(--gold-dark); }

.woocommerce-message, .woocommerce-info, .woocommerce-error {
  border-top-color: var(--gold) !important;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px 18px !important;
  margin-bottom: 20px;
  list-style: none;
}
.woocommerce-message::before, .woocommerce-info::before { color: var(--gold) !important; }

.woocommerce ul.products { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin: 0 !important; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
.woocommerce ul.products li.product {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0 !important;
  text-align: left !important;
}
.woocommerce ul.products li.product:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.woocommerce ul.products li.product img { border-radius: 0; margin: 0; height: 190px; object-fit: contain; padding: 12px; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: 15px !important; font-weight: 600; padding: 12px 16px 0 !important; color: var(--text) !important; }
.woocommerce ul.products li.product .price { padding: 4px 16px 16px !important; font-weight: 700; font-size: 17px !important; color: var(--gold-dark) !important; }
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button {
  margin: 0 16px 16px !important;
  background: var(--gold) !important;
  color: #111 !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
  padding: 9px 20px !important;
  width: fit-content !important;
}
.woocommerce ul.products li.product .button:hover { background: var(--gold-dark) !important; }
.woocommerce span.onsale {
  background: var(--gold) !important;
  color: #111 !important;
  border-radius: 999px !important;
  font-weight: 700;
  min-height: auto !important;
  min-width: auto !important;
  line-height: 1 !important;
  padding: 6px 12px !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 5;
}
.woocommerce .star-rating span::before { color: #f59e0b; }

.woocommerce div.product .product_title { font-size: 28px; font-weight: 700; }
.woocommerce div.product p.price { color: var(--gold-dark) !important; font-size: 22px !important; font-weight: 700; }
.woocommerce div.product form.cart .button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button {
  background: var(--gold) !important;
  color: #111 !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
  padding: 12px 26px !important;
}
.woocommerce button.button:hover,
.woocommerce a.button:hover { background: var(--gold-dark) !important; color: #111 !important; }
.woocommerce .quantity input[type="number"] { border-radius: 8px; border: 1px solid #d1d5db; padding: 8px; }

.woocommerce table.shop_table { border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.woocommerce table.shop_table th { background: #f7f3e6; color: var(--gold-dark); }
.woocommerce-checkout #payment { background: #faf8f2; border-radius: var(--radius); }

.woocommerce .woocommerce-breadcrumb { color: var(--muted); margin-bottom: 18px; }
.woocommerce-result-count { color: var(--muted); }
.woocommerce nav.woocommerce-pagination ul { border: none; }
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
  background: #fff;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  margin: 0 3px;
  color: var(--text);
}
.woocommerce nav.woocommerce-pagination ul li span.current { background: var(--gold); color: #111; }

@media (max-width: 768px) {
  .nav { display: none; }
  .hero-inner { flex-direction: column-reverse; text-align: center; }
  .hero-sub { margin-inline: auto; }
  .section-head { flex-direction: column; align-items: flex-start; }
}
