/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: #f0f5f0;
  color: #2d3a2d;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

:root {
  --green-dark: #1a472a;
  --green-mid: #2d6a4f;
  --green-main: #40916c;
  --green-light: #52b788;
  --green-lighter: #74c69d;
  --green-pale: #b7e4c7;
  --green-bg: #d8f3dc;
  --green-bg-light: #edf7ef;
  --accent-gold: #daa520;
  --white: #ffffff;
  --text-dark: #1b2e1b;
  --text-mid: #3d5a3d;
  --text-light: #6b8a6b;
  --shadow: 0 2px 12px rgba(26,71,42,0.08);
  --shadow-hover: 0 8px 30px rgba(26,71,42,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ===== Top Bar ===== */
.top-bar {
  background: var(--green-dark);
  color: var(--green-pale);
  font-size: 0.8rem;
  padding: 6px 0;
  text-align: center;
}

/* ===== Header ===== */
.header {
  background: var(--white);
  box-shadow: 0 2px 20px rgba(26,71,42,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  gap: 20px;
}
.logo { flex-shrink: 0; }
.logo img { height: 50px; }
.search-box { flex: 1; max-width: 560px; position: relative; }
.search-box input {
  width: 100%;
  padding: 12px 48px 12px 20px;
  border: 2px solid var(--green-pale);
  border-radius: 50px;
  font-size: 0.95rem;
  background: var(--green-bg-light);
  color: var(--text-dark);
  outline: none;
  transition: var(--transition);
}
.search-box input:focus { border-color: var(--green-main); background: var(--white); box-shadow: 0 0 0 4px rgba(64,145,108,0.15); }
.search-box button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--green-main); color: white; border: none;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.search-box button:hover { background: var(--green-mid); }
.search-box button svg { width: 18px; height: 18px; }

.header-actions { flex-shrink: 0; }
.cart-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-main); color: white;
  padding: 10px 20px; border-radius: 50px;
  font-size: 0.9rem; font-weight: 600; transition: var(--transition);
  position: relative; border: none;
}
.cart-btn:hover { background: var(--green-mid); transform: translateY(-1px); }
.cart-btn svg { width: 20px; height: 20px; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e74c3c; color: white;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.7rem; font-style: normal;
  display: flex; align-items: center; justify-content: center;
}
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-dark); }

