:root {
  --green: #2D4A3E;
  --green-dark: #1F352C;
  --cream: #F7F2E7;
  --cream-soft: #FCFAF4;
  --coral: #E06B3C;
  --coral-dark: #BB5128;
  --navy: #1E2A35;
  --ink: #20231F;
  --ink-soft: #6B6E68;
  --line: #E5DFD2;
  --danger: #B3382C;
  --success: #3B6D11;
  --font-display: "Sora", sans-serif;
  --font-body: "Inter", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream-soft);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--cream-soft);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--green);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px 8px 6px 6px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line);
}

#userName {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-signout {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.btn-signout:hover { color: var(--danger); }

.cart-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
}

.cart-trigger:hover { background: var(--green-dark); }

/* ---------- Hero ---------- */

.hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 72px 24px 48px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  line-height: 1.15;
  color: var(--green);
  margin: 0 0 16px;
}

.hero p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Shop controls ---------- */

.shop { max-width: 1140px; margin: 0 auto; padding: 0 24px 80px; }

.shop-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border-radius: 10px;
  padding: 10px 14px;
  flex: 1;
  min-width: 200px;
  color: var(--ink-soft);
}

.search-box input {
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  flex: 1;
}

.search-box input:focus { outline: none; }

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: var(--cream-soft);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.chip.active { background: var(--green); border-color: var(--green); color: #fff; }

.sort-select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--cream-soft);
  color: var(--ink-soft);
  margin-left: auto;
}

.result-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 18px 0 22px;
}

/* ---------- Product grid ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.product-card {
  background: var(--cream-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--green);
  box-shadow: 0 10px 24px -8px rgba(45, 74, 62, 0.25);
}

.product-icon {
  width: 100%;
  aspect-ratio: 1.3;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  overflow: hidden;
}

.product-icon.coral { background: #FBE6DA; color: var(--coral-dark); }
.product-icon.green { background: #E1E8E3; color: var(--green); }
.product-icon.navy { background: #E3E7EB; color: var(--navy); }

.product-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.product-name {
  font-size: 0.92rem;
  font-weight: 500;
  margin: 0 0 6px;
  line-height: 1.4;
  flex: 1;
}

.product-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--green);
  margin: 0 0 12px;
}

.btn-add-cart {
  border: 1px solid var(--green);
  background: none;
  color: var(--green);
  border-radius: 8px;
  padding: 9px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-add-cart:hover { background: var(--green); color: #fff; }

.btn-add-cart.added { background: var(--success); border-color: var(--success); color: #fff; }

.no-results {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
}

/* ---------- Footer ---------- */

.site-footer { background: var(--green); padding: 26px 0; }

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Cart drawer ---------- */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 20, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--cream-soft);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.cart-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
}

