/*
Theme Name: Agromart
Theme URI: https://example.com/agromart
Author: Your Name
Description: A WooCommerce-ready online agro shopping mall theme. Top bar, sticky header with search and cart, mega category menu, hero slider, popular category tiles, featured and per-category product sections with discount badges, trust bar, and a four-column footer. Bengali (Hind Siliguri) ready.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: agromart
Tags: e-commerce, woocommerce, custom-colors, custom-logo, custom-menu, featured-images, translation-ready
*/

/* ---------- Tokens ---------- */
:root {
  --am-primary: #1f7a3d;
  --am-primary-dark: #155a2c;
  --am-accent: #f59e0b;
  --am-sale: #e11d48;
  --am-bg: #f4f6f4;
  --am-card: #ffffff;
  --am-text: #1f2937;
  --am-muted: #6b7280;
  --am-border: #e5e7eb;
  --am-radius: 10px;
  --am-shadow: 0 1px 3px rgba(0,0,0,.08);
  --am-shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --am-container: 1240px;
  --am-font: 'Hind Siliguri', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--am-font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--am-text);
  background: var(--am-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--am-primary); text-decoration: none; }
a:hover { color: var(--am-primary-dark); }
ul { margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4 { line-height: 1.25; margin: 0 0 .5em; }
.screen-reader-text {
  position: absolute !important; clip: rect(1px,1px,1px,1px);
  width: 1px; height: 1px; overflow: hidden;
}
.am-container { width: 100%; max-width: var(--am-container); margin: 0 auto; padding: 0 16px; }

/* ---------- Buttons ---------- */
.am-btn, .button, button.button, input[type=submit], .woocommerce a.button, .woocommerce button.button, .woocommerce #respond input#submit {
  display: inline-block;
  background: var(--am-primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.am-btn:hover, .button:hover, .woocommerce a.button:hover, .woocommerce button.button:hover { background: var(--am-primary-dark); color: #fff; }
.am-btn--accent { background: var(--am-accent); color: #1f2937; }
.am-btn--accent:hover { background: #d98a06; color: #1f2937; }
.woocommerce a.button.alt, .woocommerce button.button.alt { background: var(--am-primary); }

/* ---------- Top bar ---------- */
.am-topbar { background: var(--am-primary-dark); color: #fff; font-size: 14px; }
.am-topbar .am-container { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: 16px; }
.am-topbar a { color: #fff; opacity: .92; }
.am-topbar a:hover { opacity: 1; }
.am-topbar__links { display: flex; gap: 18px; }

/* ---------- Header ---------- */
.am-header { background: #fff; box-shadow: var(--am-shadow); position: sticky; top: 0; z-index: 100; }
.am-header__main { display: flex; align-items: center; gap: 20px; padding: 12px 0; }
.am-logo { display: flex; flex-direction: column; flex-shrink: 0; line-height: 1.1; }
.am-logo img, .custom-logo { max-height: 52px; width: auto; }
.am-logo__name { font-size: 24px; font-weight: 700; color: var(--am-primary); }
.am-logo__tag { font-size: 12px; color: var(--am-muted); }

.am-search { flex: 1; display: flex; max-width: 640px; margin: 0 auto; }
.am-search input[type=search] {
  flex: 1; min-width: 0; padding: 11px 14px; font: inherit;
  border: 2px solid var(--am-primary); border-right: 0;
  border-radius: 8px 0 0 8px; outline: none; background: #fff;
}
.am-search button {
  background: var(--am-primary); color: #fff; border: 0; padding: 0 20px;
  border-radius: 0 8px 8px 0; cursor: pointer; font: inherit; font-weight: 600;
}
.am-search button:hover { background: var(--am-primary-dark); }

.am-header__actions { display: flex; align-items: center; gap: 10px; }
.am-action {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: 8px; color: var(--am-text); font-weight: 600; position: relative;
}
.am-action:hover { background: var(--am-bg); color: var(--am-primary); }
.am-action svg { width: 22px; height: 22px; }
.am-cart-count {
  position: absolute; top: 0; right: 2px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--am-sale); color: #fff; border-radius: 9px; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.am-burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--am-text); }
.am-burger svg { width: 26px; height: 26px; }

/* ---------- Main nav ---------- */
.am-nav { background: #fff; border-top: 1px solid var(--am-border); }
.am-nav .am-container { display: flex; align-items: center; gap: 4px; }
.am-menu { display: flex; align-items: center; flex-wrap: wrap; }
.am-menu > li { position: relative; }
.am-menu > li > a {
  display: block; padding: 12px 16px; color: var(--am-text); font-weight: 600;
}
.am-menu > li > a:hover, .am-menu > li.current-menu-item > a { color: var(--am-primary); }
.am-menu .sub-menu {
  position: absolute; left: 0; top: 100%; min-width: 220px; background: #fff;
  box-shadow: var(--am-shadow-lg); border-radius: 0 0 var(--am-radius) var(--am-radius);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: .2s; z-index: 50;
}
.am-menu li:hover > .sub-menu, .am-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.am-menu .sub-menu a { display: block; padding: 10px 16px; color: var(--am-text); }
.am-menu .sub-menu a:hover { background: var(--am-bg); color: var(--am-primary); }
.am-menu .menu-item-has-children > a::after { content: " ▾"; font-size: 11px; }

/* ---------- Hero slider ---------- */
.am-hero { margin: 16px 0; }
.am-slider { position: relative; overflow: hidden; border-radius: var(--am-radius); background: #dfe8e0; box-shadow: var(--am-shadow); }
.am-slider__track { display: flex; transition: transform .5s ease; }
.am-slide { flex: 0 0 100%; position: relative; aspect-ratio: 21 / 8; min-height: 180px; }
.am-slide img { width: 100%; height: 100%; object-fit: cover; }
.am-slide--text {
  display: flex; align-items: center; padding: 0 8%;
  background: linear-gradient(120deg, var(--am-primary-dark), var(--am-primary));
  color: #fff;
}
.am-slide--text h2 { font-size: clamp(22px, 4vw, 44px); }
.am-slide--text p { font-size: clamp(14px, 1.6vw, 18px); opacity: .9; max-width: 520px; }
.am-slider__btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--am-text);
  cursor: pointer; font-size: 20px; box-shadow: var(--am-shadow); opacity: 0; transition: opacity .2s;
}
.am-slider:hover .am-slider__btn { opacity: 1; }
.am-slider__btn--prev { left: 12px; } .am-slider__btn--next { right: 12px; }
.am-slider__dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.am-slider__dot { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255,255,255,.6); cursor: pointer; padding: 0; }
.am-slider__dot.is-active { background: #fff; width: 26px; border-radius: 5px; }

/* ---------- Sections ---------- */
.am-section { margin: 28px 0; }
.am-section__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.am-section__title { font-size: 22px; font-weight: 700; margin: 0; padding-left: 12px; border-left: 4px solid var(--am-primary); }
.am-section__more { font-weight: 600; font-size: 14px; border: 1px solid var(--am-primary); padding: 5px 14px; border-radius: 20px; }
.am-section__more:hover { background: var(--am-primary); color: #fff; }
.am-subcats { display: flex; gap: 8px; flex-wrap: wrap; }
.am-subcats a { font-size: 13px; background: #fff; border: 1px solid var(--am-border); padding: 4px 12px; border-radius: 20px; color: var(--am-text); }
.am-subcats a:hover { border-color: var(--am-primary); color: var(--am-primary); }

/* Category tiles */
.am-cats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.am-cat {
  background: var(--am-card); border-radius: var(--am-radius); padding: 14px 8px 12px;
  text-align: center; box-shadow: var(--am-shadow); transition: transform .2s, box-shadow .2s; color: var(--am-text);
}
.am-cat:hover { transform: translateY(-4px); box-shadow: var(--am-shadow-lg); color: var(--am-primary); }
.am-cat__img { width: 88px; height: 88px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; background: var(--am-bg); display: flex; align-items: center; justify-content: center; }
.am-cat__img img { width: 100%; height: 100%; object-fit: cover; }
.am-cat__name { font-weight: 600; font-size: 15px; line-height: 1.3; }

/* Category banner + products */
.am-catblock { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.am-catblock__banner { border-radius: var(--am-radius); overflow: hidden; box-shadow: var(--am-shadow); background: linear-gradient(160deg, var(--am-primary), var(--am-primary-dark)); min-height: 240px; display: flex; align-items: flex-end; }
.am-catblock__banner img { width: 100%; height: 100%; object-fit: cover; }
.am-catblock__banner span { color: #fff; padding: 18px; font-size: 22px; font-weight: 700; }

/* ---------- Product grid / cards ---------- */
.am-products, ul.products {
  display: grid !important; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin: 0; padding: 0; list-style: none;
}
.am-catblock .am-products { grid-template-columns: repeat(4, 1fr); }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
.woocommerce ul.products li.product, .am-card {
  width: auto !important; margin: 0 !important; float: none !important;
  background: var(--am-card); border-radius: var(--am-radius); box-shadow: var(--am-shadow);
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.am-card:hover { transform: translateY(-4px); box-shadow: var(--am-shadow-lg); }
.am-card__thumb { display: block; aspect-ratio: 1 / 1; background: #fff; overflow: hidden; }
.am-card__thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .3s; }
.am-card:hover .am-card__thumb img { transform: scale(1.05); }
.am-card__body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.am-card__title { font-size: 14.5px; font-weight: 600; margin: 0; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.am-card__title a { color: var(--am-text); }
.am-card__title a:hover { color: var(--am-primary); }
.am-card__price { font-weight: 700; color: var(--am-primary); font-size: 17px; margin-top: auto; }
.am-card__price del { color: var(--am-muted); font-weight: 400; font-size: 13px; margin-right: 6px; opacity: 1; }
.am-card__price ins { text-decoration: none; }
.am-card__actions { margin-top: 6px; }
.am-card__actions .button { width: 100%; text-align: center; padding: 8px 10px; font-size: 14px; }
.am-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--am-sale); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.am-badge--out { background: #6b7280; left: auto; right: 10px; }
.woocommerce span.onsale { display: none; }

/* ---------- Trust bar / stats ---------- */
.am-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.am-stat { background: var(--am-card); border-radius: var(--am-radius); box-shadow: var(--am-shadow); padding: 20px; text-align: center; }
.am-stat strong { display: block; font-size: 32px; color: var(--am-primary); }
.am-trust { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.am-trust__item { background: var(--am-card); border-radius: var(--am-radius); box-shadow: var(--am-shadow); padding: 20px 14px; text-align: center; }
.am-trust__icon { font-size: 34px; margin-bottom: 6px; }
.am-trust__item h3 { font-size: 16px; margin-bottom: 4px; }
.am-trust__item p { margin: 0; font-size: 13.5px; color: var(--am-muted); }

/* ---------- Footer ---------- */
.am-footer { background: #10281a; color: #cfe3d5; margin-top: 40px; }
.am-footer a { color: #cfe3d5; }
.am-footer a:hover { color: #fff; }
.am-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 32px; padding: 44px 0 28px; }
.am-footer h3 { color: #fff; font-size: 18px; margin-bottom: 14px; }
.am-footer li { margin-bottom: 8px; }
.am-footer__bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 16px 0; text-align: center; font-size: 14px; }
.am-footer__pay { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.am-footer__pay span { background: #fff; color: #1f2937; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px; }

/* Floating chat */
.am-float { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.am-float a { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; box-shadow: var(--am-shadow-lg); }
.am-float__wa { background: #25d366; } .am-float__ms { background: #0084ff; }

/* ---------- Generic content ---------- */
.am-main { padding: 20px 0 10px; }
.am-content { background: #fff; padding: 28px; border-radius: var(--am-radius); box-shadow: var(--am-shadow); }
.am-page-title { font-size: 28px; margin-bottom: 18px; }
.am-posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.am-post { background: #fff; border-radius: var(--am-radius); box-shadow: var(--am-shadow); overflow: hidden; }
.am-post__body { padding: 16px; }
.am-breadcrumb { font-size: 14px; color: var(--am-muted); margin-bottom: 14px; }
.am-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.am-sidebar .widget { background: #fff; padding: 16px; border-radius: var(--am-radius); box-shadow: var(--am-shadow); margin-bottom: 16px; }
.am-sidebar .widget-title { font-size: 17px; border-bottom: 2px solid var(--am-primary); padding-bottom: 6px; }
.am-pagination { margin: 24px 0; display: flex; gap: 6px; justify-content: center; }
.am-pagination .page-numbers { padding: 8px 14px; background: #fff; border-radius: 6px; box-shadow: var(--am-shadow); }
.am-pagination .current { background: var(--am-primary); color: #fff; }

/* ---------- WooCommerce pages ---------- */
.woocommerce-page .am-content, .woocommerce .am-content { padding: 22px; }
.woocommerce div.product .product_title { font-size: 26px; }
.woocommerce div.product p.price, .woocommerce div.product span.price { color: var(--am-primary); font-weight: 700; font-size: 24px; }
.woocommerce div.product p.price del { color: var(--am-muted); font-size: 16px; }
.woocommerce div.product p.price ins { text-decoration: none; }
.woocommerce div.product form.cart .button { padding: 12px 26px; }
.woocommerce-tabs ul.tabs li.active { border-bottom-color: #fff; }
.woocommerce table.shop_table { border-radius: var(--am-radius); border-collapse: collapse; }
.woocommerce-message, .woocommerce-info { border-top-color: var(--am-primary); }
.woocommerce-message::before, .woocommerce-info::before { color: var(--am-primary); }
.woocommerce .woocommerce-ordering select, .woocommerce-page .woocommerce-ordering select { padding: 8px; border-radius: 8px; border: 1px solid var(--am-border); font: inherit; }
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea, .woocommerce form .form-row select {
  padding: 10px 12px; border: 1px solid var(--am-border); border-radius: 8px; font: inherit;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .am-cats { grid-template-columns: repeat(3, 1fr); }
  .am-products, ul.products { grid-template-columns: repeat(4, 1fr); }
  .am-catblock { grid-template-columns: 1fr; }
  .am-catblock__banner { min-height: 140px; }
  .am-catblock .am-products { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .am-products, ul.products, .am-catblock .am-products { grid-template-columns: repeat(3, 1fr); }
  .am-trust { grid-template-columns: repeat(2, 1fr); }
  .am-footer__grid { grid-template-columns: 1fr 1fr; }
  .am-posts { grid-template-columns: repeat(2, 1fr); }
  .am-layout { grid-template-columns: 1fr; }
  .am-burger { display: inline-flex; }
  .am-nav { display: none; }
  .am-nav.is-open { display: block; }
  .am-nav .am-container { display: block; padding: 0; }
  .am-menu { flex-direction: column; align-items: stretch; }
  .am-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding-left: 14px; }
  .am-header__main { flex-wrap: wrap; }
  .am-search { order: 5; flex-basis: 100%; max-width: none; }
  .am-action span.am-action__label { display: none; }
}
@media (max-width: 560px) {
  .am-products, ul.products, .am-catblock .am-products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .am-cats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .am-cat__img { width: 64px; height: 64px; }
  .am-cat__name { font-size: 13px; }
  .am-stats { grid-template-columns: 1fr; }
  .am-footer__grid { grid-template-columns: 1fr; }
  .am-posts { grid-template-columns: 1fr; }
  .am-topbar__links { gap: 10px; }
  .am-slide { aspect-ratio: 16 / 8; }
  .am-section__title { font-size: 18px; }
}
