/* ── Toast ─────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 88px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s var(--ease-out, ease-out) both;
  max-width: 320px;
}

.toast-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.toast-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.toast-info { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ── Buttons extended ──────────────────────────── */
.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}

.btn-md { padding: 10px 18px; font-size: 0.925rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Badge variants ────────────────────────────── */
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }
.badge-danger { background: #fef2f2; color: var(--danger); }

/* ── Brand logo ────────────────────────────────── */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-logo-mark {
  display: block;
  height: var(--brand-logo-size, 40px);
  width: auto;
  max-width: calc(var(--brand-logo-size, 40px) * 2.8);
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo-text {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand-logo-accent { color: var(--primary); }

.brand-logo-light .brand-logo-text { color: white; }
.brand-logo-light .brand-logo-accent { color: #5eead4; }

/* ── Avatar ────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

/* ── Rating ────────────────────────────────────── */
.rating-stars { display: inline-flex; gap: 1px; }
.rating-stars .star { color: #e2e8f0; }
.rating-stars .star.filled { color: #fbbf24; }
.rating-stars-sm { font-size: 0.85rem; }
.rating-stars-md { font-size: 1rem; }

/* ── Page header ───────────────────────────────── */
.page-header {
  margin-bottom: 36px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.page-header-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin: 0 0 6px; letter-spacing: -0.025em; }
.page-subtitle { margin: 0; font-size: 0.95rem; line-height: 1.5; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.85rem; margin-bottom: 12px; }
.breadcrumb-item a { color: var(--primary); font-weight: 600; }
.breadcrumb-sep { margin: 0 6px; color: var(--text-muted); }

/* ── Tabs ──────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Step progress ─────────────────────────────── */
.step-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}

.step-progress::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s;
}

.step.active .step-dot {
  background: var(--gradient-primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.step.done .step-dot {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.step.active .step-label { color: var(--primary); }

/* ── Trust strip ───────────────────────────────── */
.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 36px 0;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
}

.trust-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(13, 148, 136, 0.2);
}

.trust-item svg {
  color: var(--primary);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 6px;
  background: var(--primary-light);
  border-radius: 10px;
}

@media (max-width: 768px) {
  .trust-strip { grid-template-columns: 1fr; }
}

/* ── Category grid (sell page etc.) ────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.category-rail-items .category-card {
  flex: 0 0 118px;
  min-width: 118px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  min-height: 108px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  transition: border-color 0.22s var(--ease-out), background 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), color 0.22s var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.category-card > span:last-child {
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  word-break: break-word;
}

.category-card:hover {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 100%);
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.category-card.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 100%);
  color: var(--primary-dark);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.12);
}

.category-card-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

/* ── Filter bar ────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: calc(var(--header-h) + 10px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.filter-bar .select, .filter-bar .input {
  width: auto;
  min-width: 120px;
  padding: 8px 12px;
  font-size: 0.875rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-left: 2px;
}

/* ── Image upload ──────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-muted);
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone p { margin: 8px 0 4px; color: var(--text); }

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.upload-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }

.upload-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* ── Modal ─────────────────────────────────────── */
.modal-title { margin: 0 0 16px; font-size: 1.25rem; }
.modal-sm { max-width: 380px; }
.modal-md { max-width: 480px; }
.modal-lg { max-width: 640px; }

.field-hint { display: block; font-size: 0.8rem; margin-top: 4px; }

/* ── Mobile bottom nav ─────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}

.bottom-nav a, .bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
}

.bottom-nav a.active, .bottom-nav button.active { color: var(--primary); }

.bottom-nav-icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.bottom-nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

.bottom-nav .sell-btn {
  background: var(--gradient-accent);
  color: white;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  margin-top: -22px;
  box-shadow: 0 6px 20px var(--accent-glow);
  justify-content: center;
  border: 3px solid white;
}

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .app-shell main { padding-bottom: 72px; }
  .toast-stack { bottom: 80px; right: 12px; left: 12px; }
  .toast { max-width: none; }
  .step-label { display: none; }
  .category-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Admin styles live in admin.css */

/* ── Chat ──────────────────────────────────────── */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-h) - var(--category-nav-h) - var(--bottom-nav-h));
  max-width: 760px;
  margin: 0 auto;
  padding-top: 8px;
}

@media (min-width: 769px) {
  .chat-layout {
    height: calc(100dvh - var(--header-h) - var(--category-nav-h));
  }
}

.chat-back {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

.chat-header-bar {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  align-items: flex-start;
}

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

.chat-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.chat-type-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-type-badge.listing {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.chat-type-badge.direct {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.chat-header-listing {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.chat-header-listing img {
  width: 40px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.chat-header-listing span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-link {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 8px;
  opacity: 0.7;
}

.chat-message-wrap {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 4px;
}

.chat-message-wrap.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-message-wrap.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-message-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-inline: 4px;
}

.chat-read {
  color: var(--primary);
}

.chat-listing-bar {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  align-items: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.925rem;
  line-height: 1.45;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.conversation-row {
  display: flex;
  gap: 14px;
  align-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
}

.conversation-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.conversation-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

/* ── Notification ──────────────────────────────── */
.notif-group-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 24px 0 8px;
}

.notif-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item.unread { background: var(--primary-light); border-left: 3px solid var(--primary); }

.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--primary);
}

/* ── Seller cover ──────────────────────────────── */
.seller-cover {
  background: var(--gradient-hero);
  border-radius: var(--radius-xl);
  padding: 36px;
  color: white;
  margin-bottom: 32px;
  display: flex;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow-lg);
}

.seller-stats {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.seller-stat { font-size: 0.9rem; opacity: 0.9; }
.seller-stat strong { display: block; font-size: 1.25rem; }

@media (max-width: 640px) {
  .seller-cover {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    gap: 16px;
  }

  .seller-stats {
    justify-content: center;
  }
}

/* ── My ads row ────────────────────────────────── */
.ad-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: center;
}

.ad-row-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .ad-row { grid-template-columns: 80px 1fr; }
  .ad-row-actions { grid-column: 1 / -1; flex-direction: row !important; flex-wrap: wrap; }
}

.ad-row-actions { display: flex; flex-direction: column; gap: 6px; }

/* ── Sell preview ──────────────────────────────── */
.sell-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.sell-preview-sticky { position: sticky; top: calc(var(--header-h) + 16px); }

@media (max-width: 900px) {
  .sell-layout { grid-template-columns: 1fr; }
  .sell-preview-sticky { position: static; }
}

/* ── Lightbox ──────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.9);
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}
