/* =========================================================
   CONFIGURACIÓN GENERAL
   ========================================================= */

body {
    margin-top: 4rem;
    font-size: .875rem;
}

h1,
h2,
h3,
h4,
h5 {
    font-weight: 300;
    line-height: 1.2;
}


/* =========================================================
   CAMPOS NUMÉRICOS
   Oculta los controles laterales de los input number
   ========================================================= */

/* Chrome, Safari, Edge y Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

/* Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}


/* =========================================================
   BOTONES
   ========================================================= */

.btn {
    border-style: solid;
    border-width: 1px;
}


/* =========================================================
   MENÚS Y NAVEGACIÓN
   ========================================================= */

div nav ul {
    overflow: hidden;
    list-style: none;
}

div ul li a {
    display: block;
    padding: 20px;
    color: #333;
    font-weight: 500;
    text-decoration: none;
}

div ul li span {
    margin-right: 10px;
}

div li ul {
    display: none;
    padding-left: 15px;
}

.navbar {
    height: 4rem;
}

#navbarNavDropdown > p {
    height: 2rem;
}

.sidebar {
    position: fixed;
    top: 4rem;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    background-color: #fff;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.url_main_menu,
.btn_main_menu {
    padding: 0 10px;
    color: #000;
    text-align: left;
    white-space: pre-wrap;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
}

.url_main_menu.active_link,
.url_main_menu:hover,
.btn_main_menu:hover {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    background-color: #d3d3d3;
}


/* =========================================================
   AUTOCOMPLETE
   ========================================================= */

.ui-widget.ui-widget-content {
    z-index: 2000;
}

.ui-autocomplete-loading {
    background-color: #fff;
    background-image: url("./images/16x16.gif");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
}


/* =========================================================
   COMBOBOX PERSONALIZADO
   ========================================================= */

.custom-combobox {
    position: relative;
    display: inline-block;
}

.custom-combobox-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    margin-left: -1px;
    padding: 0;
}

.custom-combobox-input {
    margin: 0;
    padding: 5px 10px;
    background-color: #fff;
}


/* =========================================================
   MODALES
   ========================================================= */

.modal-fullscreen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    margin: 0;
}

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


/* =========================================================
   MENSAJES GENERALES
   ========================================================= */

#msg {
    position: fixed;
    top: 50px;
    left: 50%;
    z-index: 2100;
    width: 500px;
    max-width: calc(100% - 30px);
    padding: 5px;
    color: #fff;
    font-weight: bold;
    text-align: center;
    transform: translateX(-50%);
}


/* =========================================================
   COLORES PARA FILAS
   ========================================================= */

.row-danger {
    background-color: #f8d7da !important;
}

.row-warning {
    background-color: #fff3cd !important;
}

.row-success {
    background-color: #d4edda !important;
}

.row-info {
    background-color: #d1ecf1 !important;
}


/* =========================================================
   RESALTADO DINÁMICO AL FILTRAR
   ========================================================= */

.row-filter-hit {
    box-shadow: inset 0 0 0 9999px rgba(255, 235, 59, .22);
}


/* =========================================================
   COMPONENTES GENERALES DE REPORTES
   ========================================================= */

.tarjeta-reporte {
    border: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
}

.tarjeta-reporte .card-header {
    background-color: #fff;
}

.titulo-reporte {
    margin-bottom: .25rem;
}

.descripcion-reporte {
    margin-bottom: 0;
    color: #6c757d;
}

.chart-container {
    position: relative;
    min-height: 360px;
}

.resumen-consulta {
    min-width: 150px;
}


/* =========================================================
   TARJETAS UTILIZADAS COMO SELECTORES
   ========================================================= */

.selector-reporte,
.selector-clientes,
.tarjeta-canal {
    cursor: pointer;
    transition:
        box-shadow .2s ease,
        transform .2s ease,
        background-color .2s ease;
}

.selector-reporte:hover,
.selector-clientes:hover,
.tarjeta-canal:hover {
    text-decoration: none;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .13) !important;
    transform: translateY(-2px);
}

.selector-reporte-activo,
.selector-clientes-activo,
.tarjeta-canal-activa {
    border-width: 2px !important;
    background-color: #f8f9fa;
}

.indicador-reporte,
.indicador-canal {
    font-weight: 500;
}


/* =========================================================
   BLOQUES EXPLICATIVOS
   ========================================================= */

