@extends('layouts.admin')

@section('title', 'View Subscription Plan')

@section('admin-content')
<div class="container-fluid px-0">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="h3 mb-0 text-gray-800">Plan Details: {{ $plan->name }}</h1>
        <div class="d-flex gap-2">
            <a href="{{ route('admin.plans.edit', $plan->id) }}" class="btn btn-primary">
                <i class="bi bi-pencil me-1"></i> Edit Plan
            </a>
            <a href="{{ route('admin.plans.index') }}" class="btn btn-outline-secondary">Back to Plans</a>
        </div>
    </div>

    <div class="row g-4">
        <!-- Main Details -->
        <div class="col-lg-8">
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-transparent border-bottom py-3">
                    <h5 class="card-title mb-0 fw-bold">Basic Information</h5>
                </div>
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Plan Name</label>
                            <p class="fs-5 fw-bold text-dark">{{ $plan->name }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Status</label>
                            <div>
                                @if($plan->is_active)
                                    <span class="badge bg-success">Active</span>
                                @else
                                    <span class="badge bg-secondary">Inactive</span>
                                @endif
                            </div>
                        </div>
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Price (INR)</label>
                            <p class="fs-5">{{ $plan->formatted_price_inr }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Price (USD)</label>
                            <p class="fs-5">{{ $plan->formatted_price_usd }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Duration</label>
                            <p class="mb-0"><i class="bi bi-clock me-1"></i> {{ $plan->duration_days }} Days</p>
                        </div>
                        <div class="col-md-6">
                            <label class="small text-muted text-uppercase fw-bold">Commission Rate</label>
                            <p class="mb-0">{{ $plan->commission_rate }}%</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Features -->
            <div class="card border-0 shadow-sm">
                <div class="card-header bg-transparent border-bottom py-3">
                    <h5 class="card-title mb-0 fw-bold">Plan Features & Limits</h5>
                </div>
                <div class="card-body">
                    <div class="row g-4">
                         <div class="col-md-4">
                            <div class="d-flex align-items-center gap-3 p-3 bg-light rounded-3">
                                <div class="fs-3 text-primary"><i class="bi bi-box-seam"></i></div>
                                <div>
                                    <div class="small text-muted">Product Limit</div>
                                    <div class="fw-bold">{{ $plan->product_limit }}</div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="d-flex align-items-center gap-3 p-3 bg-light rounded-3">
                                <div class="fs-3 text-success"><i class="bi bi-images"></i></div>
                                <div>
                                    <div class="small text-muted">Img/Product</div>
                                    <div class="fw-bold">{{ $plan->product_image_limit }}</div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="d-flex align-items-center gap-3 p-3 bg-light rounded-3">
                                <div class="fs-3 text-warning"><i class="bi bi-envelope"></i></div>
                                <div>
                                    <div class="small text-muted">Inquiry Limit</div>
                                    <div class="fw-bold">{{ $plan->inquiry_limit }}</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <h6 class="mt-4 mb-3 fw-bold text-muted text-uppercase small">Additional Privileges</h6>
                    <ul class="list-group list-group-flush">
                        <li class="list-group-item d-flex justify-content-between align-items-center px-0">
                            <span>Show Contact Details</span>
                            <i class="bi {{ $plan->show_contact_details ? 'bi-check-circle-fill text-success' : 'bi-x-circle-fill text-danger' }}"></i>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center px-0">
                            <span>View Buyer Contact Info</span>
                            <i class="bi {{ $plan->view_buyer_contact ? 'bi-check-circle-fill text-success' : 'bi-x-circle-fill text-danger' }}"></i>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center px-0">
                            <span>Featured Listing</span>
                            <i class="bi {{ $plan->is_featured ? 'bi-check-circle-fill text-success' : 'bi-x-circle-fill text-danger' }}"></i>
                        </li>
                         <li class="list-group-item d-flex justify-content-between align-items-center px-0">
                            <span>KYC Verified</span>
                            <i class="bi {{ $plan->has_verified_badge ? 'bi-check-circle-fill text-success' : 'bi-x-circle-fill text-danger' }}"></i>
                        </li>
                         <li class="list-group-item d-flex justify-content-between align-items-center px-0">
                            <span>Microsite Access</span>
                            <i class="bi {{ $plan->allow_microsite ? 'bi-check-circle-fill text-success' : 'bi-x-circle-fill text-danger' }}"></i>
                        </li>
                    </ul>
                </div>
            </div>
        </div>

        <!-- Meta/Stats -->
        <div class="col-lg-4">
            <div class="card border-0 shadow-sm">
                <div class="card-body">
                    <h6 class="fw-bold mb-3">Plan Statistics</h6>
                    <div class="d-flex justify-content-between mb-2">
                        <span class="text-muted">Active Subscriptions</span>
                        <span class="fw-bold">{{ $plan->subscriptions()->where('status', 'active')->count() }}</span>
                    </div>
                     <div class="d-flex justify-content-between mb-2">
                        <span class="text-muted">Total Subscriptions</span>
                        <span class="fw-bold">{{ $plan->subscriptions()->count() }}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
