.contact-card{

background:linear-gradient(135deg,#1e3a8a,#2563eb);

padding:22px;

border-radius:18px;

box-shadow:0 10px 25px rgba(37,99,235,.18);

text-align:center;

}

.contact-title{

margin:0;

font-size:18px;

font-weight:700;

color:#fff;

}

.contact-price{

display:inline-block;

margin:15px 0;

padding:6px 14px;

background:rgba(255,255,255,.12);

border-radius:8px;

color:#dbeafe;

font-size:13px;

font-weight:700;

}

.contact-phone{

font-size:24px;

font-weight:700;

letter-spacing:1px;

color:#fff;

margin-bottom:20px;

}

.contact-btn{

display:block;

width:100%;

padding:14px;

border-radius:10px;

text-decoration:none;

font-weight:700;

margin-bottom:10px;

transition:.25s;

}

.call-btn{

background:#fff;

color:#2563eb;

}

.chat-btn{

background:#16a34a;

color:#fff;

}

.login-btn{

background:#fff;

color:#2563eb;

}

.share-btn{

background:#7c3aed;

color:#fff;

border:none;

cursor:pointer;

}

.contact-btn:hover{

transform:translateY(-2px);

}

@media(max-width:768px){

.contact-phone{

font-size:20px;

}

.contact-btn{

padding:13px;

font-size:15px;

}

}


<div class="contact" style="background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); padding: 24px; border-radius: 20px; box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);">
    <h3 style="font-size: 16px; font-weight: 800; color: #fff; margin-bottom: 5px;">👑 Verified Deal Desk</h3>
    
    <?php 
    $raw_contact = $p['contact'] ?? '';
    $phone_num = preg_replace('/[^0-9]/', '', $raw_contact); 
    $is_logged_in = isset($_SESSION['user_id']);
    
    // స్పామర్లు కోడ్ నుండి నంబర్ దొంగిలించకుండా లాస్ట్ 5 డిజిట్స్ కచ్చితంగా ప్రైవసీ మాస్క్ చేయడం
    if (!$is_logged_in && strlen($phone_num) >= 10) {
        $display_contact = substr($phone_num, 0, 5) . "XXXXX";
    } else {
        $display_contact = $raw_contact;
    }

    // అమౌంట్ లేకపోతే ఇక్కడ కూడా సిస్టమ్ "Ask Owner" అని క్లీన్ గా చూపిస్తుంది
    $sidebar_price_label = (isset($p['price']) && floatval($p['price']) > 0) ? "Valuation: ₹" . number_format($p['price']) : "Valuation: Ask Owner";
    ?>

    <div style="font-size: 12px; color: #bfdbfe; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; background: rgba(255,255,255,0.1); padding: 4px 12px; border-radius: 6px; display: inline-block;">
        <?= $sidebar_price_label ?>
    </div>
    
    <p style="font-size: 1.4rem; letter-spacing: 1.5px; font-weight: 900; color: #fff; margin: 8px 0;">
        <?= htmlspecialchars($display_contact ?: 'Not available') ?>
    </p>
    
    <?php if(!empty($phone_num)): ?>
        <?php if($is_logged_in): ?>
            <a href="tel:+91<?= $phone_num ?>" class="call-btn" style="background:#fff; color:#2563eb; width:80%; margin-bottom:10px;">📞 Call Now</a>
            
            <?php
            // ఇక్కడ పాతది తీసేసి సరిచేయబడినది:
            $price_display = (isset($p['price']) && floatval($p['price']) > 0) ? "₹" . number_format($p['price']) : "Ask Owner";
            $wa_text = "Hi, I am interested in your property: " . $p['title'] . 
                       " (Price: " . $price_display . ")." . 
                       "\nFound this on Real Property Buy Sell." .
                       "\nLink: " . $friendly_url;
            $wa_link = "https://wa.me/91" . $phone_num . "?text=" . urlencode($wa_text);
            ?>
            <a href="<?= $wa_link ?>" target="_blank" class="call-btn" style="background:#25d366; color:#fff; border:none; width:80%;">
                <img src="https://cdn-icons-png.flaticon.com/128/3670/3670051.png" width="15" style="vertical-align:middle"> WhatsApp Me
            </a>

        <?php else: ?>
            <p style="font-size:11px; margin-bottom:10px;">(Login to view full number)</p>
            <a href="/login.php" class="call-btn" style="background:#fff; color:#2563eb; width:80%;" onclick="return alert('Please login first to see the full details!');">🔓 Login to Contact Owner</a>
        <?php endif; ?>

        <div class="share-container">
            <button onclick="shareProperty()" class="share-btn" id="shareBtn" style="margin-top:15px;">
                🚀 Share This Post Now (Best Deal)
            </button>
        </div>
    <?php endif; ?>
</div>
        </div>
    </div>
</div>