﻿/* =====================================================
   ROOT
===================================================== */

:root {
    --navbar-height: 70px;
    --erp-bg: #172033;
    --erp-bg-soft: #1e293b;
    --erp-primary: #2563eb;
    --erp-primary-light: #3b82f6;
    --erp-text: #e2e8f0;
    --erp-muted: #94a3b8;
    --erp-border: rgba(255,255,255,.06);
    --erp-hover: rgba(255,255,255,.08);
}

/* =====================================================
   GLOBAL
===================================================== */

html,
body {
    overflow-x: hidden;
    background: #f8fafc;
}

/* =====================================================
   NAVBAR
===================================================== */

.navbar-erp {
    position: relative; /* 🔥 clave */
    min-height: var(--navbar-height); /* 🔥 evita recorte */
    background: var(--erp-bg);
    border-bottom: 1px solid rgba(255,255,255,.04);
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    padding: 0 18px;
    z-index: 1050;
    overflow: visible !important;
}

    /* importante para dropdown flotante */

    .navbar-erp,
    .navbar-erp .container-fluid,
    .navbar-erp .navbar-collapse {
        overflow: visible !important;
    }

/* =====================================================
   BRAND
===================================================== */

.erp-brand {
    min-width: 180px;
}

.erp-logo-box {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient( 135deg, var(--erp-primary), var(--erp-primary-light) );
    color: white;
    font-size: 18px;
    box-shadow: 0 8px 24px rgba(37,99,235,.35);
}

.erp-logo-text {
    line-height: 1.05;
}

.erp-title {
    display: block;
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
}

.erp-subtitle {
    color: #cbd5e1;
    font-size: .72rem;
}

/* =====================================================
   NAV LINKS
===================================================== */

.navbar-erp .navbar-nav {
    gap: 4px;
}

.navbar-erp .nav-item {
    position: relative;
}

.navbar-erp .nav-link {
    color: var(--erp-text) !important;
    font-size: .92rem;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 12px;
    transition: background .2s ease, color .2s ease;
}

    .navbar-erp .nav-link:hover {
        background: var(--erp-hover);
        color: white !important;
    }

    .navbar-erp .nav-link.active {
        background: var(--erp-primary);
        color: white !important;
    }


/* =====================================================
   MOBILE OFFCANVAS
===================================================== */

.offcanvas-erp {
    width: 320px !important;
    background: var(--erp-bg) !important;
    color: white;
    border-right: 1px solid var(--erp-border);
}

    /* =====================================================
   OFFCANVAS HEADER
===================================================== */

    .offcanvas-erp .offcanvas-header {
        border-bottom: 1px solid rgba(255,255,255,.06);
        padding: 18px;
    }

    /* =====================================================
   OFFCANVAS BODY
===================================================== */

    .offcanvas-erp .offcanvas-body {
        overflow-x: hidden !important;
        overflow-y: auto;
        padding: 18px;
        display: flex;
        flex-direction: column;
    }

    /* =====================================================
   MOBILE NAV
===================================================== */

    .offcanvas-erp .navbar-nav {
        width: 100%;
        gap: 8px;
    }

    .offcanvas-erp .nav-item {
        width: 100%;
    }

    .offcanvas-erp .nav-link {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        border-radius: 14px;
        color: rgba(255,255,255,.92) !important;
        font-weight: 600;
        transition: all .2s ease;
    }

        .offcanvas-erp .nav-link:hover {
            background: rgba(255,255,255,.05);
        }

        .offcanvas-erp .nav-link.active {
            background: linear-gradient( 90deg, var(--erp-primary), var(--erp-primary-light) );
            color: white !important;
        }

/* =====================================================
   MOBILE DROPDOWN
===================================================== */

