<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema de Control - Grifo</title>
    <style>
        body { font-family: Arial, sans-serif; background: #f8fafc; margin: 0; padding: 24px; }
        .card { max-width: 920px; margin: auto; padding: 24px; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08); }
        h1 { margin: 0 0 6px 0; }
        p.sub { margin: 0 0 18px 0; color: #475569; }
        .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
        .user-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
        .user-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            color: #1e3a8a;
            padding: 8px 12px;
            border-radius: 999px;
            font-weight: 700;
            font-size: 13px;
            white-space: nowrap;
        }
        .user-icon {
            width: 24px;
            height: 24px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: #dbeafe;
            font-size: 14px;
        }
        .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
        .tile { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; text-decoration: none; color: #0f172a; display: flex; flex-direction: column; gap: 8px; }
        .tile:hover { background: #e2e8f0; }
        .tile .title { font-weight: 700; }
        .tile .desc { font-size: 13px; color: #475569; }
        .button { display: inline-block; padding: 10px 18px; background: #ef4444; color: #fff; border-radius: 8px; border: none; cursor: pointer; }
        @media (max-width: 700px) {
            .grid { grid-template-columns: 1fr; }
            .user-actions { width: 100%; justify-content: space-between; }
        }
    </style>
</head>
<body>
    <div class="card">
        <div class="topbar">
            <div>
                <h1>Sistema de Control - Grifo</h1>
                <p class="sub">Menú para mantenimiento y gestión de registros</p>
            </div>

            <div class="user-actions">
                <div class="user-chip" title="Usuario logueado">
                    <span class="user-icon">👤</span>
                    <span><?php echo e(trim((auth()->user()->nombres ?? auth()->user()->name ?? auth()->user()->usuario ?? '') . ' ' . (auth()->user()->apellidos ?? ''))); ?></span>
                </div>

                <form method="POST" action="<?php echo e(route('logout')); ?>">
                    <?php echo csrf_field(); ?>
                    <button type="submit" class="button">Cerrar sesión</button>
                </form>
            </div>
        </div>

        <?php if(session('error')): ?>
            <div style="margin-top:20px;padding:12px;background:#fee2e2;color:#991b1b;border-radius:10px;border:1px solid #fecaca;font-size:14px">
                <?php echo e(session('error')); ?>

            </div>
        <?php endif; ?>

        <?php if(session('success')): ?>
            <div style="margin-top:20px;padding:12px;background:#dcfce7;color:#166534;border-radius:10px;border:1px solid #bbf7d0;font-size:14px">
                <?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>

        <div class="grid">
            <?php if(auth()->user()->rol === 'ADMIN'): ?>
            <a class="tile" href="<?php echo e(route('estaciones.index')); ?>">
                <div class="title">Estaciones</div>
                <div class="desc">Gestionar estaciones</div>
            </a>
            <a class="tile" href="<?php echo e(route('caras_estacion.index')); ?>">
                <div class="title">Caras de Estación</div>
                <div class="desc">Gestionar caras</div>
            </a>
            <a class="tile" href="<?php echo e(route('tipos_combustible.index')); ?>">
                <div class="title">Tipos de Combustible</div>
                <div class="desc">Gestionar combustibles</div>
            </a>
            <a class="tile" href="<?php echo e(route('mangueras.index')); ?>">
                <div class="title">Mangueras</div>
                <div class="desc">Gestionar mangueras</div>
            </a>
            <?php endif; ?>

            <?php if(auth()->user()->rol === 'ADMIN'): ?>
            <a class="tile" href="<?php echo e(route('turnos.index')); ?>">
                <div class="title">Turnos</div>
                <div class="desc">Gestionar turnos</div>
            </a>
            <?php endif; ?>

            <?php if(in_array(auth()->user()->rol, ['ADMIN', 'OPERADOR'])): ?>
            <a class="tile" href="<?php echo e(route('cierres_turno.cuadre_caja.lista')); ?>">
                <div class="title">Cuadre de Caja</div>
                <div class="desc">Registrar lecturas por isla, lado y manguera</div>
            </a>
            <?php endif; ?>

            <?php if(auth()->user()->rol === 'ADMIN'): ?>
            <a class="tile" href="<?php echo e(route('tanques.index')); ?>">
                <div class="title">Tanques</div>
                <div class="desc">Gestionar tanques</div>
            </a>
            <a class="tile" href="<?php echo e(route('usuarios.index')); ?>">
                <div class="title">Usuarios</div>
                <div class="desc">Registrar y gestionar usuarios</div>
            </a>
            <?php endif; ?>

            <a class="tile" href="<?php echo e(route('precios_dia.index')); ?>">
                <div class="title">Precio del día</div>
                <div class="desc">Gestionar precios diarios</div>
            </a>

            <?php if(auth()->user()->rol === 'ADMIN'): ?>
            <a class="tile" href="<?php echo e(route('reportes.index')); ?>">
                <div class="title">Reportes</div>
                <div class="desc">Ver saldos y precios por turno</div>
            </a>
            <?php endif; ?>

            <?php if(in_array(auth()->user()->rol, ['ADMIN', 'OPERADOR'])): ?>
            <a class="tile" href="<?php echo e(route('diferencias.index')); ?>">
                <div class="title">Diferencias</div>
                <div class="desc">Gestionar diferencias por turno y combustible</div>
            </a>
            <?php endif; ?>
        </div>
    </div>
</body>
</html>
<?php /**PATH C:\laragon\www\grifo\resources\views/dashboard.blade.php ENDPATH**/ ?>