/* ================================================================
   TisakeNyumba v3 — Card System + Portal Plans + Utilities
   Architect: single source of truth for all card-related styles
   No overrides needed — defined here first, not patched later
================================================================ */

/* ================================================================
   1. TENANT LISTING CARD — v2 design
================================================================ */
.listing-card {
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
}
.listing-card:active {
  transform: scale(.975);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.listing-card.hidden { display: none; }

/* ---- Photo Container ---- */
.card-img-v2 {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(140deg, #0d2040 0%, #1a3560 100%);
  overflow: hidden;
  flex-shrink: 0;
}
.card-img-v2 .img-slides { width: 100%; height: 100%; }
.card-img-v2 .img-slides img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
  user-select: none;
  -webkit-user-drag: none;
}
.card-img-v2 .img-slides img.active { display: block; }

/* No-photo placeholder */
.card-no-photo {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 6px;
  color: rgba(255,255,255,.2); font-size: 11px; font-weight: 500;
}

/* Image overlay — top row */
.card-img-overlay-top {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; align-items: flex-start; justify-content: space-between;
  z-index: 4;
  pointer-events: none;
}
.card-img-overlay-top > * { pointer-events: auto; }

/* Image overlay — bottom gradient + price */
.card-img-overlay-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 28px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 100%);
  z-index: 4; pointer-events: none;
}

/* Featured badge */
.card-feat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .4px;
  padding: 4px 9px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(245,158,11,.45);
}

/* Price pill — on the image */
.card-price-pill {
  display: inline-flex; align-items: baseline; gap: 2px;
  background: rgba(14,165,233,.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; font-size: 17px; font-weight: 800;
  font-family: var(--serif);
  padding: 5px 12px; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(14,165,233,.4);
  pointer-events: none;
}
.card-price-pill span { font-size: 11px; font-weight: 500; opacity: .85; margin-left: 1px; }

/* Favourite button */
.card-fav-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10,18,36,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.2); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, transform .15s;
  flex-shrink: 0;
}
.card-fav-btn:active { transform: scale(.86); }
.card-fav-btn.saved  { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.7); }

/* Slide navigation */
.slide-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(10,18,36,.6); backdrop-filter: blur(6px);
  color: #fff; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s; z-index: 5;
  border: 1px solid rgba(255,255,255,.15);
}
.card-img-v2:hover .slide-arrow,
.card-img-v2:focus-within .slide-arrow { opacity: 1; }
.slide-arrow.prev { left: 8px; }
.slide-arrow.next { right: 8px; }
.slide-arrow:disabled { opacity: .25 !important; cursor: not-allowed; }
.slide-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 5;
}
.slide-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4); cursor: pointer;
  transition: background .2s, transform .2s;
}
.slide-dot.active { background: #fff; transform: scale(1.3); }

/* ---- Card body ---- */
.card-body-v2 {
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.card-title-v2 {
  display: flex; align-items: flex-start; gap: 5px;
  font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.card-title-v2 svg { color: var(--sky); flex-shrink: 0; margin-top: 2px; }

.card-beds-v2 {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--subtext); font-weight: 500;
}
.card-footer-v2 {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border);
  gap: 6px; /* FIX 1: ensure gap so items never touch */
  min-width: 0; /* FIX 1: allow flex children to shrink */
}
.card-agent-row { display: flex; align-items: center; gap: 6px; min-width: 0; flex-shrink: 1; }
.card-agent-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky-dark), var(--sky));
  color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-agent-name {
  font-size: 11px; font-weight: 600; color: var(--subtext);
  /* FIX 1: was 80px — too tight; use flex-basis + min-width:0 pattern */
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 0;
}
.card-verified-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 8px rgba(16,185,129,.35);
}
.card-view-btn {
  display: inline-flex; align-items: center; gap: 3px;
  background: linear-gradient(135deg, var(--sky-dark), var(--sky));
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 6px 13px; border-radius: 20px; letter-spacing: .2px;
  box-shadow: 0 2px 8px rgba(14,165,233,.35);
  transition: box-shadow .18s, transform .15s;
}
.card-view-btn:active { box-shadow: none; transform: scale(.95); }

/* ---- Listings grid ---- */
#listings-wrap {
  display: grid; grid-template-columns: 1fr; gap: 14px; padding: 2px 0;
}

/* ---- Skeleton loader ---- */
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden; height: 260px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================================================
   2. AGENT LISTING CARD — v2 horizontal design
================================================================ */
.alcard-v2 {
  display: flex; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
  transition: transform .15s, box-shadow .15s;
}
.alcard-v2:active { transform: scale(.99); }

.alcard-thumb {
  width: 115px; flex-shrink: 0;
  background: linear-gradient(140deg, #0d2040, #1a3560);
  position: relative; overflow: hidden; min-height: 130px;
}
.alcard-thumb .img-slides { width: 100%; height: 100%; }
.alcard-thumb .img-slides img { width: 100%; height: 100%; object-fit: cover; display: none; }
.alcard-thumb .img-slides img.active { display: block; }

.alcard-status-pill {
  position: absolute; bottom: 8px; left: 6px; right: 6px;
  font-size: 9px; font-weight: 800; padding: 3px 6px;
  border-radius: 20px; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.alcard-body-v2 {
  flex: 1; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.alcard-price {
  font-size: 18px; font-weight: 800; font-family: var(--serif);
  color: var(--sky); display: flex; align-items: baseline; gap: 2px;
  white-space: nowrap;
}
.alcard-price span { font-size: 11px; font-weight: 500; color: var(--subtext); font-family: var(--sans); }
.alcard-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--subtext); font-weight: 500;
}
.alcard-exp { font-size: 10px; color: var(--gold); font-weight: 700; }
.alcard-actions-v2 { display: flex; gap: 8px; margin-top: 8px; }
.alcard-edit-btn, .alcard-del-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 0; border-radius: 10px; font-size: 11px; font-weight: 700;
  transition: opacity .15s, transform .15s;
}
.alcard-edit-btn:active, .alcard-del-btn:active { transform: scale(.95); opacity: .8; }
.alcard-edit-btn {
  background: rgba(14,165,233,.1); color: var(--sky);
  border: 1px solid rgba(14,165,233,.25);
}
.alcard-del-btn {
  background: rgba(239,68,68,.08); color: #EF4444;
  border: 1px solid rgba(239,68,68,.2);
}

