:root {
    --dark: #006F9D;
    --dark-x: #1e2126;
    --light: #ffffff;
    --primary: #111B54;
    --secundary: #f80404;
    --grey: #efefef;
}

body {
    overflow: hidden;
    font-family: 'Muli', sans-serif;
    font-weight: 300;
    color: var(--primary);
}

.bg-dark {
    background-color: var(--dark) !important;
}

.bg-dark-x {
    background-color: var(--dark-x);
}

.bg-mix {
    background: linear-gradient(180deg, var(--light) 50%, var(--grey) 0);
}

.bg-grey {
    background-color: var(--grey) !important;
}

table th {
    background-color: #337ab7 !important;
    color: white;
}

table>tbody>tr>td {
    vertical-align: middle !important;
}

.btn-group,
.btn-group-vertical {
    position: absolute !important;
}

.btn {
    border: 0;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary);
}

.txt-primary {
    color: var(--primary);
}

.txt-secundary {
    color: var(--secundary);
}

.stat {
    border-right: 1px solid var(--grey);
}

.form-control,
.btn {
    min-height: 2.125rem;
    line-height: initial;
}

.img-1 {
    background-image: url(../image/img_01.jpg);
    background-size: cover;
    background-position: center;
}

.img-2 {
    background-image: url(../image/img_02.jpg);
    background-size: cover;
    background-position: center;
}

.img-3 {
    background-image: url(../image/img_03.jpg);
    background-size: cover;
    background-position: center;
}

.img-4 {
    background-image: url(../image/img_04.jpg);
    background-size: cover;
    background-position: center;
}

.img-5 {
    background-image: url(../image/img_05.jpg);
    background-size: cover;
    background-position: center;
}

.img-6 {
    background-image: url(../image/img_06.jpg);
    background-size: cover;
    background-position: center;
}

.img-7 {
    background-image: url(../image/img_07.png);
    background-size: cover;
    background-position: center;
}

.img-8 {
    background-image: url(../image/img_08.png);
    background-size: cover;
    background-position: center;
}

.img-9 {
    background-image: url(../image/img_09.png);
    background-size: cover;
    background-position: center;
}

.img-caja {
    background-image: url(../image/logo_cms.png);
    background-size: auto;
    background-position: center;
}

.x-small {
    font-size: 12px;
}

.m-small {
    font-size: 10px;
}

.s-small {
    font-size: 8px;
}

.bg-primary {
    background-color: var(--primary) !important;
}


/* ========================================
   NAV-SCROLLER MEJORADO
   ======================================== */

.nav-scroller {
    z-index: 1001;
    width: 18rem;
    height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
    color: rgba(255, 255, 255, 0.519);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}


/* Scrollbar personalizado para WebKit */

.nav-scroller::-webkit-scrollbar {
    width: 6px;
}

.nav-scroller::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.nav-scroller::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.nav-scroller::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}


/* ========================================
   SIDEBAR CONTAINER MEJORADO
   ======================================== */

#sidebar-container {
    min-height: 100vh;
    margin-left: -18rem !important;
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

#sidebar-container.show {
    margin-left: 0 !important;
}

#sidebar-container .logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    text-align: center;
}

#sidebar-container .logo img {
    max-width: 100%;
    height: auto;
    filter: brightness(1.1);
    transition: all 0.3s ease;
}

#sidebar-container .logo img:hover {
    filter: brightness(1.2);
    transform: scale(1.02);
}

#sidebar-container .menu {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

#sidebar-container .menu li {
    position: relative;
    margin: 0;
    padding: 0;
}

#sidebar-container .menu li ul {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    border-left: 2px solid #3498db;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

#sidebar-container .menu li.activado>ul {
    display: block;
    max-height: 1000px;
    padding: 0.5rem 0;
}

#sidebar-container .menu li a:hover {
    background: #3498db;
    color: #ffffff !important;
    border-left: 3px solid #2980b9;
    transform: translateX(2px);
}


/* Works on Chrome, Edge, and Safari */

*::-webkit-scrollbar {
    width: 10px;
}

*::-webkit-scrollbar-track {
    background: #006F9D;
}

*::-webkit-scrollbar-thumb {
    background-color: #CCC;
    border-radius: 20px;
    border: 3px solid #006F9D;
}


/* ========================================
   ELEMENTOS DEL MENÚ MEJORADOS
   ======================================== */

.sidebar-link {
    display: flex;
    align-items: center;
    width: 100%;
}

.sidebar-link .rigt-icon {
    display: inline-flex;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
}

.sidebar-link[aria-expanded="true"] .rigt-icon {
    transform: rotate(180deg);
}


/* Iconos del menú */

.menu li>a i {
    font-size: 16px;
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.menu li ul li a i {
    font-size: 12px;
    margin-right: 0.5rem;
    width: 12px;
}


/* Texto del menú */

.menu li>a span:not(.rigt-icon) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Divisores del menú */

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 0.6;
    height: 1px;
}


/* Elementos activos */

.menu li.activado>a {
    background: #2980b9;
    color: #ffffff;
    border-left: 3px solid #ffffff;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.menu li.activado>a i {
    color: #ffffff;
    transform: scale(1.05);
}

.menu li.activado>a .rigt-icon i {
    transform: rotate(180deg);
    color: #ffffff;
}


/* Navbar links */

.nav-link {
    color: #f5f5f5 !important;
    padding: 10px 15px !important;
    font-size: 14px;
    font-weight: 500;
}


/* Dropdown del usuario - Mayor especificidad */

