/* Mwakete — shared, mobile-first styles (no framework) */

:root {
  --color-red: #ce1126;
  --color-gold: #fcd116;
  --color-blue: #003f87;
  --color-blue-light: #5b9bd5;
  --color-ink: #1a1a1a;
  --color-muted: #5f6368;
  --color-border: #dcdfe3;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f7f5;
  --color-danger: #b3261e;
  --color-success: #1e7a34;
  --color-muted-light: #9aa0a6;
  --radius: 10px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-stack);
  color: var(--color-ink);
  background: var(--color-bg);
  line-height: 1.5;
  font-size: 16px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-blue);
}

h1, h2, h3 {
  line-height: 1.2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-blue);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
}

/* Layout */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

header.site-header {
  position: relative;
  border-bottom: 4px solid var(--color-gold);
  background: var(--color-red);
  color: #fff;
}

header.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

header.site-header .container.header-top-row {
  position: relative;
  padding-bottom: var(--space-1);
}

.header-logo-mark {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  transform: translateY(-50%);
  height: 40px;
  width: auto;
}

header.site-header .container.site-branding {
  display: block;
  text-align: center;
  padding-top: 0;
}

header.site-header .container.store-branding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: 0;
}

.store-branding-info {
  text-align: left;
  min-width: 0;
}

.site-branding .site-title {
  font-size: 1.5rem;
}

.store-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  background: #fff;
}

header.site-header a {
  color: #fff;
  text-decoration: none;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.site-tagline {
  font-size: 0.85rem;
  opacity: 0.9;
  margin: 0;
}

.store-phone {
  font-size: 0.8rem;
  font-weight: 700;
  margin: var(--space-1) 0 0;
}

.delivery-icons {
  display: inline-flex;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
  vertical-align: middle;
}

.delivery-icon {
  display: inline-flex;
}

.delivery-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.delivery-icon-free {
  color: var(--color-success);
}

#delivery-method-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.delivery-method-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6em 1em;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.delivery-method-option:has(input:checked) {
  border-color: var(--color-blue);
}

.delivery-method-option input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.delivery-method-option svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

nav.site-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

nav.site-nav a {
  font-size: 0.95rem;
  font-weight: 600;
}

main {
  min-height: 60vh;
  padding-bottom: var(--space-5);
}

/* Product-list pages (home, search, store front): on mobile & tablet drop the
   60vh floor and the large trailing padding so the footer hugs the last product
   instead of sitting below a gap. Desktop keeps the 60vh floor (outside this
   query). Only these pages carry .page-products, so owner/other pages are
   unaffected. */
@media (max-width: 1024px) {
  main.page-products {
    min-height: 0;
    padding-bottom: var(--space-3);
  }
}

section {
  padding: var(--space-4) 0;
}

.hero {
  background: var(--color-bg-alt);
  text-align: center;
  /* No horizontal padding: the inner .container already insets content by
     var(--space-3). Doubling it here made the home/search search bar narrower
     than the store/directory pages (which use .container alone) on mobile. */
  padding: var(--space-5) 0;
}

.hero h1 {
  font-size: 1.75rem;
  margin: 0 0 var(--space-2);
}

.hero p {
  color: var(--color-muted);
  max-width: 40em;
  margin: 0 auto var(--space-3);
}

.search-box {
  display: flex;
  gap: var(--space-2);
  max-width: 40em; /* ~640px - wider, stretched look; still a tidy centered bar on desktop */
  margin: 0 auto;
}

.search-box input {
  flex: 1;
}

/* Mobile only (<=600px): collapse the "Search" submit button's label to a bold
   ">" so it takes less width next to the input. font-size:0 hides the text node
   but leaves the real "Search" text in the DOM, so the button's accessible name
   is unchanged for screen readers; the glyph is drawn via ::after at its own
   size. Scoped to .search-box so the Continue/Place Order/chat Send buttons are
   untouched. */
