/* ============================================================
   BAZARIO — design system
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  --bg:           #f6f7f9;
  --bg-grad:      radial-gradient(1200px 600px at 50% -200px, #eef2ff 0%, transparent 70%);
  --surface:      #ffffff;
  --surface-2:    #f1f4f8;
  --border:       #e6e9ef;
  --border-2:     #d8dde6;
  --text:         #0b1220;
  --text-muted:   #647084;
  --text-faint:   #97a1b2;
  --accent:       #2f5cff;
  --accent-h:     #1f47e6;
  --accent-soft:  rgba(47,92,255,.10);
  --price:        #0b1220;
  --av-bg:        #e7f8ee;  --av-fg: #137a45;
  --sold-bg:      #fdecec;  --sold-fg: #d6322f;
  --ring:         0 0 0 4px rgba(47,92,255,.16);
  --shadow-sm:    0 1px 2px rgba(16,24,40,.05);
  --shadow:       0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --shadow-h:     0 4px 12px rgba(16,24,40,.10), 0 24px 48px rgba(16,24,40,.12);
  --header-bg:    rgba(255,255,255,.72);
  --header-border:rgba(16,24,40,.08);
  --header-text:  #0b1220;
  --footer-bg:    #0b1220;
  --radius:       18px;
  --radius-md:    12px;
  --radius-sm:    10px;
}

[data-theme="dark"] {
  --bg:           #0a0e16;
  --bg-grad:      radial-gradient(1200px 600px at 50% -200px, #11203f 0%, transparent 70%);
  --surface:      #121826;
  --surface-2:    #1a2233;
  --border:       #232c3d;
  --border-2:     #2e394d;
  --text:         #eef2f8;
  --text-muted:   #9aa6ba;
  --text-faint:   #6b7689;
  --accent:       #5b82ff;
  --accent-h:     #7191ff;
  --accent-soft:  rgba(91,130,255,.14);
  --price:        #ffffff;
  --av-bg:        #0f2e1f;  --av-fg: #5fd497;
  --sold-bg:      #361416;  --sold-fg: #ff8d8a;
  --ring:         0 0 0 4px rgba(91,130,255,.22);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow:       0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-h:     0 4px 12px rgba(0,0,0,.5), 0 24px 48px rgba(0,0,0,.5);
  --header-bg:    rgba(10,14,22,.72);
  --header-border:rgba(255,255,255,.08);
  --header-text:  #eef2f8;
  --footer-bg:    #05080f;
}

/* Quill Dark Mode */
[data-theme="dark"] .ql-toolbar {
  background: var(--surface-2);
  border-color: var(--border) !important;
}
[data-theme="dark"] .ql-container {
  border-color: var(--border) !important;
}
[data-theme="dark"] .ql-stroke {
  stroke: var(--text) !important;
}
[data-theme="dark"] .ql-fill {
  fill: var(--text) !important;
}
[data-theme="dark"] .ql-picker {
  color: var(--text) !important;
}
[data-theme="dark"] .ql-editor.ql-blank::before {
  color: var(--text-faint) !important;
}

/* Search Match Highlight */
mark {
  background: #fff3c4;
  color: #856404;
  padding: 0 1px;
  border-radius: 2px;
}
[data-theme="dark"] mark {
  background: #4d3d00;
  color: #ffda6a;
}

/* ---- BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  transition: background-color .25s, color .25s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

::selection { background: var(--accent-soft); }

/* ---- SKIP LINK ---- */
.skip-link {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ---- HEADER ---- */
.header {
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--header-border);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  max-width: 1160px;
  margin: auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  color: var(--header-text);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-word {
  color: var(--header-text);
  font-weight: 800;
}
.logo-accent {
  color: var(--accent);
  font-weight: 800;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-btn,
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--header-text);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
  padding: 0;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.header-btn:hover,
.theme-toggle:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16,24,40,.10);
}
.header-btn:active,
.theme-toggle:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.header-btn:focus-visible,
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.header-btn-coffee { color: var(--accent); }
.header-btn-coffee:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}


/* Rests most of the cycle, brief subtle wiggle to draw the eye. */
@keyframes coffee-nudge {
  0%, 80%, 100% { transform: translateY(0) rotate(0); }
  84% { transform: translateY(-2px) rotate(-8deg); }
  88% { transform: translateY(-2px) rotate(6deg); }
  92% { transform: translateY(-1px) rotate(-4deg); }
  96% { transform: translateY(0) rotate(2deg); }
}