/* ================================================================
   3. PORTAL PLAN CARDS — inside agent dashboard
================================================================ */
.portal-plans-section {
  margin: 24px 0 8px; padding: 20px 16px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px;
}
.portal-plans-title {
  font-size: 16px; font-weight: 700; font-family: var(--serif);
  margin-bottom: 3px; display: flex; align-items: center;
}
.portal-plans-sub { font-size: 11px; color: var(--subtext); margin-bottom: 16px; }
.portal-plan-cards { display: flex; flex-direction: column; gap: 12px; }

.ppc {
  border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px; cursor: pointer; position: relative;
  background: var(--surface2);
  transition: border-color .18s, background .18s, box-shadow .18s, transform .12s;
}
.ppc:active { transform: scale(.985); }
.ppc-pop { border-color: rgba(14,165,233,.35); background: rgba(14,165,233,.04); }

/* Selection state — primary visual indicator */
.ppc-sel {
  border-color: var(--sky) !important;
  background: rgba(14,165,233,.1) !important;
  box-shadow: 0 0 0 3px rgba(14,165,233,.18), 0 4px 16px rgba(14,165,233,.12);
}
.ppc-current { border-color: rgba(16,185,129,.5) !important; }

.ppc-popular {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--sky); color: #fff;
  font-size: 9px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  padding: 3px 12px; border-radius: 20px; white-space: nowrap;
}
.ppc-your-plan {
  position: absolute; top: -12px; right: 14px;
  background: #10B981; color: #fff;
  font-size: 9px; font-weight: 800; letter-spacing: .4px;
  padding: 3px 10px; border-radius: 20px;
}
.ppc-name  { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.ppc-price {
  font-size: 24px; font-weight: 800; font-family: var(--serif);
  color: var(--sky); display: flex; align-items: baseline; gap: 3px; margin-bottom: 2px;
}
.ppc-price span { font-size: 11px; font-weight: 500; color: var(--subtext); font-family: var(--sans); }
.ppc-limit {
  font-size: 10px; font-weight: 700; color: var(--subtext);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.ppc-feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ppc-feats li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text); }
.ppc-feats svg { color: var(--sky); flex-shrink: 0; }

/* ================================================================
   4. EDIT MODE BANNER
================================================================ */
.edit-mode-banner {
  background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3);
  border-radius: 10px; padding: 10px 14px;
  font-size: 12px; color: #F59E0B;
  margin-bottom: 12px;
  display: none; align-items: center; gap: 8px;
}
.edit-mode-banner.visible { display: flex; }
.edit-mode-banner button {
  margin-left: auto; font-size: 10px; color: inherit; opacity: .7;
  background: none; border: 1px solid currentColor; border-radius: 6px; padding: 2px 8px;
}

/* ================================================================
   5. VERIFIED BADGE REDESIGN
================================================================ */
.verified-inline-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(16,185,129,.18), rgba(5,150,105,.28));
  color: #34D399; border: 1px solid rgba(52,211,153,.35);
  border-radius: 20px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; vertical-align: middle;
  margin-left: 4px; box-shadow: 0 0 8px rgba(52,211,153,.15);
}
.meta-badge.verified, .meta-badge.green {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(16,185,129,.15), rgba(5,150,105,.25));
  color: #34D399; border: 1px solid rgba(52,211,153,.4);
  border-radius: 20px; padding: 3px 8px;
  font-size: 10px; font-weight: 700; box-shadow: 0 0 6px rgba(52,211,153,.1);
}

/* ================================================================
   6. AGENT PLAN LABEL
================================================================ */
#agent-plan-label {
  font-size: 12px; color: var(--subtext);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 2px;
}

/* ================================================================
   7. HERO SELECT — Android-safe option colours
================================================================ */
.hero-select { color: #E0F2FE !important; }
.hero-select option { background: #0F172A; color: #E0F2FE; }
.hero-select-hint {
  font-size: 9px; color: rgba(224,242,254,.45);
  margin-top: -4px; margin-bottom: 4px; padding-left: 2px;
}

/* ================================================================
   8. THEME TOGGLE — SVG icon, no emoji
================================================================ */
#theme-toggle-t, #theme-toggle-a, .theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: background .2s; flex-shrink: 0;
}
#theme-toggle-t:active, #theme-toggle-a:active { background: rgba(255,255,255,.16); }

/* ================================================================
   9. LOGO
================================================================ */
.nav-logo-img, .theme-logo { height: 30px; width: auto; object-fit: contain; }
#land-logo-img { height: 28px; width: auto; }
.land-topbar { background: rgba(10,25,47,.96); }

/* ================================================================
   10. GENERAL UTILITY
================================================================ */
.auth-title { margin-top: 16px !important; }
.land-topbar-actions { display: none; }
.land-pricing-section { display: none !important; }
.card-price-pill, .alcard-price { white-space: nowrap; }
.meta-agent { display: none; }       /* old agent name style — replaced by card-agent-row */
