/**
 * design-v2.css — Phase 6 design upgrade (additive, conversion-focused)
 *
 * Philosophy: improve clarity, trust, and tap-conversion without rewriting
 * existing styles. Loaded AFTER portal.css + layout.css so it wins on specificity.
 * No new frameworks, no new fonts, no animation-for-animation's-sake.
 *
 * Scoped to .portal-app wherever possible to avoid leaking into marketing pages.
 */

/* ─────────────────────────────────────────────────────────────────────────
   1. PROPERTY CARD — hierarchy, price prominence, spacing
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .property-card {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.portal-app .property-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
    border-color: #c7d2fe;
}

/* Image ratio: 4:3 reads stronger on mobile than 16:9 thumbnails */
.portal-app .card-img-wrap {
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
}
.portal-app .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card body: tighter vertical rhythm */
.portal-app .card-body {
    padding: .95rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

/* Price — the most important element on the card */
.portal-app .card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: #047857;
    letter-spacing: -.01em;
    line-height: 1.2;
    margin: 0;
}
@media (max-width: 768px) {
    .portal-app .card-price { font-size: 1.08rem; }
}

.portal-app .card-title {
    font-size: .93rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    margin: 0;
    max-height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.portal-app .card-title a { color: inherit; text-decoration: none; }
.portal-app .card-title a:hover { color: #4f46e5; }

.portal-app .card-meta {
    font-size: .82rem;
    color: #64748b;
    margin: 0;
}

.portal-app .card-curiosity {
    font-size: .78rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: .25rem .55rem;
    margin: 0;
    display: inline-block;
    align-self: flex-start;
}

/* Card tags: cleaner pills */
.portal-app .card-tags { gap: .35rem; margin: .15rem 0 .1rem; }
.portal-app .card-tag {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    padding: .22rem .55rem;
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 500;
}
.portal-app .card-tag-inst {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.portal-app .card-view-details {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    align-self: flex-start;
    font-size: .83rem;
    color: #4f46e5;
    font-weight: 700;
    text-decoration: none;
    padding: .4rem .75rem .4rem .85rem;
    margin-top: .2rem;
    border: 1.5px solid #e0e7ff;
    background: #eef2ff;
    border-radius: 8px;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.portal-app .card-view-details:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    text-decoration: none;
    transform: translateX(2px);
}
.portal-app .card-view-details svg { flex-shrink: 0; }

/* Soft curiosity line — used as always-on fallback */
.portal-app .card-curiosity-soft {
    background: #f8fafc;
    color: #475569;
    border-color: #e2e8f0;
}

/* Updated-recently chip on card thumb (uses same position as social-mini) */
.portal-app .card-social-fresh {
    background: rgba(79, 70, 229, .94);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(79, 70, 229, .25);
}

/* ─────────────────────────────────────────────────────────────────────────
   2. CONTACT BUTTONS — thumb-friendly, WhatsApp primary
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .card-actions {
    margin-top: .5rem;
    display: flex;
    gap: .5rem;
    align-items: stretch;
}
.portal-app .card-wa-wrap { flex: 1 1 auto; display: flex; }

.portal-app .btn-contact {
    min-height: 44px;                /* Apple/Google thumb-target minimum */
    padding: .7rem 1rem;
    font-size: .9rem;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.portal-app .btn-contact:active { transform: scale(.97); }

/* WhatsApp — primary action */
.portal-app .btn-whatsapp,
.portal-app .btn-wa-primary {
    background: #25D366;
    color: #fff;
    border: 0;
    flex: 1 1 auto;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(37, 211, 102, .25);
}
.portal-app .btn-whatsapp:hover,
.portal-app .btn-wa-primary:hover {
    background: #1ebe57;
    box-shadow: 0 4px 14px rgba(37, 211, 102, .38);
    color: #fff;
}

/* Call — secondary, clear but subordinate */
.portal-app .btn-call,
.portal-app .btn-call-secondary {
    background: #fff;
    color: #1a365d;
    border: 1.5px solid #cbd5e1;
    flex: 0 0 auto;
    min-width: 96px;
}
.portal-app .btn-call:hover,
.portal-app .btn-call-secondary:hover {
    border-color: #1a365d;
    background: #f8fafc;
    color: #1a365d;
}

/* ─────────────────────────────────────────────────────────────────────────
   3. ACTIVE FILTERS BAR — chips showing currently applied filters
   ───────────────────────────────────────────────────────────────────────── */

.active-filters-bar {
    display: none;                   /* shown by JS when filters exist */
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    padding: .7rem 1.25rem;
    max-width: 1280px;
    margin: 0 auto;
    border-bottom: 1px solid #e5e7eb;
    background: #fafbff;
}
.active-filters-bar.has-filters { display: flex; }
.active-filters-bar .afb-label {
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: .25rem;
}
.active-filters-bar .afb-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: .32rem .8rem .32rem .9rem;
    font-size: .82rem;
    font-weight: 500;
    transition: background .15s ease;
}
.active-filters-bar .afb-chip button {
    background: none;
    border: 0;
    color: #4f46e5;
    cursor: pointer;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    margin-left: .15rem;
}
.active-filters-bar .afb-chip:hover { background: #e0e7ff; }
.active-filters-bar .afb-clear-all {
    margin-left: auto;
    background: none;
    border: 0;
    color: #dc2626;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    padding: .25rem .5rem;
}
.active-filters-bar .afb-clear-all:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────────────────────
   4. FILTER SIDEBAR — desktop sticky polish + mobile bottom sheet
   ───────────────────────────────────────────────────────────────────────── */

/* Desktop: subtle sticky shadow, rounded corners */
@media (min-width: 901px) {
    .portal-app .filter-sidebar {
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    }
}

/* Mobile: convert left-drawer into bottom sheet (thumb-reachable) */
@media (max-width: 900px) {
    .portal-app .filter-sidebar {
        left: 0 !important;
        right: 0;
        top: auto;
        bottom: -100%;
        width: 100%;
        max-width: none;
        max-height: 85vh;
        height: auto;
        border-radius: 18px 18px 0 0;
        border-top: 1px solid #e5e7eb;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        padding: .9rem 1.1rem 6rem;
        transition: bottom .28s cubic-bezier(.22, 1, .36, 1);
        box-shadow: 0 -8px 28px rgba(15, 23, 42, .18);
        z-index: 400;
    }
    .portal-app .filter-sidebar.open {
        left: 0 !important;
        bottom: 0;
    }
    .portal-app .filter-sidebar-backdrop {
        z-index: 399;
        background: rgba(15, 23, 42, .5);
    }
    /* Drag handle for clarity */
    .portal-app .filter-sidebar::before {
        content: '';
        display: block;
        width: 42px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 2px;
        margin: 0 auto .8rem;
    }
    /* Apply button fixed at bottom of sheet for instant confirmation */
    .portal-app .filter-sheet-apply {
        display: block;
        position: sticky;
        bottom: 0;
        left: 0; right: 0;
        margin: 1rem -1.1rem -5.5rem;
        padding: .9rem 1.1rem calc(.9rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #e5e7eb;
    }
    .portal-app .filter-sheet-apply button {
        width: 100%;
        min-height: 48px;
        background: #4f46e5;
        color: #fff;
        border: 0;
        border-radius: 10px;
        font-weight: 700;
        font-size: 1rem;
    }
}
@media (min-width: 901px) {
    .portal-app .filter-sheet-apply { display: none; }
}

/* Filter toggle button — more prominent, thumb-friendly */
.portal-app .filter-toggle-btn {
    min-height: 44px;
    padding: .55rem 1rem;
    font-weight: 600;
    border-radius: 8px;
}

/* ─────────────────────────────────────────────────────────────────────────
   5. LISTINGS GRID — breathing room
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.15rem;
}
@media (max-width: 600px) {
    .portal-app .listings-grid {
        grid-template-columns: 1fr;
        gap: .9rem;
    }
}

.portal-app .listings-toolbar {
    padding: .3rem 0 1rem;
}
.portal-app .results-count {
    font-weight: 600;
    color: #1e293b;
}

/* ─────────────────────────────────────────────────────────────────────────
   6. VERIFIED / TRUST BADGES — more visible
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .card-verified-badge {
    background: rgba(16, 185, 129, .96);
    color: #fff;
    padding: .22rem .55rem;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.portal-app .card-verified-badge svg { color: #fff; }

/* ─────────────────────────────────────────────────────────────────────────
   7. PROPERTY DETAIL PAGE — contact card prominence
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .detail-contact-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.4rem 1.3rem;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
}
.portal-app .contact-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 .3rem;
}
.portal-app .contact-card-sub {
    font-size: .88rem;
    color: #475569;
    margin: 0 0 1rem;
    line-height: 1.5;
}
.portal-app .contact-card-actions {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.portal-app .contact-card-actions .btn-contact,
.portal-app .contact-card-actions .btn-contact-lg {
    min-height: 50px;
    font-size: 1rem;
    font-weight: 700;
    width: 100%;
}

/* Sticky CTA on mobile property page — already exists, polish tap targets */
.portal-app .sticky-cta-btns .btn-contact {
    min-height: 48px;
    font-size: .95rem;
    font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────────
   8. QUICK FILTER CHIPS — more tactile, scroll cleanly
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .qf-chip {
    min-height: 38px;
    padding: .4rem .95rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .85rem;
}
.portal-app .qf-chip.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* ─────────────────────────────────────────────────────────────────────────
   9. HERO + SEARCH — clarity
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .search-bar {
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
    border: 1px solid #e5e7eb;
}
.portal-app .search-bar input {
    font-size: 1rem;
    min-height: 48px;
}
.portal-app .search-btn {
    min-height: 44px;
    font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────────
   10. ACCESSIBILITY + FOCUS
   ───────────────────────────────────────────────────────────────────────── */

.portal-app .btn-contact:focus-visible,
.portal-app .qf-chip:focus-visible,
.portal-app .afb-chip button:focus-visible,
.portal-app .filter-toggle-btn:focus-visible {
    outline: 3px solid #818cf8;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .portal-app .property-card,
    .portal-app .btn-contact,
    .portal-app .filter-sidebar {
        transition: none !important;
    }
    .portal-app .property-card:hover { transform: none; }
}