/* Lively continuous bob on hover. */
@keyframes steam {
  0%   { transform: translateY(0) rotate(-2deg); }
  50%  { transform: translateY(-3px) rotate(2deg); }
  100% { transform: translateY(0) rotate(-2deg); }
}

/* .header-btn-coffee i,
.header-btn-coffee svg {
  animation: coffee-nudge 7s ease-in-out infinite;
  display: inline-block;
  transform-origin: center bottom;
} */

.header-btn-coffee {
  animation: pulse-color 7s ease-in-out infinite;
}

.header-btn-coffee i,
.header-btn-coffee svg {
  animation: coffee-nudge 7s ease-in-out infinite;
  display: inline-block;
  transform-origin: center bottom;
}

@keyframes pulse-color {
  0%, 100%  { background: transparent; color: inherit; box-shadow: 0 0 0 0 rgba(226,75,74,0); border-color: inherit; }
  10%        { background: #E24B4A; color: white; box-shadow: 0 0 0 6px rgba(226,75,74,0.15); border-color: #E24B4A; }
  20%        { background: #E24B4A; color: white; box-shadow: 0 0 0 0 rgba(226,75,74,0); border-color: #E24B4A; }
  25%, 99%  { background: transparent; color: inherit; box-shadow: none; border-color: inherit; }
}

@keyframes coffee-nudge {
  0%, 8%, 28%, 100% { transform: rotate(0deg) scale(1); }
  10%  { transform: rotate(-12deg) scale(1.15); }
  13%  { transform: rotate(12deg) scale(1.15); }
  16%  { transform: rotate(-8deg) scale(1.1); }
  19%  { transform: rotate(6deg) scale(1.05); }
  22%  { transform: rotate(0deg) scale(1); }
}

.header-btn-coffee:hover i,
.header-btn-coffee:hover svg {
  animation: steam 1s ease-in-out infinite;
}

.header-btn-text {
  width: auto;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 700;
  gap: 7px;
  letter-spacing: -.2px;
  white-space: nowrap;
}

/* ---- USER AVATAR ---- */
.user-avatar {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  transition: transform .15s;
}
.avatar-img:hover { transform: scale(1.1); }
.avatar-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: transform .15s;
}
.avatar-initial:hover { transform: scale(1.1); }

/* ---- AUTH DIVIDER ---- */
.auth-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ---- LAYOUT ---- */
.container {
  width: 100%;
  max-width: 1160px;
  margin: auto;
  padding: 64px 24px 96px;
  flex: 1;
}

/* ---- CARD BASE ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ---- AUTH CARD ---- */
.auth-card {
  max-width: 400px;
  margin: 48px auto;
  padding: 32px;
}
.auth-card h2 { margin-bottom: 6px; font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.auth-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 22px; }

/* ---- POST MODAL ---- */
.post-modal-content { padding: 28px; }

.post-modal .modal-card { max-width: 560px; }

.post-modal.modal { align-items: flex-start; padding-top: 48px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.admin-header h2 { font-size: 19px; font-weight: 800; letter-spacing: -.4px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- SECTION HEADER ---- */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}
.section-header h2 { font-size: 24px; font-weight: 800; letter-spacing: -.6px; }

.count-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
}

/* ---- LISTING CARD ---- */
.item {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
  animation: card-in .35s ease both;
}
@keyframes card-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.item:hover {
  box-shadow: var(--shadow-h);
  transform: translateY(-3px);
  border-color: var(--border-2);
}

/* media */
.item-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.item:hover .item-media img { transform: scale(1.04); }
.item:hover .cat-badge { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-soft); }

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  opacity: .35;
}

/* sold state */
.item.is-sold .item-media img { filter: grayscale(.5) brightness(.82); }
.item.is-archived { opacity: .75; }

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  padding: 5px 11px;
  border-radius: 999px;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
}
.badge.sold { background: var(--sold-bg); color: var(--sold-fg); }
.badge.archived { background: var(--surface-2); color: var(--text-faint); }
.badge.active { background: var(--av-bg); color: var(--av-fg); }

