<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;flex-wrap:wrap;gap:10px;">
    <a href="<?= Router::url('menu') ?>" style="font-size:13px;color:var(--color-text-muted);"><i class="fa-solid fa-arrow-left"></i> Back to Menu Management</a>
    <button onclick="window.print()" class="btn btn-secondary no-print"><i class="fa-solid fa-print"></i> Print</button>
</div>

<div class="today-menu-header">
    <div class="tm-icon"><i class="fa-solid fa-bowl-rice"></i></div>
    <div>
        <h2 style="font-family:var(--font-display);font-size:24px;margin:0;"><?= e(setting('company_name', 'Rice & Curry')) ?></h2>
        <div style="color:var(--color-text-muted);font-size:13px;"><?= date('l, d F Y') ?> — Today's Available Menu</div>
    </div>
</div>

<?php if (empty($menuByCategory)): ?>
<div class="panel" style="text-align:center;padding:50px;color:var(--color-text-muted);">
    <i class="fa-solid fa-bowl-rice" style="font-size:28px;margin-bottom:10px;display:block;opacity:0.5;"></i>
    No items are available today. Add items or mark them available from Menu Management.
</div>
<?php endif; ?>

<?php foreach ($menuByCategory as $categoryName => $menuItems): ?>
<div class="panel today-category">
    <h3 class="tc-title"><i class="fa-solid fa-layer-group"></i> <?= e($categoryName) ?></h3>
    <div class="today-grid">
        <?php foreach ($menuItems as $mi): ?>
        <div class="today-card">
            <?php if (!empty($mi['image_path'])): ?>
            <img src="<?= BASE_URL ?>/<?= e($mi['image_path']) ?>" alt="<?= e($mi['item_name']) ?>" class="today-card-img">
            <?php endif; ?>
            <div class="today-card-top">
                <div class="tc-name"><?= e($mi['item_name']) ?></div>
                <div class="tc-price"><?= formatMoney((float) $mi['base_price']) ?></div>
            </div>
            <?php if ($mi['description']): ?>
            <div class="tc-desc"><?= e($mi['description']) ?></div>
            <?php endif; ?>
            <?php if (!empty($mi['variants'])): ?>
            <div class="tc-variants">
                <?php foreach ($mi['variants'] as $v): ?>
                <span class="tc-variant-chip"><?= e($v['variant_name']) ?> <?= $v['price_adjustment'] >= 0 ? '+' : '' ?><?= number_format($v['price_adjustment'], 0) ?></span>
                <?php endforeach; ?>
            </div>
            <?php endif; ?>
        </div>
        <?php endforeach; ?>
    </div>
</div>
<?php endforeach; ?>

<style>
.today-menu-header {
    display: flex; align-items: center; gap: 16px;
    background: linear-gradient(135deg, var(--color-navy), var(--color-navy-2));
    color: #fff; padding: 20px 24px; border-radius: var(--radius); margin-bottom: 20px;
}
.today-menu-header h2, .today-menu-header div { color: #fff !important; }
.today-menu-header .tm-icon {
    width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,0.14);
    display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}

.today-category .tc-title {
    font-size: 15px; margin-bottom: 14px; color: var(--color-accent);
    display: flex; align-items: center; gap: 8px;
    border-bottom: 2px solid var(--color-border); padding-bottom: 10px;
}
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.today-card { border: 1px solid var(--color-border); border-radius: 10px; padding: 14px; background: var(--color-bg); }
.today-card-img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.today-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.tc-name { font-weight: 700; font-size: 13.5px; }
.tc-price { font-weight: 700; color: var(--color-accent); font-size: 13px; white-space: nowrap; }
.tc-desc { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.tc-variants { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tc-variant-chip {
    font-size: 10.5px; background: rgba(193,135,46,0.12); color: #8A611F;
    padding: 3px 8px; border-radius: 100px; font-weight: 600;
}

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; }
    .panel { box-shadow: none !important; border: 1px solid #ddd !important; }
}
</style>