/**
 * SAVED LISTINGS PAGE — CSS
 * =========================
 * Styles for /account#saved (saved listings grid).
 * All classes prefixed `sv-` to avoid collisions.
 * Hosted on R2: ld/saved-listings.css
 */

/* ── Page Layout ── */
.sv-page {
  font-family: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #1a1a1a;
}

/* ── Header ── */
.sv-hdr {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.sv-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f0f0f;
  margin: 0;
  line-height: 1.2;
}
.sv-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

/* ── Grid ── */
.sv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ── Card ── */
.sv-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform 0.25s cubic-bezier(.22,.68,0,1), box-shadow 0.25s cubic-bezier(.22,.68,0,1), opacity 0.3s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}
.sv-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}

/* Remove animation — collapse + fade + scale */
.sv-card.removing {
  opacity: 0;
  transform: scale(0.88) translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(.22,.68,0,1);
}
.sv-card.collapsing {
  max-height: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  border-width: 0 !important;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(.22,.68,0,1), margin 0.4s ease, padding 0.3s ease, border-width 0.3s ease;
}

/* ── Card Entrance Animation ── */
@keyframes sv-card-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.sv-card.sv-in {
  animation: sv-card-in 0.55s cubic-bezier(.22,.68,0,1) both;
}

/* ── Card Image ── */
.sv-img {
  position: relative;
  padding-top: 62%;
  background-color: #f5f5f4;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(.22,.68,0,1);
}
.sv-card:hover .sv-img {
  transform: scale(1.06);
}
.sv-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,.12), transparent);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.sv-card:hover .sv-img::after {
  opacity: 0.7;
}

/* ── Remove Button ── */
.sv-rm {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
  z-index: 2;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.sv-rm:hover {
  background: #fff;
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.sv-rm svg {
  width: 16px;
  height: 16px;
  fill: #c8102e;
  stroke: #c8102e;
  stroke-width: 1.5;
}

/* ── Card Body ── */
.sv-body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.sv-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f0f0f;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.sv-addr {
  font-size: 0.85rem;
  color: #4b5563;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.sv-stats {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
}
.sv-meta {
  font-size: 0.73rem;
  color: #9ca3af;
  margin-top: 2px;
  letter-spacing: 0.01em;
}

/* ── Status Badge ── */
.sv-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sv-badge-active {
  background: rgba(5,150,105,.92);
  color: #fff;
}
.sv-badge-sold {
  background: rgba(200,16,46,.92);
  color: #fff;
}
.sv-badge-pending {
  background: rgba(217,119,6,.92);
  color: #fff;
}

/* ── Loading Skeletons ── */
.sv-skel {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
}
.sv-skel-img {
  padding-top: 62%;
  background: linear-gradient(110deg, #f5f5f4 30%, #ebebea 50%, #f5f5f4 70%);
  background-size: 250% 100%;
  animation: sv-shimmer 1.8s ease-in-out infinite;
}
.sv-skel-body {
  padding: 14px 16px 18px;
}
.sv-skel-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(110deg, #f5f5f4 30%, #ebebea 50%, #f5f5f4 70%);
  background-size: 250% 100%;
  animation: sv-shimmer 1.8s ease-in-out infinite;
  margin-bottom: 10px;
}
.sv-skel-line:nth-child(1) { width: 45%; height: 16px; }
.sv-skel-line:nth-child(2) { width: 75%; animation-delay: 0.1s; }
.sv-skel-line:nth-child(3) { width: 55%; animation-delay: 0.2s; }

@keyframes sv-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty / Login / Error State Entrance ── */
@keyframes sv-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty State ── */
.sv-empty {
  text-align: center;
  padding: 64px 24px;
  animation: sv-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.sv-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  color: #d1d5db;
  opacity: 0.7;
}
.sv-empty-icon svg {
  width: 100%;
  height: 100%;
}
.sv-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.sv-empty p {
  font-size: 0.88rem;
  color: #6b7280;
  margin: 0 0 28px;
  line-height: 1.6;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.sv-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: #0f0f0f;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.sv-empty-btn:hover {
  background: #262626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.sv-empty-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Logged-Out State ── */
.sv-login {
  text-align: center;
  padding: 64px 24px;
  animation: sv-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.sv-login-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  color: #d1d5db;
  opacity: 0.7;
}
.sv-login-icon svg {
  width: 100%;
  height: 100%;
}
.sv-login h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.sv-login p {
  font-size: 0.88rem;
  color: #6b7280;
  margin: 0 0 28px;
  line-height: 1.6;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.sv-login-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.sv-login-btn {
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.22,.68,0,1);
  text-decoration: none;
  border: none;
}
.sv-login-btn-primary {
  background: #c8102e;
  color: #fff;
  border: 1px solid #c8102e;
  box-shadow: 0 1px 3px rgba(200,16,46,.2);
}
.sv-login-btn-primary:hover {
  background: #a30d25;
  border-color: #a30d25;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200,16,46,.25);
}
.sv-login-btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
}
.sv-login-btn-secondary:hover {
  border-color: #1a1a1a;
  transform: translateY(-1px);
}

/* ── Error State ── */
.sv-error {
  text-align: center;
  padding: 64px 24px;
  animation: sv-fade-up 0.5s cubic-bezier(.22,.68,0,1) both;
}
.sv-error h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 8px;
}
.sv-error p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 20px;
  line-height: 1.5;
}
.sv-error-btn {
  padding: 10px 24px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sv-error-btn:hover {
  border-color: #1a1a1a;
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .sv-page {
    width: 100%;
  }
  .sv-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    width: 100%;
  }
  .sv-card {
    width: 100%;
    max-width: 100%;
  }
  #saved-content {
    width: 100%;
  }
}
@media (max-width: 767px) {
  .sv-card {
    border-radius: 12px;
  }
  .sv-title {
    font-size: 1.25rem;
  }
  .sv-login-btns {
    flex-direction: column;
  }
  .sv-login-btn {
    width: 100%;
    text-align: center;
  }
}
