<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= $title ?></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: 'Courier New', monospace;
            font-size: 12px;
            line-height: 1.2;
            width: 80mm;
            padding: 5mm;
        }
        body * {
            font-weight: bold;
        }
        .struk-header {
            text-align: center;
            margin-bottom: 8px;
            border-bottom: 1px dashed #000;
            padding-bottom: 8px;
        }
        .struk-title {
            font-size: 14px;
            margin-bottom: 3px;
        }
        .struk-subtitle {
            font-size: 10px;
            margin-bottom: 3px;
        }
        .nomor-antrian {
            font-size: 24px;
            text-align: center;
            margin: 10px 0;
            padding: 10px;
            border: 2px solid #000;
        }
        .detail-item {
            margin: 4px 0;
            display: flex;
            justify-content: space-between;
        }
        .divider {
            border-top: 1px dashed #000;
            margin: 8px 0;
            padding-top: 8px;
        }
        .footer {
            text-align: center;
            font-size: 10px;
            margin-top: 10px;
        }
        .barcode-placeholder {
            text-align: center;
            margin: 8px 0;
            font-family: 'Libre Barcode 39', monospace;
            font-size: 20px;
        }
        @media print {
            body {
                width: 80mm;
                margin: 0;
                padding: 5mm;
            }
            .no-print {
                display: none;
            }
        }
    </style>
</head>
<body onload="window.print(); setTimeout(function(){ window.close(); }, 1000);">
    <div class="struk-header">
        <div class="struk-title">RS Poltekkes Kemenkes Semarang</div>
        <div class="struk-subtitle">LOKET PENDATAFTARAN</div>
        
    </div>

    <div class="nomor-antrian">
        A<?= str_pad($antrian->nomor_antrian, 3, '0', STR_PAD_LEFT) ?>
    </div>

    <div class="barcode-placeholder">
        *A<?= str_pad($antrian->nomor_antrian, 3, '0', STR_PAD_LEFT) ?>*
    </div>

    <div class="detail-item">
        <span>Jenis:</span>
        <span>ANTRIAN LOKET</span>
    </div>

    <?php if ($antrian->nama_lengkap): ?>
    <div class="detail-item">
        <span>Nama:</span>
        <span><?= substr($antrian->nama_lengkap, 0, 20) ?></span>
    </div>
    <?php endif; ?>

    <div class="detail-item">
        <span>Tanggal:</span>
        <span><?= date('d/m/Y H:i', strtotime($antrian->created_at)) ?></span>
    </div>

    <div class="divider"></div>

    <div class="footer">
        <div>Terima kasih atas kunjungan Anda</div>
        <div>Silakan menunggu dipanggil</div>
    </div>

    <div class="no-print" style="text-align: center; margin-top: 20px;">
        <button onclick="window.print()">Print Ulang</button>
        <button onclick="window.close()">Tutup</button>
    </div>
</body>
</html>