@media (max-width: 600px) {
  .search-box button[type="submit"] {
    font-size: 0;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    /* Drop the blue pill on mobile - the ">" reads as a bare dark-grey chevron.
       Colour it (the ::after inherits this) since the .btn-primary white would be
       invisible once the background is gone. */
    background: transparent;
    border-color: transparent;
    color: var(--color-muted);
  }
  .search-box button[type="submit"]::after {
    content: ">";
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
  }
}

.categories {
  padding-top: var(--space-3);
}

/* Home page, mobile & tablet only (<=1024px): show the category buttons ABOVE
   the search bar, and add one extra spacer between the stacked sections
   (categories, search box, Trending Products). Scoped to .home-main (only
   index.html's <main> carries that class) so no other page's #main is touched;
   above 1024px this doesn't apply and the original block order/spacing stands.
   Explicit order on every child so a default-0 child can't jump ahead. */
@media (max-width: 1024px) {
  .home-main {
    display: flex;
    flex-direction: column;
    row-gap: var(--space-4);
  }
  .home-main > .categories { order: 1; }
  .home-main > .hero { order: 2; }
  .home-main > .trending-products { order: 3; }
  .home-main > .trending-stores { order: 4; }
  .home-main > noscript { order: 5; }
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.category-btn {
  background: var(--color-bg-alt);
  border: 2px solid var(--color-border);
}

.category-btn:hover,
.category-btn:focus-visible {
  border-color: var(--color-blue);
}

/* Rentals & Services are the two booking categories - give their quick-filter
   buttons a filled (inverted) style with white text so they stand out from the
   plain goods buttons. Colors reuse the existing category accents (see the
   .placeholder-swatch.category-* rules). The doubled class (.category-btn +
   modifier) raises specificity above the generic .btn/.category-btn background
   rules, which otherwise win since .btn is defined later in this file. */
.category-btn.category-btn--rentals {
  background: #b45309;
  border-color: #b45309;
  color: #fff;
}
.category-btn.category-btn--services {
  background: #166534;
  border-color: #166534;
  color: #fff;
}
.category-btn.category-btn--rentals:hover,
.category-btn.category-btn--rentals:focus-visible {
  background: #92400e;
  border-color: #92400e;
}
.category-btn.category-btn--services:hover,
.category-btn.category-btn--services:focus-visible {
  background: #14532d;
  border-color: #14532d;
}

footer.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  text-align: center;
}

footer.site-footer p {
  margin: var(--space-1) 0;
}

footer.site-footer .copyright {
  margin-top: var(--space-2);
  color: var(--color-muted-light);
  font-size: 0.75rem;
}

