<div class="lootbox lootbox-case">
    <div class="lootbox-case-window">
        <div class="lootbox-case-spinnable" data-speed="6000">
            <?php foreach ($items as $index => $item): ?>
                <?php if ($index >= count($items) - 2): ?>
                    <div class="lootbox-case-item" id="item-<?= $index ?>" style="<?= $item['rarity'] ? 'background-color:' .  $item['rarity'] : '' ?>">
                        <div class="name"><?= util('Item')->name($item['section'], $item['idx']) ?></div>
                        <div class="image">
                            <img src="<?= util('Item')->image($item['section'], $item['idx']) ?>" />
                        </div>
                    </div>
                <?php endif ?>
            <?php endforeach ?>

            <?php foreach ($items as $index => $item): ?>
                <div class="lootbox-case-item" id="item-<?= $index ?>" style="<?= $item['rarity'] ? 'background-color:' .  $item['rarity'] : '' ?>">
                    <div class="name"><?= util('Item')->name($item['section'], $item['idx']) ?></div>
                    <div class="image">
                        <img src="<?= util('Item')->image($item['section'], $item['idx']) ?>" />
                    </div>
                </div>
            <?php endforeach ?>

            <?php foreach ($items as $index => $item): ?>
                <?php if ($index < ceil(count($items) / 2)): ?>
                    <div class="lootbox-case-item" id="item-<?= $index ?>" style="<?= $item['rarity'] ? 'background-color:' .  $item['rarity'] : '' ?>">
                        <div class="name"><?= util('Item')->name($item['section'], $item['idx']) ?></div>
                        <div class="image">
                            <img src="<?= util('Item')->image($item['section'], $item['idx']) ?>" />
                        </div>
                    </div>
                <?php endif ?>
            <?php endforeach ?>
        </div>
        <div class="lootbox-case-line"></div>
        <div class="lootbox-case-shadow"></div>
    </div>

    <div class="align-center">
        <div class="lootbox-price">
            <?= $box['amount'] ?> <?= util('Coin')->name($box['coin']) ?>
        </div>

        <div class="lootbox-actions">
            <a class="btn" id="btn-open-case" data-confirm="<?= __('Are you sure you want to open this box?') ?>" href="<?= url_to('/lootboxes/open/' . $box['id']) ?>"><?= __('Open this box') ?></a>
            <a data-ajax class="btn" href="<?= url_to('/lootboxes/gift/' . $box['id']) ?>"><?= __('Give gift') ?></a>
        </div>
    </div>
</div>