/*!
 * ============================================================================
 * Copyright (c) 2026 ATH SOLUTIONS (PTY) LTD. All rights reserved.
 * KwaZulu-Natal, Republic of South Africa.
 * ============================================================================
 *
 * @BEGIN Developer Log Header Block
 * @FILENAME: storefront.css
 * @TITLE: ATH-SHOP - Storefront Stylesheet
 * @DESCRIPTION: Component styles for the public buyer-facing marketplace pages (home, store, product, cart, checkout). Depends on design-tokens.css (--store-* tokens) and reuses main.css's generic component classes (buttons, forms, badges, toasts, empty-state) rather than redefining them -- only storefront-specific layout/component classes live here.
 * @AUTHOR: Ary van der Pijl
 * @COMPANY: ATH SOLUTIONS (PTY) LTD
 * @WEBSITE: https://www.ath.solutions/
 * @EMAIL: info@ath.solutions
 * @COPYRIGHT: All Rights Reserved
 * @LICENSE: ATH SOLUTIONS - PROPRIETARY SOFTWARE LICENCE AGREEMENT (https://www.ath.solutions/documents/ath_solutions_software_licence_agreement.pdf)
 *
 * BEGIN CHANGELOG
 * @IMPORTANT NOTICE: Developers working on these files MUST update and maintain the Developers Change Log, failure to do is not an option:
 * !==================================================================================================================================================================
 * VERSION 1.0.3
 * - File Modified | Ary van der Pijl | 2026-09-05 | MKT-GAP-E7-001 | .store-category-grid/.store-product-grid had no reserved height while their async-loaded content (home.js) was still a small spinner -- a real, measured Lighthouse CLS of 0.56 on the home page, since the grid jumps from spinner-height to full-grid-height the instant the category/product fetch resolves. Added min-height, measured against the real card CSS and actual seeded item counts (not guessed), so the layout box is stable from first paint -- re-measured live, CLS dropped to 0.017. Also fixed .store-cart-badge (header cart icon link, no explicit sizing, well under the 44x44px minimum touch-target size this project's own frontend accessibility rule requires) and the footer's stacked links (rendered with only ~18px of clickable height each, failing the same Lighthouse `target-size` check's minimum-size variant -- a first attempt via anchor padding didn't move the measured bounding box, so fixed instead via a dedicated `.store-footer-link-row` wrapper (see store-footer.php) with an explicit 44px min-height and flex-centering) -- both real accessibility findings from a live Lighthouse pass, re-verified live after the fix (GAP_ANALYSIS.md E.7). |
 * VERSION 1.0.2
 * - File Modified | Ary van der Pijl | 2026-09-05 | MKT-TEMPLATE-001 | .store-body/.store-banner h1 now reference the new --store-font-body/--store-font-heading tokens (design-tokens.css) instead of inheriting Bootstrap/browser defaults, so a per-tenant template CSS override (store.js's applyTemplate(), WEB/public/css/templates/*.css) actually changes something visible (GAP_ANALYSIS.md E.1). |
 * VERSION 1.0.1
 * + File Created | Ary van der Pijl | 2026-07-17 | MKT-PHASE3-001 | Initial storefront component styles for Phase 3 |
 * ==================================================================================================================================================================!
 * END CHANGELOG
 */

/* ─── Storefront Body ─────────────────────────────────────────────────────── */

.store-body {
  font-family: var(--store-font-body);
}

/* ─── Storefront Header ──────────────────────────────────────────────────── */

.store-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--store-header-height);
  background: var(--store-header-bg);
  border-bottom: 1px solid var(--store-header-border);
  display: flex;
  align-items: center;
}

.store-header-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.store-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--fw-bold);
  font-size: var(--text-xl);
  color: var(--store-primary);
  text-decoration: none;
  white-space: nowrap;
}

.store-search {
  flex: 1;
  max-width: 480px;
}

.store-search input {
  border-radius: var(--radius-full);
}

.store-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

.store-header-actions a {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
}

.store-cart-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.store-cart-count {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--store-accent);
  color: var(--store-primary-dark);
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
  padding: 3px 5px;
  border-radius: var(--radius-full);
  min-width: 16px;
  text-align: center;
}