.img-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* content */
.content { padding: 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

.item-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  font-size: 26px;
  font-weight: 900;
  color: var(--price);
  letter-spacing: -.8px;
  margin: 6px 0 8px;
}
.price::before { content: "$"; font-size: 16px; font-weight: 700; color: var(--text-muted); margin-right: 1px; vertical-align: 6px; }

.item-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.small {
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.5;
  display: flex;
  gap: 6px;
}

/* actions */
.actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* contact links */
.contact-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.contact-link:hover { text-decoration: underline; }

/* my listings toggle */
.my-listings-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.my-listings-btn:hover { border-color: var(--accent); color: var(--accent); }
.my-listings-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---- FILTERS ---- */
.filters-container {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 62px;
  z-index: 90;
  background: var(--bg);
  padding: 12px 0;
  margin-top: -12px;
}

.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select {
  margin-top: 0;
  width: auto;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  height: 36px;
  border-radius: 999px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.toggle-label input {
  margin-top: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--footer-bg);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  pointer-events: auto;
  animation: toast-in .3s cubic-bezier(.18, .89, .32, 1.28), toast-out .3s forwards 2.7s;
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(10px); opacity: 0; }
}
.toast.error { background: var(--sold-fg); }
.toast.success { background: var(--av-fg); }

.search-wrapper {
  position: relative;
  width: 100%;
}
.search-wrapper input {
  margin-top: 0;
  padding-left: 42px;
  height: 48px;
  font-size: 15px;
  border-radius: var(--radius-md);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: .5;
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all .15s;
}
.search-clear:hover { background: var(--border); color: var(--text); }

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}
.category-pills::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.pill {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: all .2s;
}
.pill:hover { border-color: var(--border-2); color: var(--text); }
.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-soft);
}

/* Category Badge on Card */
.cat-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 4px;
  width: fit-content;
  transition: all .2s;
}

/* select styling */
select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  display: block;
  margin-top: 12px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23647084' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* ---- INPUTS ---- */
input, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  display: block;
  margin-top: 12px;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 84px; }

