<style>
    .vps-section {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 20px;
        gap: 15px;
        background: #f9f9f9;

        /* Hide scrollbar across browsers */
        scrollbar-width: none;        /* Firefox */
        -ms-overflow-style: none;     /* IE and Edge */
    }

    .vps-section::-webkit-scrollbar {
        display: none;                /* Chrome, Safari, Opera */
    }

    .vps-card {
        flex: 0 0 auto;               /* Prevent shrinking and force fixed width */
        width: 150px;
        background: #fff;
        border-radius: 6px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        padding: 16px;
        text-align: left;
        position: relative;
        font-family: Arial, sans-serif;
    }

    .vps-tag {
        position: absolute;
        top: 10px;
        left: 40px;margin-right:30px;
        background: #d9b96e;
        color: #fff;
        font-size: 11px;
        padding: 3px 8px;
        border-top-left-radius: 6px;
        border-bottom-right-radius: 6px;
        font-weight: bold;
    }

    .vps-star {
    position: absolute;
    top: -18px;
    
    right: 10px;
    width: 27px;
    /* background: #e0f3ff; */
    color: #007bff;
    font-size: 22px;
    font-size: 40;
    /* border-radius: 6px; */
    /* padding: 4px 6px; */
}

    .vps-title {
        font-weight: bold;
        font-size: 15px;
        margin: 40px 0 6px;
    }

    .vps-specs {
        color: #555;
        font-size: 12px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    .btn-vps {
        background-color: #2e6be6;
        color: white;
        text-align: center;
        padding: 8px 0;
        border-radius: 6px;
        text-decoration: none;
        font-size: 13px;
        display: block;
        transition: background 0.2s;
    }

    .btn-vps:hover {
        background-color: #1a4fbf;
    }

    /* Make cards adapt on smaller screens */
    @media (max-width: 480px) {
        .vps-card {
            width: 130px;
            padding: 12px;
        }

        .vps-title {
            font-size: 14px;
        }

        .btn-vps {
            font-size: 12px;
            padding: 6px 0;
        }
    }
</style>

<?php include "config.php";?>
<div class="vps-section">
<?php
$stmt = $dbh->prepare("SELECT * FROM brokers LIMIT 5");
$stmt->execute();
$brokers = $stmt->fetchAll(PDO::FETCH_ASSOC);
$index = 0;

foreach ($brokers as $broker):
    // Determine button label and class
    if ($index === 0) {
        $btnText = 'Open for free';
        $btnClass = 'btn-vps';
    } else {
        $btnText = $index % 2 === 0 ? 'VPS Ultra' : 'VPS Pro';
        $btnClass = 'btn-vps no-bg';
    }
?>
    <div class="vps-card">
        <div class="vps-tag"><?= $index === 0 ? 'EA VPS' : 'Free' ?></div>
        <div class="vps-star">★</div>
        <div class="vps-title"><?= htmlspecialchars($broker['name']) ?> VPS</div>
        <div class="vps-specs">
            <?= htmlspecialchars($broker['software']) ?>*CPU /
            <?= htmlspecialchars($broker['license']) ?>*RAM /
            <?= htmlspecialchars($broker['average_transaction']) ?>*HDD /
            1M*ADSL
        </div>
        <a href="avatrade.php?name=<?= urlencode(strtolower($broker['name'])) ?>" class="<?= $btnClass ?>" target="_blank">
            <?= $btnText ?>
        </a>
    </div>
<?php
$index++;
endforeach;
?>
</div>
