/* Layout and M3-spec styles for elements material-web doesn't provide (app bar, cards, lists,
   search bar, navigation bar, snackbar). Colors come from theme.css (--md-sys-color-*). */

:root {
  --md-ref-typeface-brand: 'Roboto', system-ui, sans-serif;
  --md-ref-typeface-plain: 'Roboto', system-ui, sans-serif;
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --elev-1: 0 1px 2px rgb(0 0 0 / 0.3), 0 1px 3px 1px rgb(0 0 0 / 0.15);
  --elev-3: 0 1px 3px rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15);
  --nav-height: 80px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-ref-typeface-plain);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--md-sys-color-primary); }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
h1 { margin: 8px 0 16px; }
.muted { color: var(--md-sys-color-on-surface-variant); }
.center { text-align: center; }
.one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; padding-bottom: 96px; }
@media (min-width: 600px) { .wrap { padding: 0 24px; } }

/* Components set their own display, which would otherwise override the hidden attribute */
[hidden] { display: none !important; }

/* Hide components until they upgrade, so unstyled text doesn't flash */
:not(:defined) { visibility: hidden; }

md-icon { flex: none; }
md-filled-button.full { width: 100%; }
md-text-button.danger { --md-text-button-label-text-color: var(--md-sys-color-error); --md-text-button-icon-color: var(--md-sys-color-error); --md-text-button-hover-label-text-color: var(--md-sys-color-error); --md-text-button-hover-icon-color: var(--md-sys-color-error); --md-text-button-focus-label-text-color: var(--md-sys-color-error); --md-text-button-pressed-label-text-color: var(--md-sys-color-error); }
md-text-button.back { margin-left: -12px; }
md-outlined-text-field, md-outlined-select { width: 100%; }

/* ---------- Top app bar ---------- */
.top-app-bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}
.top-app-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; min-width: 0; }
.brand md-icon { color: var(--md-sys-color-primary); }
.brand span:not(.label-tag) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-tag {
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
  border-radius: var(--shape-sm); padding: 2px 8px; white-space: nowrap;
}

.cart-button {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  color: var(--md-sys-color-on-surface-variant);
}
.cart-button:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 8%, transparent); }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); display: grid; place-items: center;
}
.badge[hidden] { display: none; }

/* ---------- Navigation bar (admin) ---------- */
.nav-bar { display: flex; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 0 16px 0 4px; height: 48px; border-radius: 24px;
  color: var(--md-sys-color-on-surface-variant); text-decoration: none;
}
.nav-indicator { display: grid; place-items: center; width: 48px; height: 32px; border-radius: 16px; }
.nav-item:hover .nav-indicator { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.nav-item.active { color: var(--md-sys-color-on-surface); }
.nav-item.active .nav-indicator { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.nav-item.active md-icon { font-variation-settings: 'FILL' 1; }
@media (max-width: 839px) {
  .nav-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--nav-height);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--md-sys-color-surface-container); justify-content: space-around; gap: 8px;
  }
  .nav-item { flex: 1; flex-direction: column; justify-content: center; gap: 4px; height: 100%; padding: 0; border-radius: 0; }
  .nav-item:hover .nav-indicator { background: transparent; }
  .is-admin main.wrap { padding-bottom: calc(var(--nav-height) + 96px); }
}

/* ---------- Search bar ---------- */
.search-bar {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px; margin-bottom: 16px;
  border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant); max-width: 720px;
}
.search-bar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%;
  font: 400 16px/24px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface);
}
.search-bar input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.search-bar:focus-within { outline: 2px solid var(--md-sys-color-primary); outline-offset: -2px; }

.filter-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--md-sys-color-surface-container-low); border-radius: var(--shape-md);
  border: 1px solid var(--md-sys-color-outline-variant);
}
.grid {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; } }
.product-card { display: block; height: 100%; overflow: hidden; color: inherit; text-decoration: none; position: relative; transition: box-shadow 0.2s; }
.product-card:hover { box-shadow: var(--elev-1); }
.product-card::after { content: ''; position: absolute; inset: 0; background: var(--md-sys-color-on-surface); opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.product-card:hover::after { opacity: 0.08; }
.product-card:active::after { opacity: 0.1; }
.product-card:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
.product-card img, .product-card .no-photo { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--md-sys-color-surface-container-highest); }
.card-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 2px; }
.price { color: var(--md-sys-color-primary); }
.product-card .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.no-photo { display: grid; place-items: center; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container-highest); }
.no-photo.large { aspect-ratio: 1; border-radius: var(--shape-lg); }

