/* ==========================================================================
   1. ESTILOS BASE Y TIPOGRAFÍA (Estructura de la Plantilla)
   ========================================================================== */
html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 22px;
    }
}

/* ==========================================================================
   2. COMPONENTES FORMULARIOS Y FOCOS (Core Bootstrap Overrides)
   ========================================================================== */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ==========================================================================
   3. CONFIGURACIÓN DEL LAYOUT (Fijación del Footer)
   ========================================================================== */
html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 4.5rem; /* Al usar rem, acompaña proporcionalmente el tamaño de la letra */
}

/* ==========================================================================
   4. AJUSTES GLOBALES DE IDENTIDAD (Actualizado: 21/04/2026)
   ========================================================================== */
.text-danger {
    color: #d9534f !important;
}

.navbar-brand {
    font-size: 1.15rem;
}

.nav-link.active {
    border-bottom: 2px solid #d9534f;
}

/* ==========================================================================
   5. ESTÉTICA MODERNA PARA TABLAS (Tolvas y Ordenamiento DataTables)
   ========================================================================== */

/* Encabezados de la Tabla - Base Mobile First */
.thead-modern th {
    background-color: #f8f9fa !important;
    color: #495057;
    font-size: 0.8rem !important; /* Letra compacta en celulares para que entre todo */
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #dee2e6 !important;
    padding: 8px 6px !important; /* Menos espacio interno en celular */
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* Encabezados en Pantallas Grandes (PC / Escritorio) */
@media (min-width: 768px) {
    .thead-modern th {
        font-size: 1.1rem !important; /* Tu tamaño cómodo para escritorio */
        padding: 12px 8px !important;
    }
}

/* Agrandar el texto de las celdas para lectura Mobile */
#tablaTelefonos tbody td {
    font-size: 0.9rem !important; /* Ajustado para equilibrio visual con la cabecera */
    padding: 10px 8px !important;
    white-space: nowrap;
}

/* Forzar que la columna de acciones tenga espacio para respirar */
#tablaTelefonos th.no-sort,
#tablaTelefonos td:last-child {
    min-width: 90px !important;
    text-align: center;
}

.thead-modern th:hover {
    background-color: #f1f1f1 !important;
}

/* Iconos de Ordenamiento (Base Mobile First) */
.sort-icon {
    font-size: 0.6rem !important; /* Iconos más chicos en celular */
    margin-left: 2px;
    opacity: 0.4; /* Bajado un poco para que no compita tanto con el texto */
    transition: opacity 0.2s;
}

@media (min-width: 768px) {
    .sort-icon {
        font-size: 0.75rem !important; /* Tamaño original para PC */
        margin-left: 4px;
        opacity: 0.9;
    }
}

/* Resaltado de orden activo (inyectado por DataTables) */
.sorting_asc .sort-icon-asc,
.sorting_desc .sort-icon-desc {
    opacity: 1 !important;
    color: #d9534f !important;
}

/* Botón de la Tolva (Filtro desplegable - Base Mobile First) */
.filter-btn {
    color: #adb5bd;
    transition: all 0.2s ease;
    font-size: 0.75rem !important; /* Más chico en celular */
    cursor: pointer;
}

@media (min-width: 768px) {
    .filter-btn {
        font-size: 0.95rem !important; /* Tu tamaño original para PC */
    }
}

.filter-btn:hover,
.filter-btn.active {
    color: #d9534f;
    background-color: rgba(217, 83, 79, 0.05);
    border-radius: 4px;
}

/* Fila de filtros */
.filter-row {
    background-color: #ffffff;
}

    .filter-row input {
        border: 1px solid #ced4da;
        border-radius: 4px;
        padding: 4px 8px;
        font-size: 0.8rem;
        width: 100%;
        transition: border-color 0.2s;
    }

        .filter-row input:focus {
            border-color: #d9534f;
            outline: none;
            box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.1);
        }

/* Botones de acción dentro de celdas */
.btn-link:hover {
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

/* ==========================================================================
   6. COMPONENTES MAPA DE GEOLOCALIZACIÓN (Leaflet Popups)
   ========================================================================== */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}

.leaflet-popup-tip-container {
    display: none;
}
/* ==========================================================================
   7. OPTIMIZACIONES VISUALES Y CORRECCIONES MOBILE DE INTERFAZ
   ========================================================================== */

/* Reseteo general para evitar scrollbars fantasma */
.table-responsive {
    overflow-x: auto !important;
}

/* ==========================================================================
   >>> INICIO BLOQUE EXCLUSIVO MOBILE / SMARTPHONES (max-width: 767px) <<<
   Todo lo que modifiques aquí adentro SOLO afectará a los celulares.
   ========================================================================== */
