/* Al Thunayan Farm - compact storefront home */

:root {
  --farm-green: #245b34;
  --farm-green-dark: #174326;
  --farm-mint: #edf7ef;
  --farm-gold: #b9822c;
  --ink: #182018;
  --muted: #697265;
  --line: #e2e7df;
  --page: #f6f7f3;
  --card: #ffffff;
  --shadow: 0 12px 34px rgba(24, 32, 24, 0.08);
  --font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-family);
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(237, 247, 239, 0.9), rgba(246, 247, 243, 0) 260px),
    var(--page);
  color: var(--ink);
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-home {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 12px 96px;
}

.app-home-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  margin: 0 -12px 12px;
  padding: 10px 14px;
  background: rgba(246, 247, 243, 0.92);
  border-bottom: 1px solid rgba(226, 231, 223, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-icon {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.header-brand h1 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
  white-space: nowrap;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--farm-green-dark);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(24, 32, 24, 0.05);
}

.merchant-hero {
  overflow: hidden;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.merchant-hero-media {
  position: relative;
  min-height: 180px;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: #e8ece4;
}

.merchant-hero-media picture,
.merchant-hero-media img {
  width: 100%;
  height: 100%;
  display: block;
}

.merchant-hero-media img {
  object-fit: cover;
}

.delivery-badge {
  position: absolute;
  inset-inline-start: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(23, 67, 38, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.merchant-hero-content {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.merchant-hero-content h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 900;
}

.merchant-hero-content p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  font-weight: 700;
}

.merchant-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.merchant-details span {
  display: grid;
  gap: 3px;
  min-height: 62px;
  align-content: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--farm-mint);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.merchant-details strong {
  color: var(--farm-green-dark);
  font-size: 15px;
  line-height: 1.25;
}

.service-chips {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: auto;
  -ms-overflow-style: none;
}

.service-chips::-webkit-scrollbar {
  display: none;
}

.service-chips span {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid #dce7d8;
  border-radius: 999px;
  background: #fff;
  color: var(--farm-green-dark);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(24, 32, 24, 0.04);
}

.quick-filters {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  padding: 2px 0 4px;
  overflow-x: auto;
  -ms-overflow-style: none;
}

.quick-filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(24, 32, 24, 0.04);
}

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

.merchant-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.stat-item {
  min-height: 70px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(24, 32, 24, 0.05);
  text-align: center;
}

.stat-label,
.stat-value {
  display: block;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.stat-value {
  margin-top: 4px;
  color: var(--farm-green-dark);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.products-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.app-product-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  min-height: 126px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.app-product-card[hidden] {
  display: none;
}

.product-image-container {
  width: 104px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #eef1eb;
  border: 1px solid #edf0ea;
}

.product-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}

.product-name {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 900;
}

.product-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  color: var(--farm-green-dark);
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
  white-space: nowrap;
}

.currency {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.btn-add-to-cart {
  flex: 0 0 auto;
  min-width: 64px;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--farm-green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(36, 91, 52, 0.18);
}

.btn-add-to-cart:active,
.filter-btn:active,
.lang-toggle:active {
  transform: translateY(1px);
}

.app-cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 70;
  min-height: 56px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--farm-green-dark);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 18px 38px rgba(23, 67, 38, 0.28);
}

.cart-icon {
  font-size: 18px;
  line-height: 1;
}

.cart-text,
.cart-count,
.cart-total {
  font-weight: 900;
}

.cart-text {
  min-width: 0;
  font-size: 14px;
}

.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--farm-gold);
  font-size: 13px;
}

.cart-total {
  font-size: 13px;
  white-space: nowrap;
}

@media (min-width: 720px) {
  .app-home {
    padding: 18px 18px 120px;
  }

  .app-home-header {
    margin: 0 0 16px;
    border: 1px solid rgba(226, 231, 223, 0.9);
    border-radius: 8px;
  }

  .merchant-hero {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  }

  .merchant-hero-media {
    min-height: 260px;
    aspect-ratio: 16 / 8;
  }

  .merchant-hero-content {
    align-content: center;
    padding: 22px;
  }

  .merchant-details {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .products-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .app-product-card {
    min-height: 144px;
    grid-template-columns: 124px minmax(0, 1fr);
  }

  .product-image-container {
    width: 124px;
  }

  .app-cart-bar {
    left: 50%;
    right: auto;
    width: min(620px, calc(100% - 36px));
    transform: translateX(-50%);
  }
}

@media (min-width: 1040px) {
  .products-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .app-product-card {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
  }

  .product-image-container {
    width: 88px;
  }

  .header-brand h1 {
    font-size: 18px;
  }

  .product-name {
    font-size: 13px;
  }

  .product-price {
    font-size: 13px;
  }

  .btn-add-to-cart {
    min-width: 56px;
    padding: 0 10px;
  }
}
