<?php if (!defined('ABSPATH')) exit; ?>
<?php
/**
 * Minimal - Archive Card Template
 *
 * Typography-focused. No heavy borders or shadows. Thin bottom border.
 * Small image (16/9). Large title, small gray meta text. Elegant, professional.
 * Hover: accent color underline on title.
 *
 * @package Integrate_Palace_Properties
 */

$prop      = new IPP_Property_Helper();
$featured  = $prop->featured_image('large');
$permalink = get_permalink();
?>
<article class="ipp-card ipp-card--minimal"
         style="border:none;box-shadow:none;border-bottom:1px solid var(--ipp-color-gray-200,#e5e7eb);border-radius:0;padding-bottom:1.5rem;margin-bottom:1.5rem;background:transparent;"
         aria-label="<?php echo esc_attr($prop->name()); ?>">

    <?php if ($featured) : ?>
        <a href="<?php echo esc_url($permalink); ?>" class="ipp-card__image" style="display:block;margin-bottom:1rem;">
            <img src="<?php echo esc_url($featured['url']); ?>"
                 alt="<?php echo esc_attr($featured['alt'] ?: $prop->name()); ?>"
                 loading="lazy"
                 style="width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:var(--ipp-radius,4px);">
        </a>
    <?php endif; ?>

    <div class="ipp-card__body" style="padding:0;">
        <?php if ($prop->show('rent') && $prop->formatted_rent()) : ?>
            <p class="ipp-card__price" style="font-size:0.8125rem;font-weight:600;color:var(--ipp-color-primary,#2563eb);margin:0 0 0.375rem;letter-spacing:0.05em;text-transform:uppercase;">
                <?php echo esc_html($prop->formatted_rent()); ?>
                <?php if ($prop->rental_period()) : ?>
                    <span style="font-weight:400;color:var(--ipp-color-gray-400,#9ca3af);">/ <?php echo esc_html($prop->rental_period()); ?></span>
                <?php endif; ?>
            </p>
        <?php endif; ?>

        <h3 class="ipp-card__title" style="font-size:1.375rem;margin:0 0 0.375rem;line-height:1.3;">
            <a href="<?php echo esc_url($permalink); ?>"
               style="text-decoration:none;border-bottom:2px solid transparent;transition:border-color 0.2s ease;display:inline;"
               onmouseenter="this.style.borderColor='var(--ipp-color-primary,#2563eb)';"
               onmouseleave="this.style.borderColor='transparent';">
                <?php echo esc_html(get_the_title()); ?>
            </a>
        </h3>

        <?php if ($prop->show('address') && $prop->short_address()) : ?>
            <p class="ipp-card__address" style="color:var(--ipp-color-gray-400,#9ca3af);font-size:0.875rem;margin:0 0 0.75rem;">
                <?php echo esc_html($prop->short_address()); ?>
            </p>
        <?php endif; ?>

        <div class="ipp-card__meta" style="color:var(--ipp-color-gray-400,#9ca3af);font-size:0.8125rem;">
            <?php if ($prop->show('bedrooms') && $prop->bedrooms()) : ?>
                <span class="ipp-card__meta-item" aria-label="<?php echo esc_attr($prop->bedrooms()); ?> bedrooms">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 7v11a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7"/><path d="M21 11H3V9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v2z"/><path d="M7 7V5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2"/></svg>
                    <?php echo esc_html($prop->bedrooms()); ?>
                </span>
            <?php endif; ?>
            <?php if ($prop->show('bathrooms') && $prop->bathrooms()) : ?>
                <span class="ipp-card__meta-item" aria-label="<?php echo esc_attr($prop->bathrooms()); ?> bathrooms">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M4 12h16a1 1 0 0 1 1 1v3a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4v-3a1 1 0 0 1 1-1z"/><path d="M6 12V5a2 2 0 0 1 2-2h1"/></svg>
                    <?php echo esc_html($prop->bathrooms()); ?>
                </span>
            <?php endif; ?>
            <?php if ($prop->show('cars') && $prop->cars()) : ?>
                <span class="ipp-card__meta-item" aria-label="<?php echo esc_attr($prop->cars()); ?> car spaces">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M5 17h14M5 17a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1l2-3h8l2 3h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2"/><circle cx="7.5" cy="15.5" r="1.5"/><circle cx="16.5" cy="15.5" r="1.5"/></svg>
                    <?php echo esc_html($prop->cars()); ?>
                </span>
            <?php endif; ?>
            <?php if ($prop->show('property_class') && $prop->property_class()) : ?>
                <span class="ipp-card__meta-item">
                    <?php echo esc_html($prop->property_class()); ?>
                </span>
            <?php endif; ?>
        </div>
    </div>

</article>
