/* ============================================================
 * Marketplace — Haraj-inspired browse + detail layout
 * ============================================================ */

.market-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.market-hero h2 { margin: 0 0 4px; font-size: 22px; color: var(--coffee-900); }
.market-hero p  { margin: 0; color: var(--muted); font-size: 14px; }

.market-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.market-toolbar .input,
.market-toolbar .select { flex: 1 1 180px; min-width: 120px; }

/* ===== Grid (Haraj-style 2-col on mobile, 3-4 on desktop) ===== */
.market-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px)  { .market-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 1024px) { .market-grid { grid-template-columns: repeat(4, 1fr); } }

.market-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(62, 39, 22, 0.08);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.03);
}
.market-card:hover  { box-shadow: 0 6px 18px rgba(62, 39, 22, 0.14); }
.market-card:active { transform: scale(0.98); }

.market-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--coffee-300), var(--coffee-400));
  position: relative;
  overflow: hidden;
}
.market-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.market-media .fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 92px;
  color: var(--coffee-900);
  background:
    radial-gradient(circle at 30% 30%, rgba(212,175,55,.35), transparent 60%),
    linear-gradient(135deg, var(--cream-100), var(--coffee-300));
  text-shadow: 0 3px 12px rgba(62,39,22,.15);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.1));
}

.market-price-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--coffee-900);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  white-space: nowrap;
}

.market-demo-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 2px 6px rgba(22,163,74,.4);
  text-transform: uppercase;
}

.listing-demo-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.6;
}
.listing-demo-banner strong { display: block; margin-bottom: 2px; font-size: 15px; }

.market-count-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}

.market-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.market-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--coffee-900);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  min-height: 36px;
}
.market-meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}
.market-meta .dot { opacity: 0.5; }

.market-owner-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.market-owner-actions .btn-sm {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
}

/* ===== FAB: "Add listing" button ===== */
.market-fab {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 20;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #2E1B10;
  font-family: inherit;
  font-weight: 900;
  font-size: 15px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(180, 130, 30, 0.45);
  display: flex;
  align-items: center;
  gap: 8px;
}
.market-fab:active { transform: translateY(2px); }

/* ===== Photo uploader (Haraj-style: photos first, big + tile) ===== */
.photo-uploader {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 400px) {
  .photo-uploader { grid-template-columns: repeat(3, 1fr); }
}
.photo-slot,
.photo-add-tile {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--coffee-100);
}
.photo-slot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-slot .remove {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px; height: 26px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  line-height: 1;
}
.photo-slot .cover-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--gold);
  color: #2E1B10;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 900;
}
.photo-slot .progress {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.photo-add-tile {
  background: var(--coffee-100);
  border: 2px dashed var(--coffee-400);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--coffee-700);
  gap: 4px;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease;
}
.photo-add-tile:hover {
  background: var(--coffee-200);
  border-color: var(--coffee-700);
}
.photo-add-tile .icon { font-size: 26px; }
.photo-add-tile small { font-size: 11px; color: var(--muted); }

.photo-count-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ===== Listing detail page ===== */
.listing-page { padding-bottom: 90px; /* room for fixed contact bar */ }

.listing-gallery {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--coffee-200);
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(62,39,22,0.1);
}
.listing-slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.listing-slides::-webkit-scrollbar { display: none; }
.listing-slides .slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 30% 30%, rgba(212,175,55,.35), transparent 60%),
    linear-gradient(135deg, var(--cream-100), var(--coffee-300));
  display: grid;
  place-items: center;
  color: var(--coffee-900);
  font-size: 140px;
}
.listing-slides .slide img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.listing-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.35);
  padding: 5px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.listing-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: background .15s ease, width .15s ease;
}
.listing-dots .dot.active {
  background: #fff;
  width: 18px;
  border-radius: 4px;
}

.listing-counter {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.listing-info {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.listing-info h1 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--coffee-900);
  line-height: 1.4;
}
.listing-price-big {
  font-size: 28px;
  font-weight: 900;
  color: var(--gold-dark);
  margin-bottom: 14px;
}
.listing-meta-row {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.listing-meta-row .tag {
  background: var(--coffee-200);
  color: var(--coffee-900);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.listing-description {
  color: var(--text);
  line-height: 1.85;
  white-space: pre-wrap;
  margin: 0;
}

.listing-section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--coffee-900);
  margin: 0 0 10px;
  letter-spacing: 1px;
}

.listing-contact-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 18px rgba(0,0,0,0.08);
  display: flex;
  gap: 8px;
  z-index: 30;
}
.listing-contact-bar .btn {
  flex: 1;
  justify-content: center;
  padding: 13px 12px;
  font-size: 14px;
}
.listing-contact-bar .btn-call    { background: #fff; color: var(--coffee-800); border: 2px solid var(--coffee-700); }
.listing-contact-bar .btn-whatsapp{ background: #25D366; color: #fff; }
.listing-contact-bar .btn-share-listing{ background: var(--gold); color: #2E1B10; flex: 0 0 auto; padding: 13px 14px; font-weight: 800; }

/* Seller block on listing detail */
.seller-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--coffee-200);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--coffee-900);
  font-size: 24px;
  flex-shrink: 0;
}
.seller-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Price input with currency suffix (auto-updated by country dropdown) */
.price-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.price-wrap .price-input {
  padding-inline-end: 58px;
  width: 100%;
  direction: ltr;
  text-align: right;
  font-family: "Tajawal", monospace;
  font-variant-numeric: tabular-nums;
}
.price-wrap .price-currency {
  position: absolute;
  inset-inline-end: 12px;
  background: var(--coffee-200);
  color: var(--coffee-900);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
  min-width: 42px;
  text-align: center;
}