@media (max-width: 767px) {

    /* ----------------------------------------------------------------------
       MÓDULO A: CONTENEDORES GENERALES Y SCROLL
       ---------------------------------------------------------------------- */
    /* Permite deslizar la tabla con el dedo si el contenido es muy ancho */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* ----------------------------------------------------------------------
       MÓDULO B: BOTONERA SUPERIOR ("Agregar persona" y "Actualizar")
       ---------------------------------------------------------------------- */
    .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    /* Reducción de escala para botones de acción principal */
    .btn-outline-primary,
    .btn-danger,
    a[href*="Create"],
    button.btn-primary,
    .d-flex > .btn {
        font-size: 0.85rem !important;
        padding: 6px 12px !important;
    }

    /* ----------------------------------------------------------------------
       MÓDULO C: TARJETA DE CAPACIDAD (Gris)
       ---------------------------------------------------------------------- */
    /* Mantiene los contadores arriba codo a codo, y manda el badge abajo */
    .card-body.d-flex {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-around !important;
        align-items: center !important;
        gap: 12px 0px !important;
        padding: 12px !important;
    }

    /* Contenedor del Badge: fuerza el salto de línea para centrarse abajo */
    .card-body .ms-auto {
        margin: 0 auto !important;
        width: 100% !important;
        text-align: center !important;
    }

        /* Diseño sutil y armónico del Badge (Capacidad Total) */
        .card-body .ms-auto .badge {
            font-size: 0.7rem !important;
            font-weight: 600 !important;
            color: #6c757d !important;
            background-color: #f8f9fa !important;
            border: 1px solid #e9ecef !important;
            padding: 4px 10px !important;
            display: inline-block !important;
        }

    /* ----------------------------------------------------------------------
       MÓDULO D: TABLAS, CABECERAS Y TOLVAS (Filtros)
       ---------------------------------------------------------------------- */
    /* 1. Celda de cabecera: texto en una sola línea con espacio para iconos */
    .thead-modern th {
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        padding-right: 28px !important;
    }

        /* 2. Flechas de ordenamiento (Asc/Desc) */
        .thead-modern th .sort-icon {
            font-size: 0.55rem !important;
            margin-left: 1px !important;
            display: inline-block !important;
        }

        /* 3. Tolva/Embudo de filtrado: Flota a la derecha para no romper el texto */
        .thead-modern th .filter-btn {
            position: absolute !important;
            right: 6px !important;
            top: 50% !important;
            transform: translateY(-50%) !important;
            font-size: 0.75rem !important;
            margin: 0 !important;
        }
}
/* >>> FIN BLOQUE MOBILE <<< */

/* ==========================================================================
   >>> INICIO BLOQUE EXCLUSIVO TABLET / PC (min-width: 768px) <<<
   ========================================================================== */
@media (min-width: 768px) {
    .table-responsive {
        overflow-x: hidden !important; /* Corte limpio en pantallas grandes */
    }
}



/* ==========================================================================
   ESTILOS REALS DE BOOTSTRAP 5 PARA LA PAGINACIÓN DE DATATABLES
   ========================================================================== */

/* Forzar tipografía en el texto informativo */
#tablaTelefonos_wrapper .dataTables_info {
    font-family: inherit !important;
    font-size: 24px;
    color: #6c757d !important;
    font-weight: 500;
    padding-left: 20px;
}

/* Botones numéricos y de acción (.page-link) */
#tablaTelefonos_wrapper .pagination .page-link {
    font-family: inherit !important;
    color: #2b333f !important; /* Color gris oscuro corporativo */
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important; /* Curvatura igual a tus inputs de login */
    padding: 6px 12px !important;
    font-weight: 600;
    font-size: 24px;
    margin: 0 2px;
    transition: all 0.15s ease-in-out;
    box-shadow: none !important;
    padding-right: 20px;
}

/* Botón de la página activa donde está el usuario (El "1" azul de tu captura) */
#tablaTelefonos_wrapper .pagination .page-item.active .page-link {
    background-color: #2b333f !important; /* Gris oscuro corporativo de tu sistema */
    border-color: #2b333f !important;
    color: #ffffff !important;
}

/* Efecto Hover */
#tablaTelefonos_wrapper .pagination .page-link:hover {
    background-color: #e9ecef !important;
    color: #1a2028 !important;
    border-color: #ced4da !important;
}

/* Botones deshabilitados (Anterior cuando estás en la página 1) */
#tablaTelefonos_wrapper .pagination .page-item.disabled .page-link {
    background-color: #ffffff !important;
    color: #adb5bd !important;
    border-color: #e9ecef !important;
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   CONTROL DE COMPORTAMIENTO RESPONSIVO CON MEDIA QUERIES
   ========================================================================== */

/* MODO ESCRITORIO (PC) */
@media (min-width: 769px) {
    #tablaTelefonos_wrapper .dataTables_info {
        float: left !important;
        padding-top: 16px !important;
    }

    #tablaTelefonos_wrapper .dataTables_paginate {
        float: right !important;
        padding-top: 12px !important;
    }

    #tablaTelefonos_wrapper .pagination {
        justify-content: flex-end !important;
    }
}

/* ==========================================================================
   MODO CELULAR (MOBILE) - CONTROL DE SCROLL INTERNO (NO AFECTA FULLSCREEN)
   ========================================================================== */
@media (max-width: 768px) {

    /* Encapsula las filas renderizadas en una caja responsiva interna con scroll táctil */
    .table-responsive {
        max-height: 460px !important; /* Altura máxima límite en la pantalla del celular */
        overflow-y: auto !important; /* Habilita el scroll vertical continuo */
        overflow-x: auto !important; /* Mantiene el desborde horizontal de columnas */
        -webkit-overflow-scrolling: touch; /* Inercia de scroll nativa ultra-fluida para iOS/Android */
        border: 1px solid #dee2e6 !important;
        border-radius: 8px !important;
    }

    /* Micro-ajuste de celdas para optimizar densidad de datos en pantallas pequeñas */
    #tablaTelefonos tbody td {
        padding: 10px 8px !important;
        font-size: 15px !important;
    }
}