.floating-action-btn {
  position: fixed;
  bottom: var(--space-3);
  z-index: 1001; /* stays above .cookie-consent-banner (1000) if both show at once */
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75em 1.5em;
  border-radius: 999px;
  background: var(--color-blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.floating-action-btn--center {
  left: 50%;
  transform: translateX(-50%);
}

.floating-action-btn--left {
  left: var(--space-3);
}

.floating-action-btn--small {
  padding: 0.4em 0.9em;
  font-size: 0.85rem;
  background: var(--color-blue-light);
  color: var(--color-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.floating-action-btn--small svg {
  width: 16px;
  height: 16px;
}

.floating-action-btn--right {
  right: max(var(--space-3), env(safe-area-inset-right));
}

/* Custom PWA "Install" pill, injected by register-sw.js on mobile & tablet.
   Sits in the lower-right, stacked just above the 56px chat FAB (or the same
   slot on pages with no chat button). Hidden until JS adds .is-visible, and
   never shown on desktop (the min-width guard below), matching the JS gate. */
.install-fab {
  position: fixed;
  right: max(var(--space-3), env(safe-area-inset-right));
  bottom: calc(max(var(--space-3), env(safe-area-inset-bottom)) + var(--chat-fab-height, 56px) + var(--space-2));
  z-index: 1001;
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5em 1em;
  border: 0;
  border-radius: 999px;
  background: var(--color-gold);
  color: var(--color-ink);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.install-fab.is-visible {
  display: inline-flex;
}

.install-fab svg {
  width: 18px;
  height: 18px;
}

@media (min-width: 1025px) {
  .install-fab {
    display: none !important;
  }
}

/* Instruction popover shown when there's no programmatic install (iOS, or a
   browser with no captured prompt) - anchored above the Install pill. */
.install-hint {
  position: fixed;
  right: max(var(--space-3), env(safe-area-inset-right));
  bottom: calc(max(var(--space-3), env(safe-area-inset-bottom)) + var(--chat-fab-height, 56px) + var(--space-2) + 3rem);
  z-index: 1002;
  max-width: min(18rem, calc(100vw - 2 * var(--space-3)));
  padding: var(--space-2) var(--space-3);
  border-radius: 12px;
  background: var(--color-ink);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* Cart button on store.html: light blue (--color-blue-light, same hue the
   chat FAB uses), 25%-transparent background, sized at ~100.5%. transform-
   origin keeps it anchored to the left/bottom edges as it scales, rather
   than scaling from its center and drifting off position. */
.floating-action-btn--cart {
  transform: scale(1.005);
  transform-origin: left bottom;
  background: rgba(91, 155, 213, 0.75); /* --color-blue-light */
}

/* "Continue Shopping" button on cart.html: 50% smaller, light blue
   (#5b9bd5), 10%-transparent background. transform-origin keeps it anchored
   to the left/bottom edges as it shrinks. */
.floating-action-btn--continue-shopping {
  transform: scale(0.5);
  transform-origin: left bottom;
  background: rgba(91, 155, 213, 0.9);
}

/*
 * Chat floating action button - circular, icon-only, distinct from the
 * pill/label style above on purpose (bottom-right circular chat bubble is
 * the near-universal convention for chat widgets). No badge, no click
 * handler yet - this is UI only, wired up once messaging exists.
 */
.chat-fab-btn {
  bottom: max(var(--space-3), env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  padding: 0;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.chat-fab-btn svg {
  width: 26px;
  height: 26px;
}

@media (hover: hover) {
  .chat-fab-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  }
}

.chat-fab-btn:active {
  transform: scale(0.95);
}

.chat-fab-btn:focus-visible {
  outline: 3px solid var(--color-blue-light);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .chat-fab-btn {
    background: var(--color-blue-light);
    color: var(--color-ink);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  @media (hover: hover) {
    .chat-fab-btn:hover {
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12);
    }
  }
}

/* Unread badge on the chat FAB - .chat-fab-btn's own `position:fixed` already
   establishes the containing block this positions against. */
.chat-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid var(--color-bg);
  background: var(--color-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  animation: chat-badge-pop 0.3s ease;
}

.chat-unread-badge.hidden {
  display: none;
}

@keyframes chat-badge-pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/*
 * New-message popup (chat-window.js/owner-messages.js via
 * showChatNotificationToast in helpers.js) - top-anchored on purpose so it
 * never overlaps the bottom-anchored FAB/chat window it's telling you about.
 */
.chat-notification-toast {
  position: fixed;
  top: max(var(--space-3), env(safe-area-inset-top));
  left: 50%;
  z-index: 1003; /* above the chat window (1002) */
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100vw - 2 * var(--space-3));
  padding: 0.75em 1.25em;
  border-radius: 999px;
  background: var(--color-blue);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-notification-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chat-notification-toast-icon {
  display: inline-flex;
  flex-shrink: 0;
}

/*
 * Chat window - the panel the FAB opens. Kept visible-but-transparent
 * (not display:none) while closed so opacity/transform can transition;
 * .chat-window--open is what JS toggles to reveal it. Not connected to any
 * backend - see chat-window.js.
 */
.chat-window {
  position: fixed;
  z-index: 1002; /* above the FAB (1001) and cookie banner (1000) */
  right: max(var(--space-3), env(safe-area-inset-right));
  bottom: calc(56px + var(--space-3) * 2 + env(safe-area-inset-bottom));
  width: 360px;
  max-width: calc(100vw - var(--space-3) * 2);
  height: 520px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.92) translateY(20px);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0.2s;
}

.chat-window.chat-window--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1) translateY(0);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - var(--space-3) * 2);
    height: calc(100vh - 140px);
  }
}

.chat-window-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-blue);
  color: #fff;
  flex: 0 0 auto;
}

