/* ============================================
   ITEMS PRINCIPALES
============================================ */
.sidebar-item {
    width: 100%;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: none;
    color: #374151;
    font-size: .95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all .15s ease;
}

.sidebar-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-item:hover {
    background: #f3f4f6;
}

.sidebar-item.active {
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 600;
}

/* Ocultar texto en mini */
.sidebar.sidebar-mini .sidebar-item span {
    opacity: 0;
    pointer-events: none;
}

.sidebar.sidebar-mini:hover .sidebar-item span {
    opacity: 1;
}

/* Centrar iconos en mini */
.sidebar.sidebar-mini .sidebar-item {
    justify-content: center;
}

.sidebar.sidebar-mini:hover .sidebar-item {
    justify-content: flex-start;
}

/* ============================================
   CHEVRON (colapsables)
============================================ */
.sidebar-collapse-toggle {
    justify-content: left;
}

.sidebar-collapse-toggle .chevron {
    transition: transform .2s ease;
}

.sidebar-collapse-toggle[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.sidebar.sidebar-mini .chevron {
    opacity: 0;
    pointer-events: none;
}

.sidebar.sidebar-mini:hover .chevron {
    opacity: 1;
}

/* ============================================
   SUBITEMS
============================================ */
.sidebar-subitem {
    padding: 8px 16px 8px 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4b5563;
    font-size: .9rem;
    border-radius: 6px;
    transition: all .15s ease;
}

.sidebar-subitem i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.sidebar-subitem:hover {
    background: #f3f4f6;
}

.sidebar-subitem.active {
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 600;
}

/* Ocultar texto en mini */
.sidebar.sidebar-mini .sidebar-subitem span {
    opacity: 0;
    pointer-events: none;
}

.sidebar.sidebar-mini:hover .sidebar-subitem span {
    opacity: 1;
}

/* Centrar iconos en mini */
.sidebar.sidebar-mini .sidebar-subitem {
    padding-left: 0 !important;
    justify-content: center !important;
}

.sidebar.sidebar-mini:hover .sidebar-subitem {
    padding-left: 48px !important;
    justify-content: flex-start !important;
}

/* ============================================
   FIX — RESET TOTAL EN MINI
============================================ */
.sidebar.sidebar-mini .sidebar-item,
.sidebar.sidebar-mini .sidebar-subitem,
.sidebar.sidebar-mini .sidebar-collapse-toggle {
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
}

.sidebar.sidebar-mini .sidebar-item i,
.sidebar.sidebar-mini .sidebar-subitem i {
    margin-right: 0 !important;
}

/* ============================================
   TOOLTIP AUTOMÁTICO EN MODO MINI
============================================ */
.sidebar.sidebar-mini .sidebar-item[title],
.sidebar.sidebar-mini .sidebar-subitem[title] {
    position: relative;
}

.sidebar.sidebar-mini .sidebar-item:hover::after,
.sidebar.sidebar-mini .sidebar-subitem:hover::after {
    content: attr(title);
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: #111827;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: .75rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    opacity: 1;
    pointer-events: none;
}

/* ============================================
   LAYOUT — AJUSTE DEL CONTENIDO
============================================ */
.main-wrapper {
    margin-left: 240px;
    transition: margin-left .25s ease;
}

.sidebar.sidebar-mini ~ .main-wrapper {
    margin-left: 72px;
}

.sidebar.sidebar-mini:hover ~ .main-wrapper {
    margin-left: 240px;
}

/* ============================================
   RESPONSIVE — MÓVIL
============================================ */
@media (max-width: 992px) {
    .sidebar {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
}

.container-xl {
    max-width: 100% !important;
}

/* ============================================
   HEADER STICKY DEL DASHBOARD
============================================ */
.dashboard-sticky-header {
    /*
    position: sticky;
    top: 0;
    z-index: 50;
    */
    background: #ffffff;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    margin-bottom:20px;
}

/* ============================================================
   RESPONSIVE THEME FOR MOBILE & TABLETS
   Optimizado para ERP corporativo
============================================================ */

/* ------------------------------
   MOBILE FIRST (max-width: 576px)
------------------------------ */
@media (max-width: 576px) {

    body {
        padding: 0 10px;
    }

    /* Header sticky más compacto */
    .dashboard-sticky-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dashboard-sticky-header h1 {
        font-size: 1.2rem;
    }

    .dashboard-sticky-header .btn-group {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    /* Cards apiladas */
    .card {
        margin-bottom: 12px;
    }

    /* KPIs más compactos */
    .card .card-body h3 {
        font-size: 1.4rem;
    }

    /* Tablas convertidas en listas */
    table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        border-radius: 8px;
    }

    table.table thead {
        display: none;
    }

    table.table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: #fff;
    }

    table.table tbody tr td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border: none !important;
    }

    table.table tbody tr td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
    }

    /* Botones full-width */
    .btn,
    .btn-group .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    /* Listas más cómodas */
    .list-group-item {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    /* Formularios */
    .form-control,
    .form-select {
        font-size: 1rem;
        padding: 10px 12px;
    }

    /* Modales */
    .modal-dialog {
        margin: 0;
        width: 100%;
        max-width: none;
    }

    .modal-content {
        border-radius: 0;
        height: 100vh;
    }

    /* Gráficas */
    canvas {
        max-height: 260px !important;
    }
}

/* ------------------------------
   TABLETS (max-width: 768px)
------------------------------ */
@media (max-width: 768px) {

    .dashboard-sticky-header {
        padding: 14px 18px;
    }

    .btn-group .btn {
        flex: 1;
        margin: 0 4px;
    }

    .card .card-body h3 {
        font-size: 1.6rem;
    }

    canvas {
        max-height: 300px;
    }
}

/* ------------------------------
   SMALL LAPTOPS (max-width: 992px)
------------------------------ */
@media (max-width: 992px) {

    .dashboard-sticky-header {
        padding: 16px 20px;
    }

    .btn-group .btn {
        padding: 6px 10px;
    }

    .card {
        margin-bottom: 16px;
    }
}

/* ------------------------------
   LARGE DESKTOPS (min-width: 1400px)
------------------------------ */
@media (min-width: 1400px) {

    .container,
    .dashboard-container {
        max-width: 1400px;
    }

    .card .card-body h3 {
        font-size: 2rem;
    }

    canvas {
        max-height: 360px;
    }
}

a i, button i {
    margin-right: 10px;
}

.btn-icon i {
    margin-right: 0!important;
}


/* ============================================
   AUTOCOMPLETE
============================================ */
.autocomplete-list {
    position: absolute;
    background: #f6f6f6;
    border: 1px solid #ccc;
    width: 100%;
    z-index: 9999999;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}
.is-invalid {
    border-color: #dc3545 !important;
}

/* ============================
   FIX TOASTR + BOOTSTRAP 5
   ============================ */

.toast-success {
    background-color: #28a745 !important;
}

.toast-error {
    background-color: #dc3545 !important;
}

.toast-info {
    background-color: #17a2b8 !important;
}

.toast-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}


#frmBuscador {
    flex: 1;
    max-width: 600px;
}

#frmBuscador .form-control {
  height: 42px;
  font-size: 1rem;
}