.pager { display: flex; justify-content: center; gap: 12px; margin-top: 32px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 64px 16px; }
.empty > md-icon { font-size: 48px; width: 48px; height: 48px; color: var(--md-sys-color-on-surface-variant); margin-bottom: 8px; }
.empty md-filled-button, .empty md-filled-tonal-button { margin-top: 16px; }

/* ---------- Banners and status labels ---------- */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--shape-md); background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.banner-error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.status {
  display: inline-block; padding: 4px 10px; border-radius: var(--shape-sm); white-space: nowrap; text-transform: capitalize;
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant);
}
.status-pending { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.status-picked_up, .status-active { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.status-cancelled, .status-expired { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

/* ---------- Item page ---------- */
.item { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
@media (min-width: 840px) { .item { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; } }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.gallery::-webkit-scrollbar { display: none; }
.gallery > a { flex: 0 0 88%; scroll-snap-align: center; }
.gallery[data-count='1'] > a { flex-basis: 100%; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--shape-xl); background: var(--md-sys-color-surface-container-highest); }
@media (min-width: 840px) {
  .gallery { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; margin: 0; padding: 0; }
  .gallery > a:first-child { grid-column: 1 / -1; }
  .gallery img { border-radius: var(--shape-lg); }
}
.item-info h1 { margin: 4px 0 8px; }
.item-info .price { margin-bottom: 16px; }
.add-to-cart { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.add-to-cart md-filled-button { align-self: stretch; }
@media (min-width: 600px) { .add-to-cart md-filled-button { align-self: flex-start; } }
.qty-row { display: flex; align-items: center; gap: 16px; }
.description { white-space: pre-wrap; margin-top: 24px; }

.info-list { list-style: none; margin: 0 0 16px; padding: 8px 16px; display: flex; flex-direction: column; }
.info-list:not(.card) { padding: 0; gap: 8px; }
.info-list li { display: flex; align-items: flex-start; gap: 16px; padding: 8px 0; }
.info-list:not(.card) li { padding: 0; }
.info-list md-icon { color: var(--md-sys-color-on-surface-variant); }

.stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--md-sys-color-outline); border-radius: var(--shape-xl); padding: 0 2px;
}
.stepper input {
  width: 3em; border: 0; background: transparent; text-align: center; color: var(--md-sys-color-on-surface);
  font: 500 16px/24px var(--md-ref-typeface-plain); -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Snackbar ---------- */
.snackbar {
  position: fixed; left: 0; right: 0; bottom: 24px; margin: 0 auto; z-index: 20; width: max-content;
  display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 8px 8px 8px 16px; max-width: min(560px, calc(100% - 32px));
  border-radius: var(--shape-xs); background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--elev-3); animation: snackbar-in 0.2s ease-out;
}
.snackbar-action { color: var(--md-sys-color-inverse-primary); text-decoration: none; padding: 10px 12px; border-radius: 20px; white-space: nowrap; }
.snackbar-action:hover { background: color-mix(in srgb, var(--md-sys-color-inverse-primary) 8%, transparent); }
@keyframes snackbar-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Cart ---------- */
.cart-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 840px) { .cart-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; } }
.cart-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.cart-line { display: flex; gap: 16px; padding: 12px; }
.cart-thumb img, .cart-thumb .no-photo { width: 88px; height: 88px; object-fit: cover; border-radius: var(--shape-sm); }
.cart-line-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cart-line-info > a { color: inherit; text-decoration: none; }
.cart-line-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 4px; }

.form-card { padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 600px) { .form-card { padding: 24px; } }
.form-card[hidden] { display: none; }
.radio-group { border: 0; padding: 0; margin: 0; }
.radio-group legend { margin-bottom: 4px; }
.radio-row { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }

/* ---------- Order confirmation ---------- */
.order-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 24px 0 32px; }
.order-hero > md-icon {
  font-size: 40px; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); margin-bottom: 8px;
}
.status-hero-cancelled > md-icon, .status-hero-expired > md-icon { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.order-hero h1 { margin: 0; }
main > .card { max-width: 720px; margin-left: auto; margin-right: auto; }
main > .center { margin-top: 16px; }

/* ---------- Lists ---------- */
.list-card { overflow: hidden; margin-bottom: 16px; }
.list { list-style: none; margin: 0; padding: 8px 0; }
.list > li + li { border-top: 1px solid var(--md-sys-color-outline-variant); }
.list-item {
  display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 12px 16px;
  color: inherit; text-decoration: none; width: 100%; text-align: left;
  background: none; border: 0; font: inherit; position: relative;
}
.list-item.interactive { cursor: pointer; }
.list-item.interactive:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.list-item.interactive:active { background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent); }
.list-item.interactive:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: -3px; }
.list-item.dim { opacity: 0.6; }
.list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-trailing { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-thumb { width: 56px; height: 56px; border-radius: var(--shape-sm); object-fit: cover; flex: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.trailing-time { text-align: right; }
.total-row { min-height: 56px; justify-content: space-between; }

.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.title-row h1 { margin: 8px 0; }
.section-title { margin: 32px 0 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.button-row form { margin: 0; }
.actions { margin-top: 8px; }


/* ---------- Product form ---------- */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.photo-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.photo-previews:empty { display: none; }
.photo-previews img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--shape-sm); }
.ai-box {
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--shape-lg);
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.ai-header { display: flex; align-items: center; gap: 8px; }
.ai-box md-filled-tonal-button { align-self: flex-start; --md-filled-tonal-button-container-color: var(--md-sys-color-surface-container-lowest); }
.ai-box md-linear-progress { width: 100%; }
.ai-box p:empty { display: none; }
.category-suggestions { margin-top: -8px; }
.private-details summary { cursor: pointer; padding: 8px 0; color: var(--md-sys-color-on-surface-variant); }
.private-details[open] summary { margin-bottom: 12px; }

.photo-strip { list-style: none; padding: 0; margin: 0 0 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.photo-strip li { width: 112px; }
.photo-strip img { width: 112px; height: 112px; object-fit: cover; border-radius: var(--shape-md); }
.photo-actions { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.photo-actions form { margin: 0; }

.fb-copy { padding: 16px 0 0; margin-bottom: 16px; }
.fb-copy > summary { cursor: pointer; padding: 0 16px 12px; }
.fb-copy > p { padding: 0 16px 8px; }
.copy-value { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5em; overflow: hidden; }
.copy-hint { color: var(--md-sys-color-primary); min-width: 48px; text-align: center; }

@media (max-width: 599px) {
  .row { grid-template-columns: 1fr; }
}

/* ---------- Pickup ("How to find us") ---------- */
.pickup-address { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; padding: 16px; margin-bottom: 24px; }
.pickup-address > md-icon { color: var(--md-sys-color-primary); }
.pickup-address p { margin: 0 0 4px; }
.pickup-address .button-row { grid-column: 1 / -1; margin: 12px 0 0; }
.steps { list-style: none; margin: 0 0 24px; padding: 8px 16px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; padding: 12px 0; }
.steps li + li { border-top: 1px solid var(--md-sys-color-outline-variant); }
.step-number {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.pickup-photos { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 16px; }
@media (min-width: 600px) { .pickup-photos { grid-template-columns: 1fr 1fr; } }
.pickup-photos li { overflow: hidden; }
.pickup-photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pickup-photos p { margin: 0; padding: 12px 16px; }
.pickup-photo-edit { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.pickup-photo-edit li { display: flex; gap: 16px; align-items: flex-start; }
.pickup-photo-edit img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--shape-md); flex: none; }
.pickup-photo-edit .stack { flex: 1; gap: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.center-row { justify-content: center; }