.chat-vendor-avatar,
.chat-vendor-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}

.chat-vendor-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
}

.chat-vendor-info {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-vendor-name {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-vendor-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
}

.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.chat-window-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-window-close:hover,
.chat-window-close:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.chat-window-body {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--color-bg-alt);
}

.chat-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.chat-loading.hidden {
  display: none;
}

.chat-name-gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  text-align: center;
}

.chat-name-gate.hidden {
  display: none;
}

.chat-name-gate-prompt {
  margin: 0;
  font-weight: 600;
  color: var(--color-ink);
}

.chat-name-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 240px;
}

.chat-name-input {
  width: 100%;
}

.chat-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-messages {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}

.chat-messages.hidden {
  display: none;
}

.chat-message {
  max-width: 80%;
  padding: 0.6em 0.9em;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  animation: chat-message-in 0.2s ease both;
}

.chat-message-image {
  display: block;
  width: 100%;
  max-width: 220px;
  border-radius: 10px;
  margin-bottom: 0.4em;
}

.chat-message p {
  margin: 0;
}

.chat-message--customer {
  align-self: flex-end;
  background: var(--color-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message--vendor {
  align-self: flex-start;
  background: #fff;
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

@keyframes chat-message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 var(--space-3) var(--space-2);
  padding: 0.7em 1em;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  animation: chat-message-in 0.2s ease both;
}

.chat-typing.hidden {
  display: none;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-muted-light);
  animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chat-window-input-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.chat-message-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 100px;
  padding: 0.6em 0.9em;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-ink);
  background: var(--color-bg);
}

.chat-message-input:focus-visible {
  outline: 2px solid var(--color-blue-light);
  outline-offset: 1px;
}

.chat-send-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--color-blue);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.chat-send-btn:hover {
  background: var(--color-ink);
}

.chat-send-btn:active {
  transform: scale(0.9);
}

.chat-send-btn:disabled {
  background: var(--color-muted-light);
  cursor: not-allowed;
}

.chat-send-btn:focus-visible {
  outline: 3px solid var(--color-blue-light);
  outline-offset: 2px;
}

.chat-attach-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-muted);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}

.chat-attach-btn:hover {
  color: var(--color-ink);
  background: var(--color-bg-alt);
}

.chat-attach-btn:active {
  transform: scale(0.9);
}

.chat-attach-btn:focus-visible {
  outline: 3px solid var(--color-blue-light);
  outline-offset: 2px;
}

/* Selected-photo preview strip, shown above the input row before sending - "allow preview" before a compress/upload round trip. */
.chat-image-preview {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) 0;
}

.chat-image-preview.hidden {
  display: none;
}

.chat-image-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.chat-image-preview-remove {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--color-bg-alt);
  color: var(--color-muted);
  cursor: pointer;
}

.chat-image-preview-remove:hover {
  color: var(--color-danger);
}

.chat-empty-state {
  margin: auto;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* "Load earlier messages" - pins to the top of the message list (lazy-loaded history pagination). Reuses .btn/.btn-small for the button look, this just centers/spaces it within the message column. */
.chat-load-earlier-btn {
  align-self: center;
  margin-bottom: var(--space-2);
}

/* Shared "Load More" affordance for paginated lists (store directory, owner
   orders/products - see owner.css for the owner-side variant). */
.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: var(--space-3);
}

.chat-loading {
  text-align: center;
}

.chat-loading .btn {
  margin-top: var(--space-1);
}

.chat-message--sending {
  opacity: 0.6;
}

.chat-message--failed {
  border: 1px solid var(--color-danger);
}