.cart-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 40px 20px;
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cart-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cart-item-icon.coral { background: #FBE6DA; color: var(--coral-dark); }
.cart-item-icon.green { background: #E1E8E3; color: var(--green); }
.cart-item-icon.navy { background: #E3E7EB; color: var(--navy); }

.cart-item-body { flex: 1; }

.cart-item-name {
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0 0 6px;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}

.qty-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink);
  border-radius: 6px;
}

.qty-btn:hover { background: var(--cream); }

.qty-value { font-size: 0.85rem; font-weight: 500; min-width: 16px; text-align: center; }

.cart-item-price { font-size: 0.88rem; font-weight: 600; color: var(--green); }

.cart-item-remove {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  margin-top: 4px;
}

.cart-item-remove:hover { color: var(--danger); }

.cart-footer {
  border-top: 1px solid var(--line);
  padding: 18px 22px 22px;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.cart-delivery-note {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.5;
  background: var(--cream);
  border-radius: 8px;
  padding: 8px 10px;
  margin: -2px 0 10px;
}

.cart-delivery-note strong {
  font-weight: 700;
  color: var(--green);
}

.pickup-eligibility-note {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 6px 0 0;
}

.cart-total {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.btn-checkout {
  width: 100%;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 14px;
}

.btn-checkout:hover { background: var(--coral-dark); }

.btn-checkout:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }

/* ---------- Checkout modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
  padding: 20px;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.checkout-modal {
  background: var(--cream-soft);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
}

#checkoutForm label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 14px 0 6px;
}

#checkoutForm label:first-of-type { margin-top: 0; }

#checkoutForm input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
}

#checkoutForm input:focus { outline: 2px solid var(--coral); outline-offset: 1px; }

#checkoutForm input.invalid { border-color: var(--danger); }

.error-text {
  display: block;
  min-height: 16px;
  font-size: 0.76rem;
  color: var(--danger);
  margin-top: 4px;
}

.checkout-error-text {
  font-size: 0.85rem;
  color: var(--danger);
  text-align: center;
  margin: 12px 0 0;
  min-height: 18px;
}

.order-id-display {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--cream);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  margin: 0 0 8px;
}

.track-link-row {
  text-align: center;
  margin: 0 0 18px;
}

.track-link-row a {
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 600;
}

.track-link-row a:hover { text-decoration: underline; }

.payment-method-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.payment-method-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--cream-soft);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.payment-method-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

.delivery-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 8px 0 0;
  line-height: 1.4;
}

.pickup-eligibility-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
  line-height: 1.4;
}

.gcash-qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.gcash-qr-image {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.cod-confirm-box {
  background: var(--cream);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.cod-confirm-box svg { color: var(--green); }

.cod-confirm-box p {
  margin: 10px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.gcash-payment-box {
  background: var(--cream);
  border-radius: 14px;
  padding: 20px;
  text-align: left;
  margin: 0 0 18px;
}

.gcash-payment-box h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--green);
  margin: 0 0 8px;
}

.gcash-instructions {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 16px;
}

.gcash-details {
  background: var(--cream-soft);
  border-radius: 10px;
  padding: 4px 14px;
  margin-bottom: 18px;
}

.gcash-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.gcash-detail-row:last-child { border-bottom: none; }

.gcash-detail-row span:first-child { color: var(--ink-soft); }

.gcash-detail-row span:last-child { font-weight: 600; color: var(--ink); }

#proofForm label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 14px 0 6px;
  text-align: left;
}

#proofForm label:first-of-type { margin-top: 0; }

#proofForm input[type="text"],
#proofForm input[type="file"] {
  width: 100%;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--cream-soft);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
}

#proofForm input[type="text"]:focus { outline: 2px solid var(--coral); outline-offset: 1px; }

#proofForm input.invalid { border-color: var(--danger); }

.proof-submitted-box {
  background: var(--success-soft, #E7F0DA);
  color: var(--success);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  margin: 0 0 18px;
}

.proof-submitted-box p {
  margin: 10px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.btn-done { background: var(--ink-soft); }

.btn-done:hover { background: var(--ink); }

.checkout-success {
  text-align: center;
  padding: 20px 0;
  color: var(--success);
}

.checkout-success h2 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 16px 0 10px;
}

.checkout-success p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 22px;
}

/* ---------- Product lightbox ---------- */

.product-lightbox {
  background: var(--cream-soft);
  border-radius: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px -12px rgba(30, 26, 20, 0.35);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(30, 26, 20, 0.15);
  z-index: 2;
  transition: background 0.15s ease;
}

.lightbox-close:hover { background: #fff; }

.lightbox-image-wrap {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  width: 100%;
  height: auto;
  max-height: 45vh;
  object-fit: contain;
}

.lightbox-details {
  text-align: center;
  padding: 20px 24px 26px;
}

.lightbox-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.35;
}

.lightbox-price {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--green);
  background: #E1E8E3;
  padding: 4px 16px;
  border-radius: 999px;
  margin: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .sort-select { margin-left: 0; width: 100%; order: 3; }
}

@media (max-width: 460px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hero { padding: 48px 20px 36px; }
  #userName { display: none; }
  .nav-right { gap: 8px; }
}