.regla-reporte,
.regla-diferencia {
    background-color: #f8f9fa;
}

.tabla-ejemplo {
    max-width: 420px;
}

.indicador-cliente {
    border-left: 4px solid #007bff;
}

.indicador-cliente h3 {
    font-weight: 600;
}


/* =========================================================
   TABLAS DE REPORTES
   ========================================================= */

.table th,
.table td {
    vertical-align: middle;
}

.tabla-reporte-responsive {
    overflow-x: auto;
}

.tabla-mensual {
    overflow: auto;
    max-height: 72vh;
}

.tabla-mensual table {
    margin-bottom: 0;
    white-space: nowrap;
}

.tabla-mensual table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #fff;
}

.tabla-mensual table th:first-child,
.tabla-mensual table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 180px;
    white-space: normal;
    background-color: #fff;
}

.tabla-mensual table thead th:first-child {
    z-index: 3;
}

.tabla-mensual table tbody tr:hover td,
.tabla-mensual table tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}


/* =========================================================
   VALORES POSITIVOS, NEGATIVOS Y NEUTROS
   ========================================================= */

.valor-positivo {
    color: #28a745;
    font-weight: 600;
}

.valor-negativo {
    color: #dc3545;
    font-weight: 600;
}

.valor-cero {
    color: #6c757d;
    font-weight: 600;
}


/* =========================================================
   ESTADOS VACÍOS
   ========================================================= */

.estado-vacio {
    padding: 3rem 1rem;
    color: #6c757d;
    text-align: center;
}

.estado-vacio i {
    margin-bottom: 1rem;
    font-size: 3rem;
}

.estado-vacio h5 {
    margin-bottom: .5rem;
}

.estado-vacio p {
    margin-bottom: 0;
}


/* =========================================================
   CONTENEDORES DE DETALLE CARGADOS POR AJAX
   ========================================================= */

.detalle-vendedor:empty,
.contenedor-detalle:empty {
    display: none;
}


/* =========================================================
   AJUSTES RESPONSIVE
   ========================================================= */

@media (max-width: 767.98px) {

    body {
        margin-top: 4rem;
    }

    .chart-container {
        min-height: 310px;
    }

    .tabla-mensual {
        max-height: none;
    }

    #msg {
        width: calc(100% - 30px);
    }
}

/* =========================================================
   DASHBOARD DE VENTAS POR HORA
   ========================================================= */

.kpi-hora .card-body {
    min-width: 0;
}

.kpi-hora .kpi-icono {
    flex: 0 0 36px;
    width: 36px;
    text-align: center;
}

.kpi-hora .kpi-contenido {
    min-width: 0;
    flex: 1;
}

.kpi-hora .kpi-valor {
    margin-bottom: .25rem;
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.kpi-hora .kpi-descripcion {
    display: block;
    line-height: 1.35;
}

.tabla-horas {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
}

.tabla-horas table {
    min-width: max-content;
    margin-bottom: 0;
    white-space: nowrap;
}

.tabla-horas th,
.tabla-horas td {
    min-width: 104px;
    padding: .55rem .65rem;
    font-size: .82rem;
}

.tabla-horas th:first-child,
.tabla-horas td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 120px;
    background-color: #fff;
    box-shadow: 1px 0 0 #dee2e6;
}

.tabla-horas thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: #e9ecef;
    box-shadow: 0 1px 0 #ced4da;
}

.tabla-horas thead th:first-child {
    z-index: 4;
    background-color: #e9ecef;
}

.tabla-horas tbody tr:nth-child(even) td {
    background-color: #f8f9fa;
}

.tabla-horas tbody tr:nth-child(even) td:first-child {
    background-color: #f8f9fa;
}

.tabla-horas tbody tr:hover td {
    background-color: #eaf4ff;
}

.tabla-horas tbody tr:hover td:first-child {
    background-color: #eaf4ff;
}

.tabla-horas .celda-detalle-hora {
    position: relative;
    color: #212529;
    font-weight: 500;
    transition:
        background-color .15s ease,
        color .15s ease;
}

.tabla-horas .celda-detalle-hora:hover {
    color: #0056b3;
    background-color: #d9ecff !important;
}

.tabla-horas .celda-detalle-hora::after {
    margin-left: .35rem;
    color: #007bff;
    font-family: "Font Awesome 5 Free";
    font-size: .7rem;
    font-weight: 900;
    content: "\f002";
    opacity: 0;
    transition: opacity .15s ease;
}

