@extends('admin.layouts.app')
@section('title', 'Edit Media')
@section('content')
<div class="card" style="max-width:600px">
    <div class="card-header">Edit Media</div>
    <div style="margin-bottom:15px">
        <img src="{{ $media->thumbnail }}" alt="{{ $media->alt }}" style="max-width:100%;max-height:200px;border-radius:8px">
    </div>
    <form action="{{ route('admin.media.update', $media) }}" method="POST">
        @csrf @method('PUT')
        <div class="form-group">
            <label>Name</label>
            <input type="text" name="name" class="form-control" value="{{ old('name', $media->name) }}" required>
        </div>
        <div class="form-group">
            <label>Alt Text</label>
            <input type="text" name="alt" class="form-control" value="{{ old('alt', $media->alt) }}">
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>File</label>
                <div style="color:#5a5a7a;font-size:0.85rem">{{ $media->file_name }}</div>
            </div>
            <div class="form-group">
                <label>Type</label>
                <div style="color:#5a5a7a;font-size:0.85rem">{{ $media->mime_type }}</div>
            </div>
        </div>
        @if($media->source_url)
        <div class="form-group">
            <label>Source</label>
            <div style="color:#5a5a7a;font-size:0.85rem;word-break:break-all">{{ $media->source_url }}</div>
        </div>
        @endif
        <button type="submit" class="btn btn-primary">Update</button>
    </form>
</div>
@endSection
