<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } ?> <div class="ov-section-hdr"> <span class="ov-section-title">Storefronts</span> <a href="?view=stores&edit=0" class="ov-section-action">+ New Store</a> </div> <div class="ov-store-grid"><?php foreach ($stores as $s): $color = $s['color_master'] ?? $s['accent_color'] ?? '#2D6A4F'; $label = $s['nickname'] ?: $s['domain']; $health = $s['is_active'] && !$s['maintenance_mode'] && $s['proxy_enabled']; $readyScore = 0; if ($s['cat_count'] > 0) $readyScore += 25; if ($s['prod_count'] > 0) $readyScore += 35; if ($s['row_count'] > 0) $readyScore += 25; if ($s['is_active']) $readyScore += 15; $readyColor = $readyScore >= 85 ? '#2ecc71' : ($readyScore >= 50 ? '#e6a817' : '#e74c3c'); ?> <div class="ov-store-card"> <div class="ov-store-stripe" style="background:<?= htmlspecialchars($color) ?>"></div> <div class="ov-store-body"> <div class="ov-store-top"> <div class="ov-store-dot <?= $health ? 'live' : 'off' ?>" title="<?= $health ? 'Live' : 'Offline/Maintenance' ?>"></div> <div class="ov-store-name"><?= htmlspecialchars($label) ?></div> <div class="ov-store-domain"><?= htmlspecialchars($s['domain']) ?></div> <span class="ov-store-type-pill"><?= htmlspecialchars($s['store_type']) ?></span> </div> <div class="ov-store-stats"> <div class="ov-store-stat"><span><?= $s['cat_count'] ?></span><em>Categories</em></div> <div class="ov-store-stat"><span style="color:#3498db"><?= $s['prod_count'] ?></span><em>Products</em></div> <div class="ov-store-stat"><span style="color:#9b59b6"><?= $s['row_count'] ?></span><em>Rows</em></div> <div class="ov-store-stat"><span style="color:#e6a817"><?= $s['orders_today'] ?></span><em>Orders Today</em></div> </div> <div class="ov-ready-bar-wrap"> <div class="ov-ready-bar-bg"> <div class="ov-ready-bar-fill" style="width:<?= $readyScore ?>%;background:<?= $readyColor ?>"></div> </div> <span class="ov-ready-pct" style="color:<?= $readyColor ?>"><?= $readyScore ?>% Ready</span> </div> <div class="ov-store-actions"> <a href="?view=store&id=<?= $s['id'] ?>&tab=categories" class="ov-act-btn primary">Manage Store &rarr;</a> <a href="?view=store&id=<?= $s['id'] ?>&tab=layout" class="ov-act-btn">Layout</a> <a href="?view=store&id=<?= $s['id'] ?>&action=manage" class="ov-act-btn">Settings</a><?php if ($s['maintenance_mode']): ?> <span class="ov-act-pill warn">Maintenance</span><?php elseif (!$s['is_active']): ?> <span class="ov-act-pill off">Inactive</span><?php else: ?> <span class="ov-act-pill live">Live</span><?php endif; ?> </div> </div> </div><?php endforeach; ?> <?php if (empty($stores)): ?> <div class="ov-no-stores"> <div style="font-size:32px;margin-bottom:12px"><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg></div> <div style="font-size:15px;font-weight:800;color:rgba(200,204,212,.5)">No stores yet</div> <div style="font-size:12px;color:rgba(200,204,212,.3);margin-top:6px">Click <strong>+ New Store</strong> to create your first storefront</div> <a href="?view=stores&edit=0" class="ov-act-btn primary" style="margin-top:16px;display:inline-flex">+ Create First Store</a> </div><?php endif; ?> </div>