/* =========================
   Core Theme / Global (MATCHES MAIN SITE COLORS)
   ========================= */
:root {
  --bg-dark:#19160f; --bg-darker:#0f0d09;
  --gold-1:#f7e3a1; --gold-2:#f1c55a; --gold-3:#caa043; --gold-4:#8a6a24;
  --text:#efe9d9; --muted:#d8cfb5; --card:#1f1a12; --card2:#231e15; --accent:#f2d27a;
  --shadow:rgba(0,0,0,.35);
  --danger:#ff6b6b; --warn:#f7c948; --ok:#52c41a; --great:#4cd3ff;

  --radius:18px;
  --radius2:24px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:"Poppins",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(242,210,122,.18), transparent 60%),
    radial-gradient(900px 500px at 80% -10%, rgba(242,210,122,.12), transparent 60%),
    linear-gradient(180deg,#221c12,var(--bg-dark));
  scroll-behavior:smooth;
}

a{color:var(--accent);text-decoration:none}
a:hover{filter:brightness(1.05)}

/* =========================
   Layout shell (MARKET uses a wider container)
   ========================= */
.container{
  width:min(1480px, calc(100% - 28px));
  margin:0 auto;
  padding:22px 0 80px;
}

/* =========================
   Nav / Brand / Buttons
   ========================= */
.nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
}
.brand img{
  width:190px;
  object-fit:contain;
  filter:drop-shadow(0 6px 12px var(--shadow));
}

.nav-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.btn{
  padding:11px 16px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg,#2b251b,#1c170f);
  color:var(--text);
  font-weight:600;
  box-shadow:0 10px 22px var(--shadow);
  transition:transform .12s ease,box-shadow .12s ease,filter .12s ease;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  font-size:14px;
  text-decoration:none;
}
.btn span.icon{font-size:16px}

.btn--gold{
  background:linear-gradient(180deg,var(--gold-2),var(--gold-3));
  color:#231b09;
  border:none;
}

.btn-small{
  padding:8px 12px;
  font-size:13px;
}

.btn:hover{
  transform:translateY(-2px) scale(1.01);
  box-shadow:0 14px 28px var(--shadow);
  filter:brightness(1.04);
}

.btn-outline{
  background:transparent;
  border:1px solid rgba(242,210,122,.35);
}

/* =========================
   Cards / Headings / Divider / Footer
   ========================= */
.card{
  background:linear-gradient(180deg,var(--card),var(--card2));
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  box-shadow:0 8px 24px var(--shadow);
  transition:transform .12s ease,box-shadow .12s ease,border-color .12s ease;
}
.card:hover{
  transform:translateY(-3px);
  box-shadow:0 14px 30px var(--shadow);
  border-color:rgba(242,210,122,.45);
}

.gradient-title{
  font-size:clamp(22px,2.6vw,30px);
  margin:0 0 10px;
  letter-spacing:.6px;
  background:linear-gradient(180deg,var(--gold-1),var(--gold-3));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  text-shadow:0 2px 0 rgba(0,0,0,.18);
}

.gold-divider{
  width:70%;
  margin:26px auto 18px;
  border:0;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg,rgba(0,0,0,0),var(--gold-2),rgba(0,0,0,0));
  position:relative;
  overflow:hidden;
  box-shadow:0 0 14px rgba(242,210,122,.6);
}
.gold-divider::before{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  width:28%;
  left:-30%;
  background:linear-gradient(90deg,rgba(242,210,122,0),rgba(242,210,122,.9),rgba(242,210,122,0));
  opacity:.9;
  filter:blur(1px);
  animation:goldSweep 2.8s linear infinite;
}
@keyframes goldSweep{
  0%{left:-30%;}
  100%{left:102%;}
}

.footer{
  margin-top:54px;
  padding-top:26px;
  border-top:1px solid rgba(255,255,255,.07);
  color:#cfc6ac;
  font-size:13px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
}
.footer-main{display:flex;flex-direction:column;gap:4px;max-width:520px;}
.footer-links{display:flex;flex-direction:column;gap:4px;text-align:right;}
.fine-print{
  flex-basis:100%;
  margin-top:10px;
  font-size:12px;
  color:#bfb59b;
  line-height:1.5;
}

/* =========================
   Marketplace Layout
   ========================= */