@media (max-width: 991.98px) {

    .offcanvas-erp .dropdown-menu {
        position: static !important;
        transform: none !important;
        display: none;
        width: 100%;
        margin-top: 8px;
        border: none;
        border-radius: 16px;
        background: rgba(255,255,255,.04);
        padding: 10px;
        box-shadow: none;
    }

        .offcanvas-erp .dropdown-menu.show {
            display: block;
        }

    .offcanvas-erp .dropdown-toggle::after {
        transition: transform .2s ease;
    }

    .offcanvas-erp .dropdown.open .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

.offcanvas-erp .dropdown-item {
    border-radius: 12px;
    padding: 12px 14px;
    color: rgba(255,255,255,.86);
    font-size: .9rem;
    transition: all .18s ease;
}

    .offcanvas-erp .dropdown-item:hover {
        background: rgba(255,255,255,.08);
        color: white;
    }

.offcanvas-erp .dropdown-header {
    color: #93c5fd;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 10px 12px;
}

.offcanvas-erp .dropdown-divider {
    border-color: rgba(255,255,255,.06);
}

/* =====================================================
   USER INFO
===================================================== */

.user-info {
    background: rgba(255,255,255,.05);
    padding: 10px 14px;
    border-radius: 14px;
    color: white;
    line-height: 1.2;
}

.user-mobile {
    margin-top: auto;
    padding-top: 24px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.05);
    color: white;
}

/* =====================================================
   LOGOUT
===================================================== */

.btn-logout {
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    background: rgba(239,68,68,.12);
    color: #f87171;
    transition: all .2s ease;
}

    .btn-logout:hover {
        background: #ef4444;
        color: white;
    }

/* =====================================================
   NOTIFICATIONS
===================================================== */

.noti-wrapper {
    position: relative;
}

.noti-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    font-size: 10px;
}

.noti-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    width: 340px;
    background: white;
    border-radius: 18px;
    overflow: hidden;
    z-index: 9999;
    box-shadow: 0 24px 50px rgba(0,0,0,.25);
}

.noti-header {
    background: var(--erp-primary);
    color: white;
    padding: 14px;
    font-weight: 700;
}

.noti-item {
    padding: 14px;
    border-bottom: 1px solid #eef2f7;
    cursor: pointer;
    transition: .2s;
}

    .noti-item:hover {
        background: #f8fafc;
    }

.noti-empty {
    padding: 20px;
    text-align: center;
    color: gray;
}

.leido {
    opacity: .5;
    text-decoration: line-through;
}

/* =====================================================
   BREADCRUMB
===================================================== */

.breadcrumb-bar {
    background: white;
    padding: 12px 22px;
    border-bottom: 1px solid #e5e7eb;
    margin-top: var(--navbar-height);
}

.breadcrumb {
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--erp-primary);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb-item.active {
    color: #64748b;
}

/* =====================================================
   TOGGLER
===================================================== */

.navbar-toggler {
    border: 1px solid rgba(255,255,255,.1);
    padding: 8px 10px;
    border-radius: 12px;
}

    .navbar-toggler:focus {
        box-shadow: none;
    }

.navbar-toggler-icon {
    filter: invert(1);
}

/* =====================================================
   SCROLLBAR
===================================================== */

.offcanvas-erp::-webkit-scrollbar,
.offcanvas-erp .offcanvas-body::-webkit-scrollbar {
    width: 8px;
}

.offcanvas-erp::-webkit-scrollbar-thumb,
.offcanvas-erp .offcanvas-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 20px;
}

/* =====================================================
   ANIMATION
===================================================== */

