/* TradeHive Directory V2 Card Component
   Full replacement stylesheet
   Base: user's last working desktop file
   Added: mobile refinement so image sits higher/top-right and meta stays tighter
*/

:root{
  --thv2-moss:#176c48;
  --thv2-moss-dark:#13573a;
  --thv2-moss-soft:#edf5ef;
  --thv2-moss-soft-2:#f4f8f5;
  --thv2-moss-border:#2a7a58;
  --thv2-chip-border:#d5ded8;
  --thv2-text:#0f172a;
  --thv2-muted:#475569;
  --thv2-line:#e6ece8;
  --thv2-gold:#e0b84b;
  --thv2-free:#64748b;
}

#thList.th-grid{
  display:flex !important;
  flex-direction:column !important;
  gap:18px !important;
}

#thList .thv2-card{
  width:min(100%, 1140px);
  margin:0 auto;
  position:relative;
  box-sizing:border-box;
}

.thv2-card *,
.thv2-card *::before,
.thv2-card *::after{
  box-sizing:border-box;
}

.thv2-badge-row,
.thv2-free-badge-row{
  position:relative;
  z-index:2;
  margin:0 0 -12px 18px;
  pointer-events:none;
}

.thv2-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border-radius:999px;
  padding:9px 16px;
  font-size:14px;
  line-height:1;
  font-weight:800;
  letter-spacing:0;
  white-space:nowrap;
}

.thv2-badge svg{
  flex:0 0 auto;
}

.thv2-badge--trusted{
  background:var(--thv2-moss);
  color:#fff;
  box-shadow:0 8px 18px rgba(23,108,72,.18);
}

.thv2-badge--trusted svg{
  color:#f0c85c;
}

.thv2-badge--free{
  background:var(--thv2-free);
  color:#fff;
}

/* Trusted */
.thv2-card--trusted .thv2-shell{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(320px,420px);
  border:1.5px solid var(--thv2-moss-border);
  border-radius:24px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 14px 30px rgba(15,23,42,.06);
  position:relative;
}

.thv2-main{
  padding:34px 26px 20px;
  display:grid;
  grid-template-rows:auto auto auto;
  gap:16px;
  min-width:0;
}

.thv2-identity{
  display:grid;
  grid-template-columns:108px minmax(0,1fr);
  gap:20px;
  align-items:start;
}

.thv2-logo,
.thv2-free-logo{
  width:108px;
  height:108px;
  border-radius:22px;
  border:1px solid #e2e8f0;
  background:#fff;
  padding:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.thv2-logo img,
.thv2-free-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.thv2-logo__fallback{
  font-size:34px;
  line-height:1;
}

.thv2-meta,
.thv2-free-meta{
  min-width:0;
}

.thv2-title,
.thv2-free-title{
  margin:4px 0 10px;
  color:var(--thv2-text);
  font-size:22px;
  line-height:1.08;
  font-weight:900;
  letter-spacing:-.01em;
}

.thv2-title{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  max-width:24ch;
}

.thv2-title a,
.thv2-free-title a{
  color:inherit;
  text-decoration:none;
}

.thv2-title a:hover,
.thv2-free-title a:hover{
  text-decoration:underline;
}

.thv2-location-row,
.thv2-free-location{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  color:var(--thv2-muted);
  font-size:15px;
  margin-bottom:12px;
}

.thv2-more-areas,
.thv2-free-more{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 10px;
  background:#eef5ef;
  border:1px solid #d8e5dc;
  color:#2c5c46;
  font-size:12px;
  font-weight:700;
}

.thv2-tags,
.thv2-free-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.thv2-tags{
  max-height:34px;
  overflow:hidden;
}

.thv2-tag{
  display:inline-flex;
  align-items:center;
  padding:6px 12px;
  border-radius:999px;
  background:var(--thv2-moss-soft-2);
  border:1px solid var(--thv2-chip-border);
  color:#334155;
  font-size:13px;
  line-height:1.2;
  font-weight:700;
  white-space:nowrap;
}

.thv2-tag--more{
  background:#f1f4f1;
}

.thv2-excerpt{
  display:none !important;
}

/* Mobile summary is never shown on desktop */
.thv2-mobile-summary{
  display:none !important;
}

.thv2-proof-wrap{
  border-top:1px solid var(--thv2-line);
  border-bottom:1px solid var(--thv2-line);
  padding:14px 0 12px;
}

.thv2-proof{
  display:flex;
  align-items:center;
  gap:16px;
}

.thv2-proof-left{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:center;
  min-width:0;
}

.thv2-proof-item{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:0;
  border:0;
  border-radius:0;
  font-size:15px;
  font-weight:800;
  color:#1f2937;
  background:transparent;
  min-height:0;
}

.thv2-proof-item svg{
  flex:0 0 auto;
}

.thv2-proof-item--verified{
  color:var(--thv2-moss-dark);
}

.thv2-proof-item--verified svg{
  color:var(--thv2-moss);
}

.thv2-proof-item--plain .th-rating{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:15px;
  font-weight:800;
}

.thv2-proof-item--plain .th-rating-stars-bg{
  color:#e5e7eb;
}

.thv2-proof-item--plain .th-rating-stars-fg{
  color:#efb321;
}

.thv2-proof-item--plain .th-rating-score{
  color:#0f172a;
  font-weight:900;
}

.thv2-proof-item--plain .th-rating-count{
  color:#64748b;
  font-weight:800;
}

.thv2-fav{
  width:48px;
  height:48px;
  border-radius:14px;
  border:1px solid #d0d7de;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  color:#111827;
  text-decoration:none;
  flex:0 0 auto;
  margin-left:auto;
  align-self:center;
}

.thv2-actions{
  display:grid;
  gap:12px;
}

.thv2-actions--row{
  grid-template-columns:repeat(3,minmax(0,1fr));
  align-items:stretch;
}

.thv2-btn,
.thv2-card a.thv2-btn,
.thv2-card span.thv2-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  border-radius:14px;
  padding:11px 16px;
  text-decoration:none !important;
  font-size:15px;
  font-weight:900;
  border:1px solid #d0d7de;
  background:#fff;
  color:#0f172a;
  text-align:center;
  white-space:nowrap;
}