.market-shell{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:18px;
  align-items:start;
  margin-top: 14px;
}

/* Sidebar */
.side{ position: sticky; top: 14px; }
.side .card{ padding:16px; }
.side-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.side-title{ font-weight:800; letter-spacing:.2px; display:flex; align-items:center; gap:8px; margin:0; font-size:14px; }

.cat-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.cat-btn{
  display:flex; align-items:center; justify-content:flex-start; gap:10px;
  width:100%; text-align:left;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px 12px;
  color: inherit;
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.cat-btn[aria-pressed="true"]{
  border-color: rgba(242,210,122,.55);
  background: radial-gradient(120% 160% at 0% 0%, rgba(242,210,122,.16), rgba(255,255,255,0.04));
}
.cat-btn:hover{
  transform: translateY(-1px);
  border-color: rgba(242,210,122,.35);
  background: radial-gradient(120% 160% at 0% 0%, rgba(242,210,122,.14), rgba(255,255,255,0.04));
}
.cat-left{ display:flex; align-items:center; gap:10px; min-width:0; }
.cat-icon{
  width:28px; height:28px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(242,210,122,.12);
  border:1px solid rgba(242,210,122,.18);
  flex:0 0 auto;
}
.cat-label{ font-weight:700; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.section-slab{
  margin-top:14px;
  border-radius:16px;
  padding:14px;
  background:linear-gradient(160deg,rgba(242,210,122,.18),rgba(0,0,0,.55));
  border:1px solid rgba(242,210,122,.45);
  box-shadow:0 10px 26px var(--shadow);
}

.title{
  display:flex;
  align-items:center;
  font-weight:700;
  margin-bottom:6px;
}
.loan-icon{
  width:40px;height:40px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  margin-right:10px;flex-shrink:0;
  background:radial-gradient(circle at 30% 0%,#fff2cc,#f1c55a);
  box-shadow:0 6px 16px rgba(0,0,0,.45);
  font-size:20px;
}

/* Main head + controls */
.main-head{ display:flex; flex-direction:column; gap:12px; }
.market-note{
  margin:0;
  font-size:13px;
  color: var(--muted);
  line-height:1.55;
  max-width: 980px;
}
.controls{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; }

.search-wrap{
  flex: 1 1 680px;
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: radial-gradient(140% 160% at 0% 0%, rgba(242,210,122,.10), rgba(255,255,255,0.03));
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.search-wrap input{
  width:100%;
  background: transparent;
  border:0;
  outline:none;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .2px;
}

.sort-wrap{
  flex: 0 0 auto;
  display:flex; align-items:center; gap:10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}
.sort-wrap select{
  background: transparent;
  border:0;
  outline:none;
  color: inherit;
  font-family: inherit;
  font-size: 13px;
  min-width: 240px;
}

/* Header ads (optional) */
.nav-ads{
  display:flex;
  align-items:center;
  gap:20px;
  margin-right: 6px;
}
.nav-ad{
  width:260px;
  height:65px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(242,210,122,.22);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
  flex: 0 0 auto;
  display:block;
}
.nav-ad img{ width:100%; height:100%; object-fit:cover; display:block; }


@media (max-width: 250px){ .nav-ads{ display:none; } }

/* =========================
   Featured carousel
   ========================= */
.featured-shell{ position:relative; margin-top:14px; }

.featured-viewport{
  width: 100%;
  max-width: 1132px; /* 4*260 + 3*14 */
  margin: 0 auto;
  position: relative;
}
.featured-track{
  display:flex;
  gap:14px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-behavior:smooth;
  padding-bottom: 10px;
}


/* Hide the Featured horizontal scrollbar (keep scroll functionality) */
.featured-track{
  -ms-overflow-style: none;   /* IE/Edge legacy */
  scrollbar-width: none;      /* Firefox */
}
.featured-track::-webkit-scrollbar{
  height: 0;
  display: none;              /* Chrome/Safari */
}

/* Optional: arrows fade in on hover */
.featured-viewport .car-btn{
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .12s ease, background .12s ease, border-color .12s ease;
}
.featured-viewport:hover .car-btn{
  opacity: 1;
  pointer-events: auto;
}


.featured-card{
  flex: 0 0 260px;
  width: 260px;
  max-width: 260px;
}

.car-btn{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(242,210,122,.28);
  background: rgba(0,0,0,0.55);
  color: rgba(242,210,122,.95);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.car-btn:hover{
  transform: translateY(-50%) scale(1.03);
  border-color: rgba(242,210,122,.45);
  background: rgba(0,0,0,0.68);
}
.car-left{ left: -12px; }
.car-right{ right: -12px; }

@media (max-width: 1120px){ .featured-viewport{ max-width: 858px; } }  /* 3 */
@media (max-width: 860px){  .featured-viewport{ max-width: 534px; } }  /* 2 */
@media (max-width: 560px){
  .featured-viewport{ max-width: 260px; } /* 1 */
  .car-left, .car-right{ display:none; }
}

/* =========================
   Product cards (Featured + Grid)
   ========================= */
/* =========================
   Product cards (Featured + Grid) — SQUARE IMAGES (NO CROP)
   ========================= */
.market-img{
  width:100%;
  height:auto;                 /* stop forced rectangle height */
  aspect-ratio: 1 / 1;         /* makes it square */
  background: radial-gradient(120% 160% at 0% 0%, rgba(242,210,122,.18), rgba(255,255,255,0.03));
  border-bottom: 1px solid rgba(242,210,122,.18);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

/* Ensure the anchor fills the square */
.market-img a{
  display:block;
  width:100%;
  height:100%;
}

/* Show the entire image (no cropping) */
.market-img img{
  width:100%;
  height:100%;
  object-fit: contain;         /* IMPORTANT: no crop */
  display:block;
  background: rgba(0,0,0,0.25); /* subtle letterbox behind transparent/contain */
}


.market-badge{
  position:absolute;
  left:10px;
  top:10px;
  font-size:11px;
  padding:4px 9px;
  border-radius:999px;
  background: rgba(0,0,0,0.70);
  border:1px solid rgba(242,210,122,.35);
  color: rgba(242,210,122,.96);
  display:flex;
  align-items:center;
  gap:6px;
}

.market-body{
  padding:10px;
  display:flex;               /* critical: makes button stay at bottom */
  flex-direction:column;      /* critical: column stacking */
  gap:6px;
  height:100%;
  min-height: 150px;
}
.market-title{
  font-weight:800;
  letter-spacing:.2px;
  line-height:1.2;
  font-size:13.5px;
}
.market-desc{
  margin:0;
  font-size:12.5px;
  line-height:1.35;
  color: var(--muted);
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
  min-height: 2.7em;
}
.price-row{ display:flex; justify-content:flex-start; align-items:center; margin-top:2px; }
.gt-pill{
  font-size:12px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(242,210,122,.30);
  background: rgba(242,210,122,.10);
  color: rgba(242,210,122,.96);
  font-weight:800;
  letter-spacing:.2px;
}
.market-actions{
  display:flex;
  gap:10px;
  margin-top:auto;            /* critical: pushes actions to bottom */
  flex-wrap:wrap;
}

/* =========================
   All Listings grid (4 per row)
   ========================= */
.market-grid{
  display: grid;
  grid-template-columns: repeat(4, 260px);
  gap: 14px;
  justify-content: center;
  width: 100%;
}

.market-card{
  width: 260px;
  max-width: 260px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* Responsive */
@media (max-width: 1120px){ .market-grid{ grid-template-columns: repeat(3, 260px); } }
@media (max-width: 860px){  .market-grid{ grid-template-columns: repeat(2, 260px); } }
@media (max-width: 560px){  .market-grid{ grid-template-columns: repeat(1, 260px); } }

/* Pagination */
.pager{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  margin-top: 14px;
  flex-wrap:wrap;
}
.pager .note{ margin:0; }

/* =========================
   Responsive layout
   ========================= */
@media (max-width: 980px){
  .market-shell{ grid-template-columns: 1fr; }
  .side{ position:relative; top:auto; }
  .container{ width: calc(100% - 22px); }
}
@media (max-width: 560px){
  .sort-wrap select{ min-width: 200px; }
  .footer{flex-direction:column; align-items:flex-start;}
  .footer-links{text-align:left;}
  .nav{flex-direction:column; align-items:flex-start;}
  .nav-actions{align-self:flex-end;}
}