.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle {
    color: #616161 !important;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:hover {
    color: #616161 !important;
    background: rgba(255, 255, 255, 1) !important;
    transform: translateY(-1px);
}

.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:focus {
    color: #616161 !important;
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.25);
}


/* Dropdown menu del usuario */

.navbar-nav .dropdown-menu {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    margin-top: 5px;
}

.navbar-nav .dropdown-menu .dropdown-item {
    color: #333333;
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.navbar-nav .dropdown-menu .dropdown-item:hover {
    background: #f8f9fa;
    color: #000000;
}

.navbar-nav .dropdown-menu .dropdown-item:focus {
    background: #e9ecef;
    color: #000000;
    outline: none;
}

.navbar-nav .dropdown-menu .dropdown-divider {
    margin: 4px 0;
    border-color: #dee2e6;
}


/* Estilo ultra específico para el dropdown del usuario */

.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle,
.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:link,
.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:visited {
    color: #616161 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    font-weight: bold !important;
    text-decoration: none !important;
}

.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:hover,
.navbar .navbar-nav .nav-item.dropdown .nav-link.dropdown-toggle:focus {
    color: #616161 !important;
    background: rgba(255, 255, 255, 1) !important;
    text-decoration: none !important;
}


/* Header alineado verticalmente */

.navbar .container-fluid {
    min-height: 60px;
}

.navbar #buscarCliente {
    position: relative;
    margin: 0 auto;
}

.navbar #buscarCliente .form-control {
    border-radius: 25px;
    padding-left: 15px;
    padding-right: 50px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar #buscarCliente .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.navbar #buscarCliente .editBtn {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #007bff;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.navbar #buscarCliente .editBtn:hover {
    background: #0056b3;
    transform: translateY(-50%) scale(1.05);
}


/* Responsive design */

@media (max-width: 768px) {
    .menu li>a {
        padding: 8px 12px;
        font-size: 13px;
    }
    /* Header responsive */
    .navbar .container-fluid {
        flex-direction: column;
        align-items: stretch;
    }
    .navbar #buscarCliente {
        order: 3;
        width: 100%;
        margin: 10px 0;
        max-width: 100%;
    }
    .navbar .navbar-toggler {
        order: 1;
    }
    .navbar .navbar-collapse {
        order: 2;
    }
}

.menu li ul li a {
    padding: 6px 12px 6px 20px;
    font-size: 11px;
}

.menu li>a i {
    font-size: 14px;
    margin-right: 0.5rem;
    width: 14px;
}

.nav-scroller {
    height: calc(100vh - 180px);
}

@media (max-width: 480px) {
    .menu li>a {
        padding: 6px 8px;
        font-size: 12px;
    }
    .menu li ul li a {
        padding: 5px 8px 5px 18px;
        font-size: 10px;
    }
    .menu li>a i {
        font-size: 12px;
        margin-right: 0.5rem;
        width: 12px;
    }
    .nav-scroller {
        height: calc(100vh - 160px);
    }
}

.btn-search {
    right: 0;
}

#content {
    overflow-y: auto;
    height: 100vh;
    padding-bottom: 5rem;
}

#content-wrapper {
    transition: all 0.3s;
}

#content-wrapper.toggled #sidebar-container {
    margin-left: 0 !important;
}

@media (min-width: 768px) {
    #sidebar-container {
        margin-left: 0;
    }
    #page-container {
        min-width: 0;
        width: 100%;
    }
    #content-wrapper.toggled #sidebar-container {
        margin-left: -18rem;
    }
}


/* ========================================
   ESTILOS PROFESIONALES PARA EL MENÚ
   ======================================== */

.menu {
    padding: 0;
    margin: 0;
    list-style: none;
    width: 100%;
}

.menu li {
    list-style: none;
    position: relative;
    margin: 0;
    padding: 0;
}

.menu li>a {
    color: #f5f5f5;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
}

.menu li>a:hover {
    background: #1a95d5;
    color: #ffffff;
    border-left-color: #007bff;
    transform: translateX(2px);
}

.menu li ul {
    background-color: rgba(0, 0, 0, 0.1);
    border-left: 2px solid #007bff;
}

.menu li.activado>a {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #007bff;
    color: #ffffff;
}

.menu li ul li a {
    padding: 8px 15px 8px 25px;
    color: #e4e4e4;
    font-size: 12px;
    border-left: 2px solid transparent;
    position: relative;
}

.menu li ul li a::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #e4e4e4;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.menu li ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: #1a95d5;
    padding-left: 30px;
}

.menu li ul li a:hover::before {
    background: #ffffff;
    transform: translateY(-50%) scale(1.2);
}

.sidebar-link {
    display: flex;
    align-items: center;
}

.menu li.active>a .icon.ion-ios-arrow-down {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.nav-link {
    color: #f5f5f5;
}

.sidebar-link:not([aria-expanded="true"])+ul {
    display: none;
}

.dropdown-divider {
    opacity: 0.5;
}

#sidebar-container .menu li ul {
    display: none;
}

#sidebar-container .menu li.activado>ul {
    display: block;
}

.menu li.activado>a .rigt-icon i.ion-ios-arrow-down {
    transform: rotate(180deg);
}


/* ========================================
   CORRECCIÓN SIMPLE DE Z-INDEX
   ======================================== */


/* Solo asegurar que los enlaces de submenú sean clickeables */

.menu li ul li a {
    position: relative;
    z-index: 1000;
    pointer-events: auto;
}