/* Stronger primary button overrides to beat theme/global link styles */
.thv2-actions--row .thv2-btn--primary,
.thv2-card a.thv2-btn--primary,
.thv2-card--free a.thv2-btn--primary,
.thv2-card--trusted a.thv2-btn--primary{
  background:var(--thv2-moss) !important;
  border-color:var(--thv2-moss) !important;
  color:#fff !important;
}

.thv2-actions--row .thv2-btn--secondary,
.thv2-card a.thv2-btn--secondary{
  background:var(--thv2-moss-soft) !important;
  border-color:#d5e7dc !important;
  color:#144c34 !important;
}

.thv2-actions--row .thv2-btn--ghost,
.thv2-card a.thv2-btn--ghost{
  background:#fff !important;
  color:#0f172a !important;
}

.thv2-btn.is-disabled{
  opacity:.6;
  cursor:not-allowed;
}

.thv2-media{
  position:relative;
  min-height:100%;
  background-size:cover;
  background-position:center center;
  background-repeat:no-repeat;
  background-image:linear-gradient(135deg,#dbeafe 0%, #eff6ff 45%, #ffffff 100%);
}

.thv2-media--empty{
  background-image:linear-gradient(135deg,#f2f7f3 0%, #ffffff 58%, #f6faf7 100%);
}

.thv2-media-fade{
  position:absolute;
  inset:0;
  background:linear-gradient(90deg,#ffffff 0%, rgba(255,255,255,.88) 18%, rgba(255,255,255,0) 46%);
}

/* Free */
.thv2-card--free .thv2-free-shell{
  border:1px solid #dbe3ea;
  border-radius:20px;
  background:#fff;
  box-shadow:0 10px 24px rgba(15,23,42,.05);
  overflow:hidden;
}

.thv2-free-main{
  display:grid;
  grid-template-columns:92px minmax(0,1fr) minmax(220px,260px);
  gap:18px;
  align-items:start;
  padding:18px 20px;
}

.thv2-free-logo{
  width:92px;
  height:92px;
  border-radius:18px;
}

.thv2-free-title{
  font-size:22px;
  margin:4px 0 6px;
}

.thv2-free-actions{
  display:grid;
  gap:10px;
  align-self:start;
}

.thv2-card--free .thv2-btn{
  min-height:42px;
  font-size:14px;
}

.thv2-free-footer{
  border-top:1px solid var(--thv2-line);
  padding:10px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}


/* Free cards: keep only View profile button */
.thv2-card--free .thv2-free-actions > .thv2-btn--primary,
.thv2-card--free .thv2-free-actions > .thv2-btn--secondary,
.thv2-card--free .thv2-free-actions > .is-disabled{
  display:none !important;
}

.thv2-card--free .thv2-free-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}

.thv2-card--free .thv2-free-actions > .thv2-btn--ghost{
  display:inline-flex !important;
  width:100%;
}



/* Tablet landscape / smaller widths: avoid 3 cramped action buttons in one row */
@media (max-width: 1180px){
  .thv2-card--trusted .thv2-actions--row{
    grid-template-columns:1fr 1fr !important;
    gap:10px;
  }

  .thv2-card--trusted .thv2-actions--row .thv2-btn--primary{
    grid-column:1 / -1;
  }
}

/* Responsive */
@media (max-width: 980px){
  #thList .thv2-card{
    width:min(100%, 100%);
  }

  .thv2-card--trusted .thv2-shell,
  .thv2-free-main{
    grid-template-columns:1fr;
  }

  .thv2-media{
    min-height:220px;
    order:2;
  }

  .thv2-main{
    order:1;
  }

  .thv2-actions--row{
    grid-template-columns:1fr;
  }
}

@media (max-width: 680px){
  .thv2-badge-row,
  .thv2-free-badge-row{
    margin:0 0 -8px 12px;
  }

  .thv2-badge{
    padding:8px 13px;
    font-size:12px;
  }

  .thv2-card--trusted .thv2-shell{
    display:block;
    position:relative;
    border-radius:22px;
    overflow:hidden;
    min-height:0;
  }

  .thv2-main,
  .thv2-free-main{
    padding:18px;
  }

  .thv2-main{
    position:relative;
    z-index:2;
    gap:12px;
  }

  .thv2-identity{
    grid-template-columns:86px minmax(0,1fr);
    gap:12px;
    align-items:start;
    min-height:0;
  }

  .thv2-logo,
  .thv2-free-logo{
    width:86px;
    height:86px;
    border-radius:18px;
  }

  .thv2-title{
    font-size:20px;
    max-width:none;
    -webkit-line-clamp:3;
    margin:0;
    padding-right:34%;
  }

  /* Remove location/trade rows from mobile cards entirely */
  .thv2-location-row,
  .thv2-tags,
  .thv2-free-location,
  .thv2-free-tags,
  .thv2-mobile-summary{
    display:none !important;
  }

  .thv2-media{
    position:absolute;
    top:0;
    right:0;
    width:46%;
    height:228px;
    min-height:0;
    max-height:none;
    border-top-right-radius:22px;
    border-bottom-left-radius:24px;
    overflow:hidden;
    z-index:1;
    opacity:.98;
    order:initial;
    background-position:center top;
  }

  .thv2-media-fade{
    background:linear-gradient(
      90deg,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,.98) 18%,
      rgba(255,255,255,.78) 44%,
      rgba(255,255,255,.30) 72%,
      rgba(255,255,255,0) 94%
    );
  }

  .thv2-proof-wrap{
    margin-top:8px;
    padding:12px 0;
  }

  .thv2-proof{
    display:grid;
    grid-template-columns:minmax(0,1fr) 52px;
    align-items:center;
    gap:12px;
  }

  .thv2-proof-left{
    gap:10px 12px;
  }

  .thv2-proof-item{
    font-size:14px;
  }

  .thv2-proof-item--plain .th-rating{
    gap:6px;
    font-size:14px;
  }

  .thv2-fav{
    width:44px;
    height:44px;
    border-radius:14px;
    align-self:center;
    justify-self:end;
    margin-left:0;
  }

  .thv2-actions--row{
    grid-template-columns:1fr 1fr;
    gap:10px;
  }

  .thv2-actions--row .thv2-btn--primary{
    grid-column:1 / -1;
  }

  .thv2-btn,
  .thv2-card a.thv2-btn,
  .thv2-card span.thv2-btn{
    min-height:52px;
    border-radius:18px;
    font-size:13px;
    line-height:1.2;
    padding:12px 12px;
    white-space:nowrap;
  }

  .thv2-free-main{
    grid-template-columns:80px minmax(0,1fr);
  }

  /* Free cards: only keep View profile button on mobile */
  .thv2-free-actions{
    grid-column:1 / -1;
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
  }

  .thv2-card--free .thv2-free-actions > .thv2-btn--primary,
  .thv2-card--free .thv2-free-actions > .thv2-btn--secondary,
  .thv2-card--free .thv2-free-actions > .is-disabled{
    display:none !important;
  }

  .thv2-card--free .thv2-free-actions > .thv2-btn--ghost{
    display:inline-flex !important;
    width:100%;
  }

  .thv2-free-footer{
    padding:10px 18px 14px;
    flex-direction:row;
    align-items:center;
  }

  .thv2-free-proof{
    min-width:0;
  }
}