@keyframes erpDropdown {

    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   MOBILE FIXES
===================================================== */

@media (max-width: 991.98px) {

    .navbar-erp {
        padding: 0 14px;
    }

    .breadcrumb-bar {
        padding: 10px 14px;
    }

    .offcanvas-backdrop.show {
        opacity: .55;
    }
}


@media (min-width: 992px) {

    .navbar-erp .dropdown {
        position: relative;
    }

    .navbar-erp .dropdown-menu {
        position: absolute !important;
        top: 100%;
        left: 0;
        margin-top: 10px;
        display: none;
        min-width: 260px;
        padding: 12px;
        background: #1e293b;
        border: 1px solid rgba(255,255,255,.06);
        border-radius: 16px;
        box-shadow: 0 20px 40px rgba(0,0,0,.35);
        z-index: 99999;
        animation: erpDropdown .18s ease;
    }

        .navbar-erp .dropdown-menu.show {
            display: block;
        }
}

/* =====================================================
   MOBILE OFFCANVAS
===================================================== */

@media (max-width: 991.98px) {

    .offcanvas-erp {
        width: 320px !important;
        background: #172554 !important;
        overflow: hidden;
    }

        .offcanvas-erp .offcanvas-body {
            overflow-y: auto;
            overflow-x: hidden;
            padding-bottom: 30px;
        }

        .offcanvas-erp .dropdown-menu {
            position: static !important;
            transform: none !important;
            width: 100%;
            margin-top: 8px;
            background: rgba(255,255,255,.05);
            border: none;
            border-radius: 14px;
            padding: 8px;
            display: none;
        }

            .offcanvas-erp .dropdown-menu.show {
                display: block;
            }

        .offcanvas-erp .dropdown-item {
            color: rgba(255,255,255,.85) !important;
            border-radius: 10px;
            padding: 10px 12px;
        }

            .offcanvas-erp .dropdown-item:hover {
                background: rgba(255,255,255,.08);
                color: white !important;
            }
}

/* =====================================================
   GLOBAL DROPDOWN FIX (ANTI-CORTE)
===================================================== */

body,
main,
.wrapper,
.content,
.container-fluid {
    overflow-x: visible !important;
}

/* =========================================
   FIX DROPDOWN NAVBAR (REAL)
========================================= */

.navbar-erp {
    position: fixed; /* mantiene fixed-top correctamente */
    top: 0;
    left: 0;
    right: 0;
    min-height: 70px;
    overflow: visible !important;
    z-index: 1050;
}

    /* CLAVE: permitir que el dropdown salga */
    .navbar-erp .container-fluid,
    .navbar-erp .navbar-collapse,
    .navbar-erp .offcanvas-body {
        overflow: visible !important;
    }


@media (max-width: 991.98px) {

    /* quitar restricciones de bootstrap */
    .offcanvas-erp .navbar-nav {
        width: 100%;
        padding: 0;
        margin: 0;
        gap: 10px;
    }

    .offcanvas-erp .nav-item {
        width: 100%;
    }

    .offcanvas-erp .nav-link {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        border-radius: 14px;
    }

    /* 🔥 dropdown ocupa todo */
    .offcanvas-erp .dropdown-menu {
        width: 100%;
        margin: 6px 0 0 0;
        padding: 6px;
        background: rgba(255,255,255,.04);
        border-radius: 12px;
    }

    .offcanvas-erp .dropdown-item {
        width: 100%;
        display: block;
    }
}

@media (max-width: 991.98px) {

    .offcanvas-erp .dropdown-menu {
        display: none;
        width: 100%;
        margin-top: 6px;
        background: rgba(255,255,255,.05);
        border-radius: 12px;
        padding: 6px;
    }

        .offcanvas-erp .dropdown-menu.show {
            display: block;
        }
}

.offcanvas-erp .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* 🔥 empuja la X a la derecha */
    width: 100%;
}

    .offcanvas-erp .offcanvas-header .btn-close {
        margin-left: auto; /* refuerzo */
    }


@media (min-width: 992px) {

    .navbar-erp .dropdown-menu {
        min-width: 220px; /* 🔽 antes 260–280 */
        padding: 8px; /* 🔽 menos padding */
        border-radius: 12px; /* más sutil */
    }

    .navbar-erp .dropdown-item {
        padding: 8px 12px; /* 🔽 más compacto */
        font-size: 0.85rem; /* 🔽 más pequeño */
        border-radius: 8px;
    }

    .navbar-erp .dropdown-header {
        font-size: 0.65rem; /* 🔽 más pequeño */
        padding: 6px 10px;
        margin-bottom: 4px;
    }

    .navbar-erp .dropdown-divider {
        margin: 6px 0; /* 🔽 menos espacio */
    }
}