/* file input */
.file-label { display: block; margin-top: 12px; cursor: pointer; }
.file-label input[type="file"] { display: none; }
.file-label span {
  display: block;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-2);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  transition: border-color .15s, color .15s, background .15s;
}
.file-label:hover span { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- BUTTONS ---- */
button { font-family: inherit; cursor: pointer; border: none; transition: transform .12s, background .15s, opacity .15s, border-color .15s; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(16,24,40,.12), 0 6px 16px rgba(47,92,255,.28);
}
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-full { width: 100%; margin-top: 18px; }

.btn-danger {
  background: var(--sold-bg);
  color: var(--sold-fg);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}
.btn-danger:hover { background: var(--sold-fg); color: #fff; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}
.btn-secondary:hover { border-color: var(--border-2); background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); }

/* ---- GRID ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

/* ---- EMPTY / LOADING ---- */
.hero-empty { grid-column: 1/-1; text-align: center; padding: 72px 24px; }
.hero-empty .hero-icon { font-size: 56px; margin-bottom: 16px; }
.hero-empty h2 { font-size: 24px; font-weight: 800; letter-spacing: -.6px; margin-bottom: 8px; }
.hero-empty p { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 72px 24px;
  color: var(--text-muted);
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty-icon { font-size: 44px; margin-bottom: 14px; opacity: .5; }
.empty p { font-size: 15px; font-weight: 500; }
.empty .empty-hint { font-size: 13px; color: var(--text-faint); margin-top: 4px; }

.loading {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}
.skeleton {
  height: 320px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- IMAGE PREVIEW ---- */
.preview-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.preview-item { position: relative; width: 84px; height: 84px; }
.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--sold-fg);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  transition: transform .15s;
}
.preview-remove:hover { transform: scale(1.1); }

/* ---- UPLOAD PROGRESS ---- */
.upload-progress {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}
.upload-progress-bar {
  height: 6px;
  flex: 1;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.upload-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  border-radius: 999px;
  width: 0;
  transition: width .2s;
}
.upload-progress.active .upload-progress-bar::after { width: 100%; }
.upload-progress.done .upload-progress-bar::after { width: 100%; background: var(--av-fg); }
.upload-progress-text { font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

/* ---- TOKEN NOTE ---- */
.token-note { margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.link-btn { color: var(--accent); font-weight: 700; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ---- FOOTER ---- */
.footer {
  background: var(--footer-bg);
  margin-top: auto;
  padding: 36px 24px;
}
.footer-inner {
  max-width: 1160px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 4px; }
.footer-logo {
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.4px;
}
.footer-logo span { color: var(--accent); }
.footer-tagline { color: rgba(255,255,255,.5); font-size: 13px; }
.footer-copy { color: rgba(255,255,255,.4); font-size: 12.5px; }

/* ---- DETAIL MODAL ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8,12,20,.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-h);
  overflow: hidden;
  animation: pop .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8,12,20,.55);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-close:hover { background: rgba(8,12,20,.8); }

.modal-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}
.modal-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.modal-media .no-image { width: 100%; height: 100%; }

.modal-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}
.modal-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
}
.modal-thumbs img:hover { border-color: var(--accent); }
.share-btn-round {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  opacity: 0;
  transform: translateY(-4px);
  transition: all .2s ease;
}
.item:hover .share-btn-round { opacity: 1; transform: none; }
.share-btn-round:hover { background: #fff; transform: scale(1.1); }
[data-theme="dark"] .share-btn-round { background: rgba(18,24,38,.9); color: #fff; }

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

.btn-sm { padding: 5px 10px; font-size: 12px; }
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(8,12,20,.45);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all .2s;
  z-index: 5;
}
.modal-nav:hover { background: rgba(8,12,20,.7); transform: translateY(-50%) scale(1.1); }
.modal-nav.prev { left: 16px; }
.modal-nav.next { right: 16px; }

.modal-info { padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.modal-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1.25; }
.modal-price { font-size: 28px; margin: 2px 0; }
.modal-desc { font-size: 14.5px; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }

.suggested-section { padding: 18px 22px 24px; border-top: 1px solid var(--border); }
.suggested-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; letter-spacing: -.2px; }
.suggested-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.suggested-card { cursor: pointer; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); transition: box-shadow .15s, transform .15s; }
.suggested-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.suggested-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.suggested-card .suggested-info { padding: 8px 10px; }
.suggested-card .suggested-info .suggested-name { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.suggested-card .suggested-info .suggested-price { font-size: 14px; font-weight: 800; color: var(--price); }

#loginOverlay { align-items: center; }

/* ---- LOGIN MODAL ---- */
.login-modal-content {
  padding: 28px 24px;
}
.login-modal-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.4px;
  margin-bottom: 6px;
}
.login-modal-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.login-modal-google {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.google-loading {
  text-align: center;
  padding: 10px 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

/* ---- UTIL ---- */
.hidden { display: none !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  /* 16px min prevents iOS Safari auto-zoom on input focus */
  input, select, textarea { font-size: 16px; }

  .header-inner { height: 56px; padding: 0 12px; }

  .header-actions { gap: 4px; }
  .header-btn, .theme-toggle { width: 44px; height: 44px; font-size: 14px; padding: 0; }
  .header-btn-text { width: auto; padding: 0 12px; font-size: 12.5px; gap: 5px; }
  .lang-picker { height: 44px; font-size: 12px; padding: 0 26px 0 10px; }
  .logo { font-size: 16px; gap: 5px; }

  .container { padding: 16px 0 56px; }

  .search-wrapper { padding: 0 12px; }
  .search-wrapper input { height: 44px; font-size: 16px; padding-left: 40px; border-radius: var(--radius-md); }
  .search-icon { left: 24px; font-size: 16px; }
  .search-clear { right: 20px; }

  .filters-container {
    top: 56px;
    padding: 8px 0 4px;
    margin-top: 0;
    gap: 10px;
  }
  .filters-row { flex-direction: column; align-items: stretch; gap: 8px; }

  .category-pills {
    padding: 0 12px 4px;
    gap: 8px;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
  }
  .pill {
    padding: 10px 18px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .pill.active { box-shadow: 0 4px 12px var(--accent-soft); }

  .filter-controls {
    padding: 0 12px;
    justify-content: space-between;
    gap: 10px;
  }
  .sort-select {
    flex: 1;
    height: 44px;
    font-size: 16px;
    padding: 0 32px 0 14px;
    background-position: right 10px center;
  }
  .toggle-label {
    font-size: 14px;
    gap: 6px;
    min-height: 44px;
  }
  .toggle-label input { width: 18px; height: 18px; }

  .section-header { padding: 0 12px; margin-bottom: 14px; }
  .section-header h2 { font-size: 19px; }

  .grid { gap: 12px; grid-template-columns: 1fr; padding: 0 12px; }

  .content { padding: 14px; }
  .item-title { font-size: 15px; }
  .price { font-size: 23px; }
  .price::before { vertical-align: 4px; font-size: 14px; }
  .item-desc { font-size: 13px; }

  .post-modal.modal { padding: 0; align-items: flex-end; }
  .post-modal .modal-card { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 92vh; overflow-y: auto; animation: slide-up .3s cubic-bezier(.2,.8,.3,1); }
  .post-modal-content { padding: 20px 16px 24px; }
  .admin-header h2 { font-size: 17px; }
  .form-grid { grid-template-columns: 1fr; gap: 8px; }
  .post-modal-content input, .post-modal-content select, .post-modal-content .file-label { margin-top: 8px; }
  #postCode { margin-top: 8px; }

  .actions { gap: 6px; padding: 0 12px; }
  .actions button {
    flex: 1;
    text-align: center;
    padding: 12px 12px;
    font-size: 13px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #loginOverlay .modal-card { max-width: 100% !important; margin: 0 12px; }
  .login-modal-content { padding: 24px 20px; }
  .login-modal-title { font-size: 18px; }
  .login-modal-subtitle { font-size: 13px; margin-bottom: 16px; }
  .auth-divider { margin: 12px 0; }
  #loginOverlay input { margin-top: 8px; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .footer { padding: 24px 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

  .toast-container {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    transform: none;
    width: auto;
  }
  .toast { font-size: 13px; padding: 10px 16px; border-radius: 12px; }

  /* Modal full width on mobile */
  .modal { padding: 16px 12px; align-items: flex-start; }
  .modal-card { border-radius: 16px; margin: 0; }
  .modal-info { padding: 14px 16px 20px; gap: 6px; }
  .modal-title { font-size: 18px; }
  .modal-price { font-size: 24px; }
  .modal-desc { font-size: 13.5px; }
  .modal-thumbs { padding: 8px 12px 0; gap: 6px; }
  .modal-thumbs img { width: 48px; height: 48px; }
  .modal-nav { width: 36px; height: 36px; font-size: 20px; }
  .modal-nav.prev { left: 8px; }
  .modal-nav.next { right: 8px; }

  .preview-item { width: 64px; height: 64px; }
  .preview-list { gap: 8px; }
  .cat-badge { font-size: 10px; padding: 1px 6px; }
  .count-badge { font-size: 11px; padding: 2px 9px; }

  .hero-empty { padding: 48px 16px; }
  .hero-empty .hero-icon { font-size: 44px; }
  .hero-empty h2 { font-size: 20px; }

  .suggested-section { padding: 14px 16px 18px; }
  .suggested-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .empty { padding: 48px 16px; margin: 0 12px; }
  .empty-icon { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---- LANG PICKER ---- */
.lang-picker {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  display: inline-flex;
  align-items: center;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--header-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  height: 44px;
  padding: 0 30px 0 14px;
  cursor: pointer;
  letter-spacing: .2px;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23647084' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}
.lang-picker:hover {
  border-color: var(--border-2);
  background-color: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16,24,40,.10);
}
.lang-picker:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.lang-picker:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- CONTACT MODAL ---- */
.contact-modal-content { padding: 24px; display: flex; flex-direction: column; gap: 12px; }

/* ---- COFFEE MODAL ---- */
.coffee-modal-content {
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.coffee-icon-wrapper {
  background: var(--accent-soft);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.coffee-modal-content h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.coffee-modal-content p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}
.qr-container {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}
.qr-container img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}
.qr-container span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
[data-theme="dark"] .qr-container { background: #fff; } /* Keep QR white for scanning */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-modal-content input,
.contact-modal-content textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}
.contact-modal-content input:focus,
.contact-modal-content textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.contact-modal-content textarea { resize: vertical; min-height: 100px; font-family: inherit; }

/* ---- FOOTER LINKS ---- */
.footer-links { display: flex; gap: 16px; align-items: center; }
.footer-link {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}
.footer-link:hover { color: #fff; }

@media (max-width:600px) {
  .footer-links { order: 1; }
  .contact-grid { grid-template-columns: 1fr; }
}
