<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <style>
            .dash-header-title {
                font-weight: 600;
                font-size: 1.5rem;
                letter-spacing: -0.01em;
                color: #0f172a;
            }
        </style>
        <h2 class="dash-header-title">Manajemen Ulasan Produk</h2>
     <?php $__env->endSlot(); ?>

    <style>
        /* BASE & RESET */
        .review-wrap {
            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background: #f8fafc;
            min-height: 100vh;
        }

        .review-inner {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 1.5rem;
        }

        /* ALERT MODERN */
        .alert-modern {
            padding: 1rem 1.5rem;
            margin-bottom: 2rem;
            border-radius: 16px;
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-left: 4px solid #3b82f6;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
            font-size: 0.875rem;
            font-weight: 500;
            color: #1e293b;
        }

        /* STATS GRID - CLEAN CARDS */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2.5rem;
        }

        .stat-card {
            background: #ffffff;
            border-radius: 24px;
            padding: 1.5rem 1.75rem;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.05);
            border: 1px solid #eef2f6;
            transition: all 0.2s ease;
        }

        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 20px -12px rgba(0, 0, 0, 0.08);
            border-color: #e2e8f0;
        }

        .stat-label {
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: #64748b;
            margin-bottom: 0.5rem;
        }

        .stat-number {
            font-size: 2.5rem;
            font-weight: 700;
            color: #0f172a;
            letter-spacing: -0.02em;
            line-height: 1.2;
        }

        /* TABS - SOFT PILLS */
        .tabs-container {
            margin-bottom: 2rem;
        }

        .tabs-flex {
            display: flex;
            gap: 0.5rem;
            background: #ffffff;
            padding: 0.5rem;
            border-radius: 60px;
            border: 1px solid #eef2f6;
            width: fit-content;
            background: #ffffff;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
        }

        .tab-btn {
            padding: 0.5rem 1.5rem;
            border-radius: 40px;
            font-size: 0.8rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            text-decoration: none;
            color: #475569;
            transition: all 0.2s;
            background: transparent;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .tab-btn.active {
            background: #0f172a;
            color: white;
            box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
        }

        .tab-btn:hover:not(.active) {
            background: #f1f5f9;
            color: #0f172a;
        }

        .tab-count {
            background: rgba(0, 0, 0, 0.05);
            padding: 2px 8px;
            border-radius: 30px;
            font-size: 0.7rem;
            font-weight: 600;
        }

        .tab-btn.active .tab-count {
            background: rgba(255, 255, 255, 0.2);
            color: white;
        }

        /* REVIEW CARD - ELEVATED */
        .review-list {
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
        }

        .review-card {
            background: #ffffff;
            border-radius: 24px;
            border: 1px solid #eef2f6;
            overflow: hidden;
            transition: all 0.2s;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
        }

        .review-card:hover {
            box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.1);
            border-color: #e2e8f0;
        }

        .card-body {
            padding: 1.5rem;
        }

        /* HEADER ROW */
        .review-header {
            display: flex;
            gap: 1.25rem;
            flex-wrap: wrap;
            align-items: flex-start;
            margin-bottom: 1.25rem;
        }

        .product-thumb {
            width: 70px;
            height: 70px;
            border-radius: 18px;
            object-fit: cover;
            background: #f8fafc;
            border: 1px solid #edf2f7;
        }

        .product-thumb-placeholder {
            width: 70px;
            height: 70px;
            border-radius: 18px;
            background: #f8fafc;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #edf2f7;
        }

        .review-meta {
            flex: 1;
        }

        .product-name {
            font-weight: 700;
            font-size: 1rem;
            color: #0f172a;
            margin-bottom: 4px;
        }

        .user-line {
            font-size: 0.7rem;
            color: #64748b;
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: baseline;
        }

        .user-name {
            font-weight: 600;
            color: #1e293b;
        }

        .review-date {
            color: #94a3b8;
        }

        /* BADGE */
        .badge-status {
            padding: 0.25rem 1rem;
            border-radius: 40px;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            text-transform: uppercase;
            background: #f1f5f9;
            color: #475569;
        }

        .badge-approved {
            background: #e3f2fd;
            color: #1e40af;
        }

        .badge-pending {
            background: #fff7ed;
            color: #9a3412;
        }

        /* RATING */
        .rating-wrap {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }

        .stars {
            display: flex;
            gap: 3px;
        }

        .star {
            font-size: 1rem;
            color: #cbd5e1;
        }

        .star-filled {
            color: #f59e0b;
        }

        .rating-number {
            font-size: 0.7rem;
            font-weight: 500;
            color: #64748b;
        }

        /* COMMENT */
        .comment-box {
            background: #fafcff;
            padding: 1rem 1.25rem;
            border-radius: 20px;
            border: 1px solid #eef2f6;
            font-size: 0.85rem;
            line-height: 1.5;
            color: #1e293b;
            margin-bottom: 1rem;
        }

        /* IMAGES GALLERY */
        .image-gallery {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 1.25rem;
        }

        .gallery-img {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            object-fit: cover;
            border: 1px solid #eef2f6;
            cursor: pointer;
            transition: transform 0.1s ease;
        }

        .gallery-img:hover {
            transform: scale(1.02);
            opacity: 0.9;
        }

        /* ACTION BUTTONS */
        .action-group {
            display: flex;
            gap: 1.5rem;
            align-items: center;
            flex-wrap: wrap;
            margin-top: 0.25rem;
        }

        .action-btn {
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            background: none;
            border: none;
            cursor: pointer;
            padding: 0.25rem 0;
            border-bottom: 1.5px solid transparent;
            transition: all 0.2s;
        }

        .btn-approve {
            color: #2563eb;
        }

        .btn-approve:hover {
            border-bottom-color: #2563eb;
            color: #1d4ed8;
        }

        .btn-delete {
            color: #94a3b8;
        }

        .btn-delete:hover {
            color: #dc2626;
            border-bottom-color: #dc2626;
        }

        .approved-text {
            font-size: 0.7rem;
            font-weight: 500;
            color: #22c55e;
            background: #f0fdf4;
            padding: 0.25rem 0.75rem;
            border-radius: 30px;
        }

        /* EMPTY STATE */
        .empty-state {
            background: #ffffff;
            border-radius: 32px;
            text-align: center;
            padding: 4rem 2rem;
            border: 1px solid #eef2f6;
        }

        .empty-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        .empty-title {
            font-weight: 600;
            font-size: 1.1rem;
            color: #1e293b;
            margin-bottom: 0.25rem;
        }

        .empty-desc {
            font-size: 0.8rem;
            color: #94a3b8;
        }

        /* PAGINATION */
        .pagination-wrap {
            margin-top: 2rem;
            display: flex;
            justify-content: center;
        }
    </style>

    <div class="review-wrap">
        <div class="review-inner">

            
            <?php if(session('success')): ?>
                <div class="alert-modern">
                    <?php echo e(session('success')); ?>

                </div>
            <?php endif; ?>

            
            <div class="stats-grid">
                <div class="stat-card">
                    <div class="stat-label">Menunggu Persetujuan</div>
                    <div class="stat-number"><?php echo e($pendingCount); ?></div>
                </div>
                <div class="stat-card">
                    <div class="stat-label">Telah Disetujui</div>
                    <div class="stat-number"><?php echo e($approvedCount); ?></div>
                </div>
                <div class="stat-card">
                    <div class="stat-label">Total Ulasan</div>
                    <div class="stat-number"><?php echo e($pendingCount + $approvedCount); ?></div>
                </div>
            </div>

            
            <div class="tabs-container">
                <div class="tabs-flex">
                    <a href="<?php echo e(route('admin.reviews.index', ['filter'=>'pending'])); ?>" 
                       class="tab-btn <?php echo e($filter === 'pending' ? 'active' : ''); ?>">
                        Menunggu
                        <?php if($pendingCount > 0): ?>
                            <span class="tab-count"><?php echo e($pendingCount); ?></span>
                        <?php endif; ?>
                    </a>
                    <a href="<?php echo e(route('admin.reviews.index', ['filter'=>'approved'])); ?>" 
                       class="tab-btn <?php echo e($filter === 'approved' ? 'active' : ''); ?>">
                        Disetujui
                        <?php if($approvedCount > 0): ?>
                            <span class="tab-count"><?php echo e($approvedCount); ?></span>
                        <?php endif; ?>
                    </a>
                    <a href="<?php echo e(route('admin.reviews.index', ['filter'=>'all'])); ?>" 
                       class="tab-btn <?php echo e($filter === 'all' ? 'active' : ''); ?>">
                        Semua
                        <span class="tab-count"><?php echo e($pendingCount + $approvedCount); ?></span>
                    </a>
                </div>
            </div>

            
            <?php if($reviews->count() > 0): ?>
                <div class="review-list">
                    <?php $__currentLoopData = $reviews; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $review): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $productImg = $review->product->images->first();
                        ?>
                        <div class="review-card">
                            <div class="card-body">
                                
                                <div class="review-header">
                                    <?php if($productImg): ?>
                                        <img src="<?php echo e(asset('storage/' . $productImg->image_path)); ?>" 
                                             class="product-thumb" 
                                             alt="<?php echo e($review->product->name); ?>">
                                    <?php else: ?>
                                        <div class="product-thumb-placeholder">
                                            <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#cbd5e1">
                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                                            </svg>
                                        </div>
                                    <?php endif; ?>

                                    <div class="review-meta">
                                        <div class="product-name"><?php echo e($review->product->name); ?></div>
                                        <div class="user-line">
                                            <span>Oleh <span class="user-name"><?php echo e($review->user->name); ?></span></span>
                                            <span>•</span>
                                            <span class="review-date"><?php echo e($review->created_at->format('d M Y, H:i')); ?></span>
                                        </div>
                                    </div>

                                    <div>
                                        <span class="badge-status <?php echo e($review->is_approved ? 'badge-approved' : 'badge-pending'); ?>">
                                            <?php echo e($review->is_approved ? 'Disetujui' : 'Menunggu'); ?>

                                        </span>
                                    </div>
                                </div>

                                
                                <div class="rating-wrap">
                                    <div class="stars">
                                        <?php for($i = 1; $i <= 5; $i++): ?>
                                            <span class="star <?php echo e($i <= $review->rating ? 'star-filled' : ''); ?>">★</span>
                                        <?php endfor; ?>
                                    </div>
                                    <div class="rating-number"><?php echo e($review->rating); ?>/5</div>
                                </div>

                                
                                <div class="comment-box">
                                    <?php echo e($review->comment); ?>

                                </div>

                                
                                <?php if($review->images->count() > 0): ?>
                                    <div class="image-gallery">
                                        <?php $__currentLoopData = $review->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $img): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <img src="<?php echo e(asset('storage/' . $img->image_path)); ?>"
                                                 class="gallery-img"
                                                 onclick="window.open(this.src)"
                                                 title="Klik untuk melihat lebih besar">
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                <?php endif; ?>

                                
                                <div class="action-group">
                                    <?php if(!$review->is_approved): ?>
                                        <form action="<?php echo e(route('admin.reviews.approve', $review->id)); ?>" method="POST" style="display:inline;">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('PATCH'); ?>
                                            <button type="submit" class="action-btn btn-approve">
                                                ✓ Setujui
                                            </button>
                                        </form>
                                    <?php else: ?>
                                        <span class="approved-text">✓ Disetujui</span>
                                    <?php endif; ?>

                                    <form action="<?php echo e(route('admin.reviews.destroy', $review->id)); ?>" method="POST" style="display:inline;"
                                          onsubmit="return confirm('Hapus ulasan dari <?php echo e(addslashes($review->user->name)); ?>? Tindakan ini tidak bisa dibatalkan.');">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="action-btn btn-delete">
                                            Hapus
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>

                
                <?php if($reviews->hasPages()): ?>
                    <div class="pagination-wrap">
                        <?php echo e($reviews->links()); ?>

                    </div>
                <?php endif; ?>

            <?php else: ?>
                <div class="empty-state">
                    <div class="empty-icon">⭐</div>
                    <div class="empty-title">
                        <?php if($filter === 'pending'): ?> Tidak ada ulasan menunggu
                        <?php elseif($filter === 'approved'): ?> Belum ada ulasan disetujui
                        <?php else: ?> Belum ada ulasan
                        <?php endif; ?>
                    </div>
                    <div class="empty-desc">
                        <?php if($filter === 'pending'): ?> Semua ulasan sudah diproses
                        <?php elseif($filter === 'approved'): ?> Pelanggan akan melihat ulasan setelah disetujui
                        <?php else: ?> Ulasan dari pelanggan akan muncul di sini
                        <?php endif; ?>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH C:\laragon\www\toko_app\resources\views/admin/reviews/index.blade.php ENDPATH**/ ?>