/* ─── Storefront Footer ──────────────────────────────────────────────────── */

.store-footer {
  background: var(--store-footer-bg);
  color: var(--store-footer-text);
  padding: var(--space-12) var(--space-6) var(--space-8);
  margin-top: var(--space-16);
}

.store-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-8);
}

.store-footer a {
  color: var(--store-footer-text);
  text-decoration: none;
}

.store-footer-link-row {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.store-footer a:hover {
  color: #ffffff;
}

/* ─── Hero ────────────────────────────────────────────────────────────────── */

.store-hero {
  background: linear-gradient(135deg, var(--store-forest-700), var(--store-forest-600));
  color: #ffffff;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.store-hero h1 {
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-3);
}

.store-hero p {
  font-size: var(--text-lg);
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto var(--space-6);
}

/* ─── Page Container ─────────────────────────────────────────────────────── */

.store-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.store-section-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-5);
}

/* ─── Category Grid ───────────────────────────────────────────────────────── */

.store-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-10);
  min-height: 130px;
}

.store-category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--store-card-radius);
  padding: var(--space-5) var(--space-3);
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.store-category-card:hover {
  box-shadow: var(--store-card-shadow-hover);
  transform: translateY(-2px);
}

.store-category-card .material-icons-round {
  font-size: 28px;
  color: var(--store-primary);
  margin-bottom: var(--space-2);
}

/* ─── Product Grid & Card ────────────────────────────────────────────────── */

.store-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
  min-height: 720px;
}

.store-product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--store-card-radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  box-shadow: var(--store-card-shadow);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.store-product-card:hover {
  box-shadow: var(--store-card-shadow-hover);
  transform: translateY(-2px);
  color: var(--color-text);
}

.store-product-thumb {
  aspect-ratio: 1 / 1;
  background: var(--color-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.store-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-product-thumb .material-icons-round {
  font-size: 40px;
  color: var(--color-text-subtle);
}

.store-product-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.store-product-title {
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.store-product-merchant {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.store-product-price {
  margin-top: auto;
  padding-top: var(--space-2);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.store-product-price .price-current {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--store-primary);
}

.store-product-price .price-was {
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
  text-decoration: line-through;
}

/* ─── Merchant Storefront Banner ─────────────────────────────────────────── */

.store-banner {
  background: var(--store-primary-light);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.store-banner-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--store-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  overflow: hidden;
}

.store-banner-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-banner h1 {
  font-family: var(--store-font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-1);
}

.store-banner p {
  color: var(--color-text-muted);
  margin: 0;
}

/* ─── Rating Stars ────────────────────────────────────────────────────────── */

.store-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--store-amber-600);
  font-size: var(--text-sm);
}

.store-rating .material-icons-round {
  font-size: 16px;
}

/* ─── Review Card ─────────────────────────────────────────────────────────── */

.store-review {
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-4) 0;
}

.store-review:last-child {
  border-bottom: none;
}

.store-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.store-review-response {
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

/* ─── Product Detail ──────────────────────────────────────────────────────── */

.store-product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-10);
}

.store-product-detail-image {
  aspect-ratio: 1 / 1;
  background: var(--color-surface-2);
  border-radius: var(--store-card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.store-product-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Cart Line Item ──────────────────────────────────────────────────────── */

.store-cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.store-cart-item-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  flex-shrink: 0;
}

.store-cart-summary {
  background: var(--color-surface-2);
  border-radius: var(--store-card-radius);
  padding: var(--space-5);
}

.store-cart-summary-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}

.store-cart-summary-row.total {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
}

/* ─── Storefront Buttons (accent variant, extends main.css .btn) ────────── */

.btn-store-primary {
  background: var(--store-primary);
  border-color: var(--store-primary);
  color: #ffffff;
}

.btn-store-primary:hover {
  background: var(--store-primary-hover);
  border-color: var(--store-primary-hover);
  color: #ffffff;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .store-product-detail {
    grid-template-columns: 1fr;
  }

  .store-search {
    display: none;
  }
}
