<?php

$title   = "inicio";
$MODULO  = $title;
require_once "../../config/init.php";

/* ── Saludo según hora ── */
$hora = (int) date('H');
if ($hora >= 6 && $hora < 12) {
    $saludo = 'Buenos días';
    $emoji  = '☀️';
} elseif ($hora >= 12 && $hora < 19) {
    $saludo = 'Buenas tardes';
    $emoji  = '🌤️';
} else {
    $saludo = 'Buenas noches';
    $emoji  = '🌙';
}

/* ── Fecha en español ── */
$dias      = ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'];
$meses     = ['','Enero','Febrero','Marzo','Abril','Mayo','Junio',
               'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
$fecha_txt = $dias[date('w')] . ', ' . date('j') . ' de ' . $meses[(int)date('n')];

/* ── Usuario ── */
$usuario = strtoupper($_SESSION['user_name'] ?? 'U');
$inicial = $usuario[0];
$nombre  = ucfirst(strtolower($usuario));
?>
<!DOCTYPE html>
<html lang="es">
<head>
    <?php include "head.php"; ?>
    <title>Inicio</title>
    <style>
/* =========================
   CONTENIDO GENERAL
========================= */
.contenido{
    margin-top:25px;
}

/* =========================
   CARDS MODULOS PRO
========================= */
.modulo-card{
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    padding:16px;
    border-radius:18px;
    background:rgba(255,255,255,0.85);
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
    text-decoration:none;
    position:relative;
    overflow:hidden;
    transition:all .35s ease;
    height:100%;
    border:1px solid rgba(255,255,255,0.3);
    box-shadow:0 8px 25px rgba(0,0,0,0.08);
}

/* BORDE SUPERIOR */
.modulo-card::before{
    content:"";
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:5px;
    background:var(--card-color);
}

/* EFECTO LUZ */
.modulo-card::after{
    content:"";
    position:absolute;
    width:120px;
    height:120px;
    background:radial-gradient(circle, rgba(255,255,255,0.4), transparent);
    top:-40px;
    right:-40px;
    opacity:0;
    transition:.4s;
}

/* ICONO */
.modulo-icon{
    width:52px;
    height:52px;
    border-radius:14px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:20px;
    margin-bottom:12px;
    color:#fff;
    box-shadow:0 6px 14px rgba(0,0,0,.2);
    transition:.3s;
}

/* TEXTO */
.modulo-label{
    font-weight:600;
    font-size:15px;
    color:#1e293b;
}

.modulo-desc{
    font-size:12px;
    color:#64748b;
    margin-top:2px;
}

/* HOVER PRO */
.modulo-card:hover{
    transform:translateY(-8px) scale(1.02);
    box-shadow:0 18px 40px rgba(0,0,0,0.15);
}

.modulo-card:hover::after{
    opacity:1;
}

.modulo-card:hover .modulo-icon{
    transform:scale(1.12) rotate(3deg);
}

/* CLICK */
.modulo-card:active{
    transform:scale(0.96);
}

/* =========================
   GRID RESPONSIVE
========================= */
@media(max-width:576px){
    .modulo-card{
        padding:14px;
    }

    .modulo-icon{
        width:46px;
        height:46px;
        font-size:18px;
    }

    .modulo-label{
        font-size:13px;
    }

    .modulo-desc{
        font-size:11px;
    }
}

/* =========================
   MEJORAS MENU LATERAL
========================= */

/* ITEM */
.nb-link{
    position:relative;
    overflow:hidden;
}

/* EFECTO HOVER MÁS FINO */
.nb-link::before{
    content:"";
    position:absolute;
    left:0;
    top:0;
    height:100%;
    width:4px;
    background:linear-gradient(var(--blue), var(--orange));
    transform:scaleY(0);
    transition:.3s;
}

.nb-link:hover::before{
    transform:scaleY(1);
}

/* SUBLINK MEJORADO */
.nb-sub-link{
    position:relative;
    overflow:hidden;
}

/* ACTIVE MÁS PRO */
.nb-sub-link.active{
    background:linear-gradient(135deg, var(--blue), var(--orange));
    color:#fff;
    box-shadow:0 6px 14px rgba(0,0,0,.25);
}

/* HOVER SUB MÁS SUAVE */
.nb-sub-link:hover{
    background:rgba(255,255,255,0.15);
    color:#fff;
}

/* ICONOS MÁS LIMPIOS */
.nb-link i:first-child{
    color:#60a5fa;
    transition:.3s;
}

.nb-link:hover i:first-child{
    transform:scale(1.2);
}

/* =========================
   SCROLL MÁS PRO
========================= */
.nb-menu-wrap::-webkit-scrollbar{
    width:6px;
}

.nb-menu-wrap::-webkit-scrollbar-thumb{
    background:linear-gradient(var(--blue), var(--orange));
    border-radius:10px;
}

/* =========================
   BANNER PRO
========================= */
.banner{
    position:relative;
    border-radius:20px;
    padding:20px 20px 30px;
    margin-top:15px;
    overflow:hidden;

    background:linear-gradient(135deg, #0d6efd, #1abc9c);
    color:#fff;

    box-shadow:0 15px 40px rgba(0,0,0,.15);
}

/* EFECTO GLASS INTERNO */
.banner::before{
    content:"";
    position:absolute;
    inset:0;
    background:rgba(255,255,255,0.05);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
}

/* =========================
   ELEMENTOS DECORATIVOS
========================= */

/* PUNTOS */
.banner-dots{
    position:absolute;
    width:120px;
    height:120px;
    background-image:radial-gradient(rgba(255,255,255,.25) 1px, transparent 1px);
    background-size:10px 10px;
    top:10px;
    right:20px;
    opacity:.4;
}

/* CIRCULOS */
.banner-circle1,
.banner-circle2{
    position:absolute;
    border-radius:50%;
    filter:blur(40px);
    opacity:.4;
}

.banner-circle1{
    width:160px;
    height:160px;
    background:#ffffff;
    top:-60px;
    left:-60px;
}

.banner-circle2{
    width:200px;
    height:200px;
    background:#ffb347;
    bottom:-80px;
    right:-80px;
}

/* =========================
   TOP BAR
========================= */
.banner-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    position:relative;
    z-index:2;
}

/* FECHA */
.banner-fecha{
    font-size:13px;
    background:rgba(255,255,255,.15);
    padding:6px 10px;
    border-radius:10px;
    backdrop-filter:blur(5px);
}

/* BOTÓN LOGOUT */
.banner-logout{
    width:36px;
    height:36px;
    border-radius:10px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    text-decoration:none;
    background:rgba(255,255,255,.15);
    transition:.25s;
}

.banner-logout:hover{
    background:linear-gradient(135deg, #ff4d4d, #ff6b6b);
    transform:scale(1.1);
    box-shadow:0 6px 14px rgba(0,0,0,.3);
}

/* =========================
   CUERPO
========================= */
.banner-body{
    display:flex;
    align-items:center;
    gap:15px;
    margin-top:15px;
    position:relative;
    z-index:2;
}

/* AVATAR (SI LO USAS) */
.avatar{
    width:55px;
    height:55px;
    border-radius:14px;
    background:linear-gradient(135deg, #fff, #dbeafe);
    color:#0d6efd;
    font-weight:bold;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
    box-shadow:0 5px 15px rgba(0,0,0,.2);
}

/* TEXTO */
.banner-saludo h4{
    font-size:18px;
    font-weight:600;
    margin:0;
}

.banner-saludo p{
    margin:2px 0 0;
    font-size:13px;
    opacity:.85;
}

/* =========================
   WAVE
========================= */
.banner-wave{
    position:absolute;
    bottom:0;
    left:0;
    width:100%;
    line-height:0;
}

.banner-wave svg{
    display:block;
    width:100%;
    height:60px;
}

/* =========================
   RESPONSIVE
========================= */
@media(max-width:576px){

    .banner{
        padding:16px;
        border-radius:16px;
    }

    .banner-saludo h4{
        font-size:15px;
    }

    .banner-saludo p{
        font-size:12px;
    }

    .banner-circle1,
    .banner-circle2{
        display:none; /* limpio en móvil */
    }
}



    </style>



</head>
<body>

<?php include "navbar.php"; ?>
<div class="container">

    <!-- ══ BANNER ══ -->
    <div class="banner">
        <div class="banner-dots"></div>


        <!--
                <div class="banner-circle1"></div>
        <div class="banner-circle2"></div>
        
        <div class="banner-top">
            <span class="banner-fecha">
                <i class="fa-regular fa-calendar me-1"></i><?= $fecha_txt ?>
            </span>
            <a href="../controllers/logout.php" class="banner-logout" title="Cerrar sesión">
                <i class="fa-solid fa-right-from-bracket"></i>
            </a>
        </div>-->

        <div class="banner-body">
            <!--<div class="avatar"><?= $inicial ?></div>-->
            <div class="banner-saludo">
                <h5><?= $saludo ?>, <?= $nombre ?> <?= $emoji ?></h5>
                <p>Un nuevo día, nuevas metas para ti</p>
            </div>
        </div>

        <!--<div class="banner-wave">
            <svg viewBox="0 0 1440 70" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none">
                <path d="M0,40 C300,75 600,10 900,45 C1100,68 1300,20 1440,40 L1440,70 L0,70 Z" fill="#f0f2f8"/>
            </svg>
        </div>-->
    </div>

    <!-- ══ CONTENIDO ══ -->
    <div class="contenido">

        <!--<div class="seccion-titulo">Módulos Disponibles</div>-->

        <div class="row g-3">


            <div class="col-6 col-md-3">
                <a href="inicio.php" class="modulo-card" style="--card-color:#0d6efd;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#4f8ef8,#0d6efd); color:#fff;">
                        <i class="fa-solid fa-house"></i>
                    </div>
                    <span class="modulo-label">Inicio</span>
                </a>
            </div>


            <?php if (!$esUsuarioAlmacen): ?>

            <div class="col-6 col-md-3">
                <a href="dashboard.php" class="modulo-card" style="--card-color:#0d6efd;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#4f8ef8,#0d6efd); color:#fff;">
                        <i class="fa-brands fa-sellsy"></i>
                    </div>
                    <span class="modulo-label">Dashboard</span>
                    <span class="modulo-desc">Resumen de ventas</span>
                </a>
            </div>

            <div class="col-6 col-md-3">
                <a href="venta_vendedor.php" class="modulo-card" style="--card-color:#e67e22;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#f5a352,#e67e22); color:#fff;">
                        <i class="fa-regular fa-address-book"></i>
                    </div>
                    <span class="modulo-label">Administracion</span>
                    <span class="modulo-desc">Gestion de vendedor</span>
                </a>
            </div>

            <div class="col-6 col-md-3">
                <a href="venta_activo.php" class="modulo-card" style="--card-color:#198754;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#34c97a,#198754); color:#fff;">
                        <i class="fa-solid fa-clipboard-check"></i>
                    </div>
                    <span class="modulo-label">Consulta de Ventas</span>
                    <span class="modulo-desc">Comprobantes emitidos</span>
                </a>
            </div>

            <div class="col-6 col-md-3">
                <a href="venta_anulado.php" class="modulo-card" style="--card-color:#dc3545;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#f06575,#dc3545); color:#fff;">
                        <i class="fa-solid fa-file-circle-xmark"></i>
                    </div>
                    <span class="modulo-label">Consulta Anulaciones</span>
                    <span class="modulo-desc">Comprobantes anulados</span>
                </a>
            </div>

            <div class="col-6 col-md-3">
                <a href="creditos.php" class="modulo-card" style="--card-color:#6f42c1;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#9b6de8,#6f42c1); color:#fff;">
                        <i class="fa-solid fa-money-check-dollar"></i>
                    </div>
                    <span class="modulo-label">Créditos</span>
                    <span class="modulo-desc">Créditos Pendientes</span>
                </a>
            </div>

            <?php endif; ?>





            <div class="col-6 col-md-3">
                <a href="almacen.php?mostrarReporte=0" class="modulo-card" style="--card-color:#f39c12;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#fbc84a,#f39c12); color:#fff;">
                        <i class="fa-solid fa-boxes-stacked"></i>
                    </div>
                    <span class="modulo-label">Almácen</span>
                    <span class="modulo-desc">Consulta Stocks</span>
                </a>
            </div>

            <div class="col-6 col-md-3">
                <a href="almacen.php?mostrarReporte=1" class="modulo-card" style="--card-color:#1abc9c;">
                    <div class="modulo-icon" style="background:linear-gradient(135deg,#48d9b5,#1abc9c); color:#fff;">
                        <i class="fa-solid fa-print"></i>
                    </div>
                    <span class="modulo-label">Almácen</span>
                    <span class="modulo-desc">Imprimir stock</span>
                </a>
            </div>

        </div>
        <!--<?php include_once "footer.php"; ?>-->
    </div>

</div>
</body>
</html>