.chat-message-retry {
  display: block;
  margin-top: 0.35em;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  text-decoration: underline;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.9;
}

@media (prefers-color-scheme: dark) {
  .chat-window {
    background: #1e1f22;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }

  .chat-window-header {
    background: #17181a;
  }

  .chat-window-body {
    background: #1e1f22;
  }

  .chat-name-gate-prompt {
    color: #f0f0f0;
  }

  .chat-name-input {
    background: #2a2c30;
    border-color: #3a3d42;
    color: #f0f0f0;
  }

  .chat-message--vendor {
    background: #2a2c30;
    border-color: #3a3d42;
    color: #f0f0f0;
  }

  .chat-message--customer {
    background: var(--color-blue-light);
    color: #0b1a2b;
  }

  .chat-typing {
    background: #2a2c30;
    border-color: #3a3d42;
  }

  .chat-window-input-row {
    background: #17181a;
    border-top-color: #3a3d42;
  }

  .chat-message-input {
    background: #2a2c30;
    border-color: #3a3d42;
    color: #f0f0f0;
  }

  .chat-send-btn {
    background: var(--color-blue-light);
    color: #0b1a2b;
  }

  .chat-send-btn:hover {
    background: #fff;
  }

  .chat-attach-btn {
    background: #2a2c30;
    border-color: #3a3d42;
    color: #cfcfcf;
  }

  .chat-attach-btn:hover {
    background: #3a3d42;
    color: #fff;
  }

  .chat-image-preview img {
    border-color: #3a3d42;
  }

  .chat-image-preview-remove {
    background: #2a2c30;
    color: #cfcfcf;
  }
}

.cookie-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-ink);
  color: #fff;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.cookie-consent-banner p {
  margin: 0;
  max-width: 50em;
  font-size: 0.9rem;
}

/* Buttons & form controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.6em 1.2em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--color-bg-alt);
  color: var(--color-ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-blue);
  color: #fff;
}

.btn-light-blue {
  background: var(--color-blue-light);
  color: #fff;
}

.btn-adding {
  background: var(--color-blue-light) !important;
  opacity: 1;
}

.btn-saving-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 0.3em;
  vertical-align: middle;
}

.btn-saving-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: btn-saving-bounce 1.2s infinite ease-in-out both;
}

.btn-saving-dots span:nth-child(1) { animation-delay: -0.32s; }
.btn-saving-dots span:nth-child(2) { animation-delay: -0.16s; }
.btn-saving-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes btn-saving-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1); }
}

/*
 * The page/data-loading message's dots (startLoadingMessage in helpers.js)
 * - a separate class from .btn-saving-dots on purpose, so this colorful
 * treatment stays specific to "the page is loading," not every button's
 * plain "Saving…" state. Each dot cycles red -> gold -> purple as it
 * bounces, phase-offset by a third of the color cycle so the three dots
 * are always showing three different colors at once.
 */
/* Centered full-screen "Loading… / Please wait…" overlay (see
   showLoadingOverlay in helpers.js) - used for waits with no inline status
   spot, e.g. checkout's initial load and while placing an order. Above the
   FABs/toast layer (1003) so nothing sits on top of it. */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1004;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: rgba(0, 0, 0, 0.35);
}

.loading-overlay.is-visible {
  display: flex;
}

.loading-overlay-card {
  background: #fff;
  color: var(--color-ink);
  padding: var(--space-4) var(--space-5);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font-size: 1.15rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 0.3em;
  vertical-align: middle;
}

.loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  animation: loading-dots-bounce 1.2s infinite ease-in-out both, loading-dots-color 1.8s infinite linear;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s, 0s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s, -0.6s; }
.loading-dots span:nth-child(3) { animation-delay: 0s, -1.2s; }