.tabla-horas .celda-detalle-hora:hover::after {
    opacity: 1;
}

.tabla-horas .columna-total {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 115px;
    background-color: #f8f9fa;
    box-shadow: -1px 0 0 #dee2e6;
}

.tabla-horas thead .columna-total {
    z-index: 4;
    background-color: #e9ecef;
}

.tabla-horas tbody tr:hover .columna-total {
    background-color: #eaf4ff;
}

@media (max-width: 1199.98px) {

    .kpi-hora .kpi-valor {
        font-size: 1.25rem;
    }
}

/* =========================================================
   MAPA DE DOMICILIOS Y COBERTURA POR SUCURSAL
   ========================================================= */

.mapa-domicilios {
    position: relative;
    min-height: 610px;
    overflow: hidden;
    background-color: #e9ecef;
}

.mapa-domicilios #map {
    width: 100%;
    height: 610px;
}

.mapa-controles {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    padding: .35rem;
    background-color: rgba(255, 255, 255, .98);
    border: 1px solid #ced4da;
    border-radius: .45rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.mapa-controles .btn {
    min-width: 100px;
}

.mapa-resumen {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 5;
    width: 285px;
    padding: 1rem;
    color: #fff;
    background-color: rgba(33, 37, 41, .92);
    border-radius: .45rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

.mapa-resumen h5 {
    color: #fff;
}

.mapa-resumen-dato {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.mapa-resumen-dato:last-child {
    border-bottom: 0;
}

.mapa-resumen-dato strong {
    min-width: 36px;
    text-align: right;
}

.mapa-cargando {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10;
    padding: 1rem 1.5rem;
    text-align: center;
    background-color: rgba(255, 255, 255, .97);
    border-radius: .45rem;
    box-shadow: 0 3px 15px rgba(0, 0, 0, .2);
    transform: translate(-50%, -50%);
}

.leyenda-mapa {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.leyenda-mapa-item {
    display: flex;
    align-items: center;
    margin-right: 1.25rem;
    margin-bottom: .35rem;
    font-size: .85rem;
}

.leyenda-mapa-punto {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: .45rem;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #6c757d;
}

.leyenda-mapa-punto.cliente {
    background-color: #0056b3;
}

.leyenda-mapa-punto.repetido {
    background-color: #198754;
}

.leyenda-mapa-punto.sucursal {
    background-color: #e8590c;
}

.tabla-cobertura-sucursales tbody tr {
    cursor: pointer;
}

.tabla-cobertura-sucursales tbody tr:hover {
    background-color: #eaf4ff;
}

.tabla-cobertura-sucursales tbody tr.sucursal-seleccionada {
    background-color: #d9ecff;
}

.indicador-sucursal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #fff;
    background-color: #e8590c;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #adb5bd;
    font-size: .75rem;
    font-weight: 700;
}

@media (max-width: 767.98px) {

    .mapa-domicilios,
    .mapa-domicilios #map {
        min-height: 520px;
        height: 520px;
    }

    .mapa-controles {
        top: 10px;
        right: 10px;
        left: 10px;
        display: flex;
    }

    .mapa-controles .btn {
        flex: 1;
        min-width: 0;
        padding-right: .35rem;
        padding-left: .35rem;
        font-size: .75rem;
    }

    .mapa-resumen {
        right: 10px;
        bottom: 10px;
        left: 10px;
        width: auto;
        padding: .75rem;
    }

    .leyenda-mapa {
        margin-top: .75rem;
    }
}

/* ========================================
   FORMULARIO DE PRODUCTOS
   Separación visual entre secciones
   ======================================== */

.tarjeta-producto-seccion {
        border: 1px solid #d8dee5;
        border-radius: 7px;
        background-color: #ffffff;
        box-shadow: 0 3px 10px rgba(30, 48, 68, .08);
        overflow: hidden;
}

.tarjeta-producto-seccion > .card-header {
        padding: 14px 18px;
        border-bottom: 1px solid #d4dbe3;
        background-color: #f3f6f9;
}

.tarjeta-producto-seccion > .card-body {
        padding: 18px;
        background-color: #ffffff;
}

.tarjeta-producto-seccion + .tarjeta-producto-seccion {
        margin-top: 24px;
}