@extends('admin.layouts.app')
@section('title','Premios y Reconocimientos')
@section('styles')
<style>
:root{--m:#b45309;--mg:#d97706;}
.mod-hero{background:linear-gradient(135deg,#78350f,#b45309,#d97706);border-radius:20px;padding:22px 28px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;margin-bottom:22px;box-shadow:0 8px 32px rgba(120,53,15,.3);}
.mod-hero h1{font-size:1.3rem;font-weight:800;color:#fff;margin:0;display:flex;align-items:center;gap:10px;}
.mod-hero p{color:rgba(255,255,255,.5);margin:0;font-size:.82rem;}
.hero-pill{background:rgba(255,255,255,.12);border:1.5px solid rgba(255,255,255,.22);border-radius:50px;padding:7px 18px;color:#fff;font-weight:800;font-size:.9rem;}
.mod-card{background:#fff;border-radius:18px;box-shadow:0 2px 16px rgba(0,0,0,.06);overflow:hidden;}
.mod-card-hd{background:linear-gradient(135deg,#78350f,#d97706);padding:13px 22px;display:flex;align-items:center;gap:10px;}
.mod-card-hd .hd-ic{width:32px;height:32px;border-radius:9px;background:rgba(255,255,255,.15);display:flex;align-items:center;justify-content:center;}
.mod-card-hd .hd-ic i{color:#ffe082;font-size:15px;}
.mod-card-hd span{color:#fff;font-weight:800;font-size:.92rem;}
.mod-card-hd small{color:rgba(255,255,255,.5);font-size:.75rem;font-weight:600;margin-left:auto;}
.pt{width:100%;border-collapse:collapse;font-size:13.5px;}
.pt thead th{background:#fffbeb;color:#64748b;font-size:11px;font-weight:800;padding:10px 16px;text-transform:uppercase;letter-spacing:.5px;border-bottom:2px solid #fde68a;white-space:nowrap;}
.pt tbody tr{border-bottom:1px solid #fafaf7;transition:background .15s;}
.pt tbody tr:hover{background:#fffbeb;}
.pt td{padding:11px 16px;vertical-align:middle;}
.ab{padding:4px 10px;border-radius:50px;font-size:11px;font-weight:800;display:inline-flex;align-items:center;gap:4px;}
.ab-ok{background:#dcfce7;color:#15803d;}
.ab-no{background:#fee2e2;color:#dc2626;}
.act-btn{width:34px;height:34px;border-radius:9px;border:none;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:14px;transition:all .2s;text-decoration:none;}
.act-ed{background:#fffbeb;color:#b45309;}
.act-ed:hover{background:#fde68a;}
.act-del{background:#fef2f2;color:#dc2626;}
.act-del:hover{background:#fee2e2;}
.thumb{width:48px;height:48px;border-radius:12px;overflow:hidden;background:#fef9c3;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.thumb img{width:48px;height:48px;object-fit:cover;}
.btn-new{display:inline-flex;align-items:center;gap:8px;padding:11px 22px;background:linear-gradient(135deg,#ffe082,#fcd34d);color:#78350f;border-radius:14px;font-weight:800;font-size:.88rem;text-decoration:none;box-shadow:0 4px 16px rgba(251,191,36,.3);transition:all .2s;}
.btn-new:hover{transform:translateY(-2px);}
</style>
@endsection
@section('content')
<div class="mod-hero">
    <div>
        <h1>
            <div style="width:38px;height:38px;border-radius:12px;background:rgba(255,255,255,.15);border:1.5px solid rgba(255,255,255,.25);display:flex;align-items:center;justify-content:center;">
                <i class="bi bi-trophy-fill" style="color:#ffe082;font-size:18px;"></i>
            </div>
            Premios y Reconocimientos
        </h1>
        <p>Logros y reconocimientos de la institución</p>
    </div>
    <div style="display:flex;gap:12px;align-items:center;">
        <div class="hero-pill">{{ $premios->count() }} registros</div>
        <a href="{{ route('admin.premios.create') }}" class="btn-new"><i class="bi bi-plus-lg"></i> Nuevo Premio</a>
    </div>
</div>
<div class="mod-card">
    <div class="mod-card-hd">
        <div class="hd-ic"><i class="bi bi-list-ul"></i></div>
        <span>Todos los Premios</span>
        <small>{{ $premios->count() }} registros</small>
    </div>
    <div style="overflow-x:auto;">
        <table class="pt">
            <thead>
                <tr><th>#</th><th>Imagen</th><th>Nombre</th><th>Otorgado por</th><th>Año</th><th>Orden</th><th>Estado</th><th style="text-align:center;">Acciones</th></tr>
            </thead>
            <tbody>
                @forelse($premios as $p)
                <tr>
                    <td><span style="font-size:11px;color:#94a3b8;font-weight:700;">{{ $p->id }}</span></td>
                    <td>
                        <div class="thumb">
                            @if($p->imagen)<img src="{{ asset('storage/'.$p->imagen) }}" alt="">
                            @else<i class="bi bi-trophy-fill" style="font-size:22px;color:#d97706;"></i>@endif
                        </div>
                    </td>
                    <td><strong style="color:#1e293b;">{{ $p->nombre }}</strong></td>
                    <td style="color:#64748b;font-size:.85rem;">{{ $p->otorgado_por ?? '—' }}</td>
                    <td><span style="font-weight:700;color:#b45309;background:#fffbeb;padding:3px 10px;border-radius:50px;font-size:.82rem;">{{ $p->anio ?? '—' }}</span></td>
                    <td><span style="font-weight:700;color:#334155;">{{ $p->orden ?? 0 }}</span></td>
                    <td><span class="ab {{ $p->activo ? 'ab-ok' : 'ab-no' }}"><i class="bi {{ $p->activo ? 'bi-check-circle-fill' : 'bi-x-circle-fill' }}"></i>{{ $p->activo ? 'Activo' : 'Inactivo' }}</span></td>
                    <td>
                        <div style="display:flex;gap:6px;justify-content:center;">
                            <a href="{{ route('admin.premios.edit', $p) }}" class="act-btn act-ed" title="Editar"><i class="bi bi-pencil-fill"></i></a>
                            <form action="{{ route('admin.premios.destroy', $p) }}" method="POST" class="form-delete" data-item-name="{{ $p->nombre }}">@csrf @method('DELETE')
                                <button type="submit" class="act-btn act-del" title="Eliminar"><i class="bi bi-trash-fill"></i></button>
                            </form>
                        </div>
                    </td>
                </tr>
                @empty
                <tr><td colspan="8" style="padding:64px 20px;text-align:center;"><i class="bi bi-trophy" style="font-size:52px;color:#fcd34d;display:block;margin-bottom:12px;"></i><strong style="color:#334155;display:block;">Sin premios registrados</strong><a href="{{ route('admin.premios.create') }}" class="btn-new" style="margin:12px auto 0;display:inline-flex;">Añadir primero</a></td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>
@endsection