@keyframes loading-dots-bounce {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes loading-dots-color {
  0%, 33% { background: var(--color-red); }
  34%, 66% { background: var(--color-gold); }
  67%, 100% { background: #8b5cf6; }
}

/*
 * "Refresh page" failed-state dots (loadFailedMessageHtml in helpers.js) -
 * deliberately the opposite of .loading-dots: no animation, one plain
 * currentColor, so a failed load reads as "stopped," not "still working."
 */
.static-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 0.3em;
  vertical-align: middle;
}

.static-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.btn-danger {
  background: #fff;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-block {
  width: 100%;
}

/* Static "Continue Shopping" button on cart.html - sits beneath the bigger
   "Proceed to Checkout" primary button. Secondary weight: light-blue outline
   on a tinted fill so it reads clearly below the solid primary CTA. */
.btn-continue-shopping {
  margin-top: var(--space-2);
  background: rgba(91, 155, 213, 0.12); /* --color-blue-light tint */
  color: var(--color-blue);
  border-color: var(--color-blue-light);
}

@media (hover: hover) {
  .btn-continue-shopping:hover {
    background: rgba(91, 155, 213, 0.22);
  }
}

.btn-small {
  min-height: 36px;
  padding: 0.4em 0.8em;
  font-size: 0.9rem;
}

input,
select,
textarea {
  font: inherit;
  padding: 0.6em 0.7em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: 100%;
  min-height: 44px;
  background: #fff;
  color: var(--color-ink);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
  font-size: 0.95rem;
}

.field {
  margin-bottom: var(--space-3);
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin: 0 0 var(--space-3);
}

legend {
  font-weight: 700;
  padding: 0 var(--space-1);
}

.form-error {
  color: var(--color-danger);
  font-size: 0.9rem;
  margin-top: var(--space-1);
}

.form-success {
  color: var(--color-success);
}

.helper-text {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Product grid */

/* Marketplace-style browse grid - two columns on a phone (the density a
   product grid is normally scanned at), then as many ~200px columns as fit
   from 600px up. Used by the home page's trending section, a store's own
   product list, and the search results page. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  align-items: start;
}

@media (min-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
  }
}

/* Booking listings carry a whole request form (two dates, name, phone,
   notes) - far too much for a half-width phone column, so they take the
   full row while goods cards stay two-up beside each other. */
.product-card--booking {
  grid-column: 1 / -1;
}

.product-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  /* renderBrowseProductCard (search results / similar products) renders
     this as an <a> so the whole card is clickable - text-decoration/color
     resets are harmless on the plain <article> cards from product-card.js. */
  text-decoration: none;
  color: inherit;
}

/* Marks the exact product a customer arrived at via a trending-product link
   (?product=<id> on store.html) so it's clear which card they clicked,
   since it may not be the first one on the page. Self-clears via
   animationend in store.js - no JS timer needed. */
.product-highlight {
  animation: product-highlight-pulse 2.2s ease-out;
}

@keyframes product-highlight-pulse {
  0% { box-shadow: 0 0 0 3px var(--color-blue-light); }
  70% { box-shadow: 0 0 0 3px var(--color-blue-light); }
  100% { box-shadow: 0 0 0 3px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .product-highlight {
    animation: none;
  }
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-bg-alt);
}

.placeholder-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-blue);
}