@media (min-width: 992px) {

    .navbar-erp .dropdown-menu {
        backdrop-filter: blur(6px); /* efecto moderno */
    }

    .navbar-erp .dropdown-item:hover {
        background: rgba(255,255,255,.06);
        transform: translateX(2px); /* micro animación */
    }
}

.navbar-erp .dropdown-item {
    line-height: 1.2;
}

.menu-icon {
    width: 22px;
    height: 16px;
    position: relative;
}

    .menu-icon span {
        position: absolute;
        width: 100%;
        height: 2px;
        background: white;
        left: 0;
        transition: .3s;
    }

        .menu-icon span:nth-child(1) {
            top: 0;
        }

        .menu-icon span:nth-child(2) {
            top: 7px;
        }

        .menu-icon span:nth-child(3) {
            bottom: 0;
        }

/* animación cuando abre */
.navbar-toggler[aria-expanded="true"] .menu-icon span:nth-child(1) {
    transform: rotate(45deg);
    top: 7px;
}

.navbar-toggler[aria-expanded="true"] .menu-icon span:nth-child(2) {
    opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .menu-icon span:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 7px;
}

/* CONTENEDOR */
.detalle-header {
    position: relative;
    background: #ffffff;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    /* 🔥 SOMBRA PRO (clave) */
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

    /* 🔥 ACENTO SUPERIOR (MUY PRO) */
    .detalle-header::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #494e5a, #494e5a);
    }

    /* 🔥 EFECTO SUAVE DE LUZ */
    .detalle-header::after {
        content: "";
        position: absolute;
        top: -40px;
        right: -40px;
        width: 120px;
        height: 120px;
        background: radial-gradient(circle, rgba(37,99,235,.08), transparent 70%);
    }

    .detalle-header:hover {
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
        transform: translateY(-1px);
        transition: all .25s ease;
    }

/* ICONO */
.header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(37,99,235,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 18px;
}

/* TITULO */
.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

/* SUBTITULO */
.header-subtitle {
    color: #64748b;
    font-size: .85rem;
}

.erp-breadcrumb-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 18px;
    margin: 70px 15px 10px 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid #eef1f5;
}

/* IZQUIERDA */
.erp-breadcrumb-left {
    display: flex;
    align-items: center;
}

/* DERECHA */
.erp-breadcrumb-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ITEMS DE INFO */
.erp-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #6b7280;
    background: #f8fafc;
    padding: 5px 10px;
    border-radius: 20px;
}

    /* ICONOS */
    .erp-meta i {
        color: #3b82f6;
    }

/* BREADCRUMB */
.breadcrumb {
    background: transparent;
}

.breadcrumb-item a {
    color: #6b7280;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #1f2937;
}

/* HOVER */
.breadcrumb-link:hover {
    color: #3b82f6;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .erp-breadcrumb-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .erp-breadcrumb-right {
        width: 100%;
        justify-content: flex-start;
    }
}

/* CONTENEDOR PRINCIPAL */
.erp-filtro-global {
    width: 100%;
    background: #ffffff;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.05);
}

/* HEADER */
.erp-filtro-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

    .erp-filtro-header i {
        font-size: 14px;
        color: #3b82f6;
    }

/* BODY GRID */
.erp-filtro-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* CAMPOS */
.erp-field {
    display: flex;
    flex-direction: column;
}

    .erp-field label {
        font-size: 11px;
        font-weight: 600;
        color: #64748b;
        margin-bottom: 2px;
    }

    /* SELECTS */
    .erp-field select {
        height: 32px;
        font-size: 12px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        transition: all 0.2s ease;
    }

        .erp-field select:focus {
            border-color: #3b82f6;
            box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
        }

/* RESPONSIVE */
@media (max-width: 992px) {
    .erp-filtro-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .erp-filtro-body {
        grid-template-columns: 1fr;
    }
}