/* ===== Nav ===== */
nav {
  background: var(--green-mid);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
nav::-webkit-scrollbar { height: 0; }
.nav-inner { display: flex; align-items: center; }
.nav-item {
  padding: 14px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  transition: var(--transition);
  border-bottom: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  color: white;
  background: rgba(255,255,255,0.1);
  border-bottom-color: var(--accent-gold);
}

/* ===== Flash ===== */
.flash-container { padding-top: 16px; }
.flash {
  padding: 12px 20px; border-radius: var(--radius-sm);
  margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between;
}
.flash-success { background: var(--green-bg); color: var(--green-dark); }
.flash-error { background: #fce4ec; color: #c62828; }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.5; }

/* ===== Hero ===== */
.hero {
  background:
    linear-gradient(180deg, rgba(12,32,14,0.45) 0%, rgba(12,32,14,0.25) 50%, rgba(12,32,14,0.55) 100%),
    url('../images/grass.jpg?v=1');
  background-size: auto, cover;
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-color: #234a25;
  padding: 60px 24px; text-align: center; color: white;
  position: relative; overflow: hidden;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(82,183,136,0.18) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(218,165,32,0.12) 0%, transparent 50%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.hero-logo { max-width: 300px; margin: 0 auto 24px; border-radius: 12px; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 12px; text-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.hero p { font-size: 1.15rem; opacity: 0.9; margin-bottom: 28px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 28px; }
.hero-stat .num { font-size: 2rem; font-weight: 800; color: var(--accent-gold); }
.hero-stat .label { font-size: 0.85rem; opacity: 0.8; }
.hero-cta {
  display: inline-block; background: var(--accent-gold); color: var(--green-dark);
  padding: 14px 36px; border-radius: 50px;
  font-size: 1rem; font-weight: 700; transition: var(--transition);
}
.hero-cta:hover { background: #c4961a; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(218,165,32,0.4); }

/* ===== Sections ===== */
.section { padding: 30px 0; }
.section-title {
  font-size: 1.4rem; font-weight: 700; color: var(--text-dark);
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.section-title::before { content: ''; width: 4px; height: 24px; background: var(--green-main); border-radius: 2px; }
.section-more { text-align: center; padding-top: 24px; }

/* ===== Brand Pills ===== */
.brand-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.brand-pills.compact { margin-bottom: 20px; }
.brand-pill {
  padding: 8px 18px; border-radius: 50px; font-size: 0.85rem; font-weight: 500;
  background: var(--white); color: var(--text-mid);
  border: 1.5px solid var(--green-pale); transition: var(--transition);
}
.brand-pill:hover, .brand-pill.active {
  background: var(--green-main); color: white; border-color: var(--green-main);
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(64,145,108,0.3);
}
.brand-pill .count { font-size: 0.75rem; opacity: 0.7; margin-left: 4px; }

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: var(--transition);
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.product-img {
  position: relative; padding-top: 100%; background: #fafafa;
  overflow: hidden; display: block;
}
.product-img img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 16px; transition: transform 0.5s ease;
  background: #fff;
}
.product-card:hover .product-img img { transform: scale(1.05); }
.product-badge {
  position: absolute; top: 10px; left: 10px;
  background: #e74c3c; color: white;
  padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; z-index: 2;
}
.product-badge.featured { background: var(--accent-gold); color: var(--green-dark); }
.product-info { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-brand { font-size: 0.75rem; color: var(--green-main); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.product-name {
  font-size: 0.9rem; font-weight: 600; color: var(--text-dark);
  line-height: 1.4; margin-bottom: 10px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-price { font-size: 1.2rem; font-weight: 800; color: var(--green-dark); }
.product-price .currency { font-size: 0.8rem; font-weight: 600; color: var(--text-light); }
.product-actions { padding: 0 16px 16px; display: flex; gap: 8px; }
.btn-cart {
  flex: 1; padding: 10px; background: var(--green-main); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; transition: var(--transition);
}
.btn-cart:hover { background: var(--green-mid); }
.btn-detail {
  padding: 10px 14px; background: var(--green-bg); color: var(--green-mid);
  border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; transition: var(--transition);
}
.btn-detail:hover { background: var(--green-pale); }
.add-cart-form { flex: 1; display: flex; }
.add-cart-form .btn-cart { width: 100%; }

/* ===== Filter Bar ===== */
.filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.result-count { font-size: 0.9rem; color: var(--text-light); }
.result-count strong { color: var(--green-main); font-size: 1.1rem; }
.sort-select {
  padding: 8px 14px; border: 1.5px solid var(--green-pale); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text-dark); font-size: 0.85rem; outline: none; cursor: pointer;
}
.filter-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.price-filter { display: flex; align-items: center; gap: 6px; }
.price-filter label { font-size: 0.85rem; color: var(--text-light); white-space: nowrap; }

/* ===== Breadcrumb ===== */
.breadcrumb { font-size: 0.85rem; color: var(--text-light); margin-bottom: 16px; }
.breadcrumb a { color: var(--green-main); }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 24px 0; flex-wrap: wrap; }
.page-btn {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.85rem;
  background: var(--white); color: var(--text-mid); border: 1px solid var(--green-pale); transition: var(--transition);
}
.page-btn:hover { background: var(--green-bg); border-color: var(--green-main); }
.page-btn.active { background: var(--green-main); color: white; border-color: var(--green-main); }
.page-dots { padding: 8px 6px; color: var(--text-light); }

/* ===== Product Detail ===== */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 16px; }
.main-image { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.main-image img { width: 100%; max-height: 500px; object-fit: contain; background: #fff; padding: 16px; }
.thumb-list { display: flex; gap: 8px; margin-top: 12px; }
.thumb {
  width: 70px; height: 70px; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid var(--green-pale); cursor: pointer; background: var(--white); padding: 4px;
}
.thumb.active { border-color: var(--green-main); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-brand { font-size: 0.85rem; color: var(--green-main); font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.detail-name { font-size: 1.6rem; font-weight: 800; color: var(--text-dark); line-height: 1.3; margin-bottom: 16px; }
.detail-price { margin-bottom: 16px; }
.current-price { font-size: 2rem; font-weight: 800; color: var(--green-dark); }
.original-price { font-size: 1.1rem; color: var(--text-light); text-decoration: line-through; margin-right: 12px; }
.detail-tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; margin-bottom: 16px; }
.detail-tag.used { background: #fff3e0; color: #e65100; }
.detail-meta { display: flex; gap: 24px; margin-bottom: 20px; font-size: 0.9rem; color: var(--text-light); }
.meta-label { color: var(--text-mid); font-weight: 600; margin-right: 6px; }
.detail-desc { margin-bottom: 24px; }
.detail-desc h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-dark); }
.detail-desc p { font-size: 0.9rem; color: var(--text-mid); line-height: 1.8; }
.detail-cart-form { display: flex; gap: 12px; align-items: center; }
.qty-control { display: flex; align-items: center; border: 2px solid var(--green-pale); border-radius: var(--radius-sm); overflow: hidden; }
.qty-control button { width: 40px; height: 44px; background: var(--green-bg-light); border: none; font-size: 1.2rem; transition: var(--transition); }
.qty-control button:hover { background: var(--green-pale); }
.qty-control input { width: 50px; height: 44px; text-align: center; border: none; font-size: 1rem; outline: none; }
.btn-add-cart {
  flex: 1; padding: 14px 30px; background: var(--green-main); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700; transition: var(--transition);
}
.btn-add-cart:hover { background: var(--green-mid); }
.btn-add-cart:disabled { background: #ccc; cursor: not-allowed; }
.related-section { margin-top: 50px; }
.detail-specs { margin-bottom: 24px; }
.detail-specs h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-dark); }
.specs-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.specs-table td { padding: 10px 14px; border-bottom: 1px solid var(--green-bg); }
.specs-table td:first-child { width: 120px; font-weight: 600; color: var(--text-mid); background: var(--green-bg-light); }
.desc-content { font-size: 0.9rem; color: var(--text-mid); line-height: 1.8; white-space: pre-wrap; }

/* ===== Cart ===== */
.cart-table { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cart-header { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 60px; padding: 14px 20px; background: var(--green-bg-light); font-size: 0.85rem; font-weight: 600; color: var(--text-mid); }
.cart-row { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 60px; padding: 16px 20px; align-items: center; border-bottom: 1px solid var(--green-bg); }
.cart-col-product { display: flex; gap: 12px; align-items: center; }
.cart-thumb { width: 60px; height: 60px; object-fit: contain; border-radius: var(--radius-sm); background: #fafafa; flex-shrink: 0; }
.cart-item-name { font-size: 0.9rem; font-weight: 600; }
.cart-item-brand { font-size: 0.75rem; color: var(--text-light); }
.qty-inline { display: flex; align-items: center; gap: 4px; }
.qty-btn { width: 28px; height: 28px; border: 1px solid var(--green-pale); border-radius: 50%; background: var(--white); font-size: 0.9rem; display: flex; align-items: center; justify-content: center; }
.qty-val { padding: 0 8px; font-weight: 600; }
.btn-remove { background: none; border: none; color: #e74c3c; font-size: 1.3rem; cursor: pointer; }
.cart-summary { margin-top: 20px; display: flex; justify-content: flex-end; align-items: center; gap: 24px; }
.cart-total { font-size: 1.2rem; }
.cart-total strong { font-size: 1.5rem; color: var(--green-dark); margin-left: 8px; }
.cart-actions { display: flex; gap: 12px; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block; padding: 12px 24px; background: var(--green-main); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600; transition: var(--transition); text-align: center;
}
.btn-primary:hover { background: var(--green-mid); }
.btn-secondary {
  display: inline-block; padding: 12px 24px; background: var(--white); color: var(--green-main); border: 2px solid var(--green-main);
  border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600; transition: var(--transition); text-align: center;
}
.btn-secondary:hover { background: var(--green-bg); }
.btn-block { display: block; width: 100%; }
.btn-load-more {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 40px; background: var(--white); color: var(--green-main);
  border: 2px solid var(--green-main); border-radius: 50px;
  font-size: 1rem; font-weight: 600; transition: var(--transition);
}
.btn-load-more:hover { background: var(--green-main); color: white; transform: translateY(-2px); }

/* ===== Checkout ===== */
.checkout-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; }
.checkout-form h3, .checkout-summary h3 { font-size: 1.2rem; margin-bottom: 20px; color: var(--text-dark); }
.checkout-form { background: var(--white); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--green-pale); border-radius: var(--radius-sm);
  font-size: 0.9rem; outline: none; transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--green-main); box-shadow: 0 0 0 3px rgba(64,145,108,0.1); }
.checkout-summary { background: var(--white); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); align-self: start; position: sticky; top: 100px; }
.summary-items { border-bottom: 1px solid var(--green-bg); padding-bottom: 16px; margin-bottom: 16px; }
.summary-item { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.9rem; }
.summary-name { flex: 1; color: var(--text-mid); }
.summary-price { font-weight: 600; white-space: nowrap; margin-left: 12px; }
.summary-total { display: flex; justify-content: space-between; font-size: 1.1rem; margin-bottom: 20px; }
.summary-total strong { font-size: 1.4rem; color: var(--green-dark); }

/* ===== Features ===== */
.features { background: var(--white); padding: 50px 24px; margin-top: 20px; }
.features-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; }
.feature-card { text-align: center; padding: 24px; }
.feature-icon { width: 60px; height: 60px; background: var(--green-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 1.5rem; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.85rem; color: var(--text-light); }

/* ===== Footer ===== */
footer { background: var(--green-dark); color: rgba(255,255,255,0.8); padding: 50px 24px 30px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand img { height: 45px; margin-bottom: 16px; filter: brightness(10); }
.footer-brand p { font-size: 0.85rem; line-height: 1.8; opacity: 0.7; }
.footer-col h4 { color: var(--green-lighter); font-size: 0.9rem; font-weight: 700; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 1px; }
.footer-col a { display: block; font-size: 0.85rem; padding: 4px 0; opacity: 0.7; transition: var(--transition); }
.footer-col a:hover { opacity: 1; color: var(--green-lighter); }
.footer-bottom { margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); text-align: center; font-size: 0.8rem; opacity: 0.5; }

/* ===== No Results ===== */
.no-results { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-light); }
.no-results svg { opacity: 0.3; margin: 0 auto 16px; }
.no-results h3 { font-size: 1.2rem; color: var(--text-mid); margin-bottom: 8px; }

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed; bottom: 30px; right: 30px; width: 48px; height: 48px;
  background: var(--green-main); color: white; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 15px rgba(64,145,108,0.4); transition: var(--transition);
  opacity: 0; pointer-events: none; z-index: 99;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--green-mid); transform: translateY(-3px); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner { padding: 10px 16px; gap: 10px; }
  .logo img { height: 38px; }
  .cart-btn span { display: none; }
  .cart-btn { padding: 10px; }
  .mobile-menu-btn { display: block; }
  nav { display: none; }
  nav.open { display: block; }
  .hero { padding: 40px 16px; }
  .hero h1 { font-size: 1.6rem; }
  .hero-stats { gap: 20px; }
  .hero-stat .num { font-size: 1.4rem; }
  .hero-logo { max-width: 200px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-info { padding: 10px; }
  .product-name { font-size: 0.8rem; }
  .product-price { font-size: 1rem; }
  .product-actions { padding: 0 10px 10px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .product-detail { grid-template-columns: 1fr; gap: 20px; }
  .checkout-layout { grid-template-columns: 1fr; }
  .cart-header { display: none; }
  .cart-row { grid-template-columns: 1fr; gap: 8px; }
  .container { padding: 0 16px; }
}