.placeholder-swatch.category-pantry { background: #8a5a2c; }
.placeholder-swatch.category-clothing { background: var(--color-red); }
.placeholder-swatch.category-household { background: #4a5568; }
.placeholder-swatch.category-electronics { background: #2a6f97; }
.placeholder-swatch.category-general { background: var(--color-blue); }
.placeholder-swatch.category-rentals { background: #b45309; }
.placeholder-swatch.category-services { background: #166534; }

.product-card-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

/* The flex gap above is the card's only vertical rhythm - default paragraph
   margins would stack on top of it and leave holes in the meta block. */
.product-card-body p {
  margin: 0;
}

/* Clamped rather than truncated to one line: a two-line name is readable
   at half-width and keeps every card in a row the same height. */
.product-name {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The loudest thing on a card - price is what a browse grid is scanned for.
   Never wraps: fitPriceLabels() in helpers.js measures the overflow this
   allows and scales the font down to whatever the column actually fits. */
.product-price {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-ink);
  white-space: nowrap;
}

.product-desc {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.product-gallery-track::-webkit-scrollbar {
  display: none;
}

.product-gallery-track .product-image {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.product-gallery-thumbs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3) 0;
}

.product-gallery-thumb {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.product-gallery-thumb.active {
  border-color: var(--color-blue);
}

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

.similar-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 600px) {
  .similar-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

.similar-product-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  font-size: 0.85rem;
}

.similar-product-card .product-image,
.similar-product-card .placeholder-swatch {
  aspect-ratio: 1 / 1;
  font-size: 1.25rem;
}

.similar-product-card .product-card-body {
  padding: var(--space-2);
  gap: var(--space-1);
}

.similar-product-card .product-name {
  font-size: 0.85rem;
}

/* Small circular-logo rail, used by the home page's popular-stores row. */
.logo-carousel {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: var(--space-2);
}

.logo-carousel-item {
  flex: 0 0 76px;
  scroll-snap-align: start;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.logo-carousel-logo,
.logo-carousel-logo-placeholder {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-1);
  border-radius: 50%;
  border: 1px solid var(--color-border);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  font-weight: 700;
}

.logo-carousel-name {
  display: block;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: no "Trending Products" heading (the row speaks for itself) and
   no "Popular Stores" row at all - both come back from 600px up. */
#trending-products-heading {
  display: none;
}

.trending-stores {
  display: none;
}

@media (min-width: 600px) {
  #trending-products-heading {
    display: block;
  }

  .trending-stores {
    display: block;
  }
}

.product-controls {
  margin-top: auto;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.qty-input {
  flex: 0 0 4.5em;
  max-width: 4.5em;
}

.product-actions .add-to-cart-btn {
  flex: 1 1 auto;
}

/* Booking listings (rental cars, hotels, tours, etc.) - date-range request
   in place of the qty/add-to-cart controls goods listings use. */

.availability-badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

.availability-badge--available {
  background: #e3f4e6;
  color: var(--color-success);
}

.availability-badge--unavailable {
  background: #fff4d6;
  color: #8a6100;
}

.booking-dates-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.booking-dates-row input {
  /* min-width: 0 lets a flex item shrink below its content's intrinsic
     size (the default `auto` doesn't) - without it, a native date input's
     own minimum width made the row overflow the card's overflow:hidden
     boundary, clipping the end-date field off entirely on narrower cards. */
  flex: 1 1 140px;
  min-width: 0;
}

.booking-contact-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.request-booking-btn {
  width: 100%;
}

.booking-request-status {
  margin-top: var(--space-1);
}

.booking-vendor-contact {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.booking-vendor-contact .btn {
  flex: 1 1 0;
}

.btn-call {
  background: var(--color-success);
  color: #fff;
}

.btn-messenger {
  background: #0084ff;
  color: #fff;
}

/* Store directory */

.store-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 600px) {
  .store-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.store-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--color-ink);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.store-card:hover,
.store-card:focus-visible {
  border-color: var(--color-blue);
}

.store-card h3 {
  margin: 0 0 var(--space-1);
}

.store-card-logo,
.store-card-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
}

.store-card-logo {
  object-fit: cover;
  background: var(--color-bg-alt);
}

.store-card-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-blue);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.store-card-info {
  min-width: 0;
  flex: 1;
}

.store-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  flex-wrap: wrap;
}

/* Cart & checkout */

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-line-info {
  flex: 1;
}

.cart-line-qty {
  width: 4.5em;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.15rem;
  padding-top: var(--space-3);
}

#order-summary-text {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  min-height: 220px;
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.confirmation-cta strong {
  font-size: 1.25em;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: var(--space-5) var(--space-3);
}

[aria-live] {
  min-height: 1.2em;
}

@media (min-width: 700px) {
  .two-col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--space-4);
    align-items: start;
  }
}
