<?php if (!defined('STORE_ROOT')) { http_response_code(403); exit; }  $uid = Auth::id(); $acc = DB::one("SELECT credit_balance FROM users WHERE id = :uid", [':uid' => $uid]); $balance = (float)($acc['credit_balance'] ?? 0); $reviews = DB::all("SELECT * FROM customer_reviews WHERE user_id = :uid ORDER BY created_at DESC", [':uid' => $uid]); $reviews = Crypt::rows($reviews, ['title', 'content', 'admin_reply']); $canReview = null; try { $canReview = DB::one("SELECT id FROM review_codes WHERE user_id = :uid AND used = 0 AND expires_at > NOW()", [':uid' => $uid]); } catch (\Throwable $e) { } ?> <div class="account-section">     <div class="section-title">         <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>         My Reviews & Credits     </div>      <div style="background: rgba(var(--accent-rgb), 0.1); border: 1px solid var(--accent); padding: 20px; border-radius: 8px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center;">         <div>             <h3 style="margin: 0 0 5px 0; color: var(--text);">Review Credit Balance</h3>             <div style="color: var(--text-muted); font-size: 0.9rem;">Credits are automatically applied at checkout to discount your next order.</div>         </div>         <div style="font-size: 1.8rem; font-weight: 600; color: var(--accent);">             $<?= number_format($balance, 2) ?>         </div>     </div>      <?php if ($canReview): ?>     <div style="padding: 15px; border: 1px dashed var(--accent); border-radius: 8px; margin-bottom: 25px;">         <strong style="color: var(--accent);">You are eligible to leave a review!</strong>         <p style="margin: 5px 0 10px 0; font-size: 0.9rem;">Head over to the <a href="?v=reviews" style="color:var(--text); text-decoration:underline;">Reviews page</a> to share your experience and earn $5.00 credit.</p>     </div>     <?php endif; ?>      <h3 style="margin-bottom: 15px;">Your Published Reviews</h3>          <?php if (empty($reviews)): ?>         <div class="empty-state">You haven't left any reviews yet.</div>     <?php else: ?>         <?php foreach ($reviews as $rev): $rating = (int)($rev['rating'] ?? 5); ?>         <div class="order-card" style="border: 1px solid var(--border); padding: 20px; margin-bottom: 15px; border-radius: 8px;">             <div style="display: flex; justify-content: space-between; margin-bottom: 15px;">                 <div style="display: flex; gap: 2px;">                     <?php for ($s = 1; $s <= 5; $s++): ?>                         <svg width="16" height="16" viewBox="0 0 24 24" style="<?= $s <= $rating ? 'fill:var(--accent);' : 'fill:var(--bg-lighter);' ?>"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>                     <?php endfor; ?>                 </div>                 <span style="color: var(--text-muted); font-size: 0.9rem;"><?= date('M j, Y', strtotime($rev['created_at'])) ?></span>             </div>             <div style="color: var(--text); line-height: 1.5; margin-bottom: 10px;">                 <?= htmlspecialchars($rev['content']) ?>             </div>             <div style="font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px;">                 <svg width="14" height="14" viewBox="0 0 24 24" style="stroke:currentColor;fill:none;stroke-width:1.8"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>                 VERIFIED CUSTOMER <span style="color:var(--accent);">✓</span>                 <span style="margin-left:auto;"><?= (int)$rev['helpful_count'] ?> found this helpful</span>             </div>         </div>         <?php endforeach; ?>     <?php endif; ?> </div>
