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

/* ── SKELETON CARDS ──────────────────────────────────────── */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
}
.skel-shimmer {
    background: linear-gradient(90deg,
        var(--surface) 25%,
        var(--border-light) 50%,
        var(--surface) 75%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    background-color: var(--surface);
    animation: skel-shimmer 1.4s infinite linear;
}
.skel-img  { height: 240px; }
.skel-body { padding: 14px 16px 16px; }
.skel-line {
    border-radius: 4px;
    margin-bottom: 8px;
}
.skel-title { height: 16px; width: 70%; }
.skel-loc   { height: 12px; width: 50%; }
.skel-specs {
    height: 12px;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 12px;
}
.skel-btns { display: flex; gap: 8px; margin-top: 4px; }
.skel-btn  { flex: 1; height: 36px; border-radius: 7px; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
    position: relative;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    border-color: var(--border-light);
}
.card--aging,
.card--stale { transition: opacity 0.2s ease-in-out; }
.card--aging:hover,
.card--stale:hover { opacity: 1; }
.card--aging { opacity: 0.85; }
.card--stale { opacity: 0.65; }
.stale-badge.aging-badge { background: rgba(180, 130, 20, 0.8); }

.card-img-container {
    position: relative;
    cursor: pointer;
}
.card-img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    background-color: var(--surface-2);
}

/* Price overlay on image */
.card-price-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 12px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}
.card-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    line-height: 1.2;
}
.card-price-usd {
    display: block;
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.82;
    margin-top: 2px;
}
.map-list-card-price-usd {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 3px;
}
.type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    pointer-events: none;
}
.badge-sale      { background: var(--sale-color); color: #fff; }
.badge-rent      { background: var(--rent-color); color: #fff; }
.badge-sale_rent { background: var(--dual-color); color: #fff; }

.multi-source-badge {
    font-size: 0.7rem;
    color: var(--accent);
    margin-top: 4px;
}

.featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent);
    color: var(--on-accent);
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 2;
}
.stale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 4px;
    background: rgba(0,0,0,0.75);
    color: #f0c040;
    pointer-events: none;
    letter-spacing: 0.03em;
}

/* Save button */
.save-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    transition: background 0.15s, transform 0.1s;
    color: rgba(255,255,255,0.8);
    z-index: 2;
}
.save-btn:hover  { background: rgba(0,0,0,0.75); transform: scale(1.1); }
.save-btn.saved  { color: #e74c3c; background: rgba(0,0,0,0.7); }

/* Saved filter tab */
.saved-tab {
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.saved-tab:hover, .saved-tab.active {
    background: #3d1515;
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Photo count */
.img-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.65);
    color: rgba(255,255,255,0.9);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.video-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.65);
    color: rgba(255,255,255,0.9);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

/* Verification badges */
.verify-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
    margin: 8px 0;
    position: relative;
}
.verify-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    width: 220px;
    padding: 8px 10px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10;
    pointer-events: none;
}
.verify-badge:hover .verify-tip,
.verify-badge:focus .verify-tip {
    display: block;
}
.verify-cross {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.verify-source {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.3);
}
.verify-basic {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
/* Light mode overrides (default is dark) */
:root.light .verify-cross  { background: rgba(34, 139, 34, 0.1); color: #1a7a1a; border-color: rgba(34, 139, 34, 0.25); }
:root.light .verify-source { background: rgba(59, 130, 246, 0.08); color: #2563eb; border-color: rgba(59, 130, 246, 0.2); }
:root.light .verify-basic  { background: rgba(156, 163, 175, 0.1); }

/* Delete button */
.delete-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(192, 57, 43, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    backdrop-filter: blur(2px);
}
body.admin-mode .delete-btn { display: flex; }
body.admin-mode .save-btn   { display: none; }
.delete-btn:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

/* Card body */
.card-content {
    padding: 14px 16px 16px;
    cursor: pointer;
}
.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-location {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-location.has-map { cursor: pointer; }
.card-location.has-map:hover { color: var(--accent); }
.card-location.has-map::after {
    content: '🗺';
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 2px;
}
.card-specs {
    display: flex;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.age-badge {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.spec-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.broker-code {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.btn-group {
    display: flex;
    gap: 8px;
}
.contact-btn {
    flex: 1;
    text-align: center;
    padding: 9px 0;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    color: var(--text-secondary);
}
.contact-btn:hover {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}
.wa-btn {
    background: #1a3d2a;
    border-color: #2d6a4f;
    color: #4ade80;
}
.wa-btn:hover {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}
.tg-btn {
    background: #0d2a40;
    border-color: #1a5276;
    color: #5dade2;
}
.tg-btn:hover {
    background: #229ED9;
    border-color: #229ED9;
    color: #fff;
}

/* ── SCROLL SENTINEL ─────────────────────────────────────── */
.scroll-sentinel {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
}
.scroll-sentinel .spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.scroll-sentinel.loading .spinner { display: block; }
