@extends('layouts.app')

@section('title', 'Feedback Details')

@section('content')
<div class="page-content">
    <div class="container-fluid">
        <!-- Page Title -->
        <div class="row">
            <div class="col-12">
                <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                    <h4 class="mb-sm-0">Feedback Details</h4>
                    <div class="page-title-right">
                        <ol class="breadcrumb m-0">
                            <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                            <li class="breadcrumb-item"><a href="{{ route('feedback.index') }}">Feedback</a></li>
                            <li class="breadcrumb-item active">Details</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-8 mx-auto">
                <div class="card border-0 shadow-sm">
                    <div class="card-header bg-transparent border-bottom">
                        <div class="d-flex justify-content-between align-items-center">
                            <h5 class="card-title mb-0">
                                <i class="ri-feedback-line text-primary me-2"></i> Feedback #{{ $feedback->id }}
                            </h5>
                            <a href="{{ route('feedback.index') }}" class="btn btn-sm btn-secondary">
                                <i class="ri-arrow-left-line me-1"></i> Back
                            </a>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="mb-4">
                            <label class="form-label fw-semibold text-muted">Name</label>
                            <div class="p-3 bg-light rounded">
                                <h6 class="mb-0">{{ $feedback->name }}</h6>
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="form-label fw-semibold text-muted">Email</label>
                            <div class="p-3 bg-light rounded">
                                <a href="mailto:{{ $feedback->email }}" class="text-decoration-none">
                                    <i class="ri-mail-line me-1"></i>{{ $feedback->email }}
                                </a>
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="form-label fw-semibold text-muted">Message</label>
                            <div class="p-3 bg-light rounded" style="min-height: 150px;">
                                <p class="mb-0" style="white-space: pre-wrap;">{{ $feedback->message }}</p>
                            </div>
                        </div>

                        <div class="row mb-4">
                            <div class="col-md-6">
                                <label class="form-label fw-semibold text-muted">Submitted On</label>
                                <div class="p-3 bg-light rounded">
                                    <i class="ri-calendar-line me-1"></i>
                                    {{ $feedback->created_at->format('F d, Y') }}<br>
                                    <i class="ri-time-line me-1"></i>
                                    {{ $feedback->created_at->format('h:i A') }}
                                </div>
                            </div>
                            <div class="col-md-6">
                                <label class="form-label fw-semibold text-muted">Last Updated</label>
                                <div class="p-3 bg-light rounded">
                                    <i class="ri-calendar-line me-1"></i>
                                    {{ $feedback->updated_at->format('F d, Y') }}<br>
                                    <i class="ri-time-line me-1"></i>
                                    {{ $feedback->updated_at->format('h:i A') }}
                                </div>
                            </div>
                        </div>

                        <div class="d-flex gap-2">
                            <a href="mailto:{{ $feedback->email }}?subject=Re: Your Feedback" class="btn btn-primary">
                                <i class="ri-mail-send-line me-1"></i> Reply via Email
                            </a>
                            <form action="{{ route('feedback.destroy', $feedback->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this feedback?');">
                                @csrf
                                @method('DELETE')
                                <button type="submit" class="btn btn-danger">
                                    <i class="ri-delete-bin-line me-1"></i> Delete
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

