/* --- RESET TOTAL --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Importante para que el min-height funcione */
    background-color: #0b0b0b; /* Color oscuro base para evitar destellos blancos */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- WRAPPER MAESTRO --- */
.master-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    background-color: #ffffff; /* El fondo de las vistas de trabajo es blanco */
}

/* --- SIDEBAR DINÁMICO --- */
#sidebar {
    position: sticky !important;
    top: 0;
    /* Altura dinámica: se estira para llenar el espacio pero permite scroll */
    min-height: calc(100vh - 80px); 
    height: auto; 
    z-index: 1000;
    background-color: #0b0b0b; /* Asegura que el sidebar siempre sea negro */
    border-right: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0; /* Evita que el contenido principal lo aplaste */
}

/* Scrollbar estética para el sidebar */
#sidebar::-webkit-scrollbar {
    width: 4px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #C9A227;
    border-radius: 10px;
}

/* --- ÁREA DE CONTENIDO (Sin márgenes blancos) --- */
.main-content {
    flex: 1;
    background-color: #ffffff; /* Fondo blanco para las tablas/formularios */
    padding: 0; /* Quitamos el padding global para que el contenido controle su espacio */
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Si quieres que el contenido interno tenga aire, úsalo dentro de los parciales 
   o añade esto para los contenedores de Bootstrap dentro del main */
.main-content > .container, 
.main-content > .container-fluid {
    padding-top: 20px;
    padding-bottom: 20px;
}

/* --- FOOTER SIEMPRE AL FINAL --- */
footer {
    margin-top: auto; /* Empuja el footer si el contenido es muy corto */
}


    /* ==========================================================
    ESTILOS GLOBALES PARA TABLAS - CCPD / UHE STYLE
    ========================================================== */

    /* 1. Contenedor de tabla con scroll suave y bordes redondeados */
    .table-responsive-uhe {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        margin-bottom: 2rem;
    }

    /* 2. Estilo Base de la Tabla */
    .table-uhe {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        font-family: 'Poppins', sans-serif;
        background-color: #ffffff;
    }

    /* 3. Encabezados (Header) - Look Corporativo Oxford */
    .table-uhe thead th {
        background-color: var(--uhe-black);
        color: var(--uhe-gold);
        text-transform: uppercase;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 1.2px;
        padding: 16px;
        border: none;
        vertical-align: middle;
    }

    /* 4. Cuerpo de la Tabla (Rows) */
    .table-uhe tbody td {
        padding: 14px 16px;
        color: #444;
        font-size: 0.9rem;
        border-bottom: 1px solid #f0f0f0;
        vertical-align: middle;
        transition: all 0.2s ease;
    }

    /* 5. Efecto Hover en Filas */
    .table-uhe tbody tr:hover td {
        background-color: rgba(201, 162, 39, 0.05); /* Oro muy suave */
        color: #000;
    }

    /* 6. Badges/Etiquetas dentro de la tabla */
    .badge-uhe {
        padding: 6px 12px;
        border-radius: 6px;
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
    }

    .badge-uhe-success { background: #e6f4ea; color: #1e7e34; }
    .badge-uhe-pending { background: #fff4e5; color: #b08e21; }

    /* 7. Botones de acción en tabla */
    .btn-action {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        transition: 0.3s;
        border: 1px solid #eee;
        background: #fff;
        color: var(--uhe-black);
    }

    .btn-action:hover {
        background: var(--uhe-gold);
        color: #000;
        border-color: var(--uhe-gold);
        transform: translateY(-2px);
    }

    /* 8. Estilo para tablas en "Modo Oscuro" (Opcional si tienes vistas negras) */
    .table-uhe-dark {
        background-color: #1a1a1a;
        color: #fff;
    }
    .table-uhe-dark tbody td {
        color: #dcdcdc;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .table-uhe-dark tbody tr:hover td {
        background-color: rgba(255,255,255,0.02);
    }


    /* --- HEADER DE LA VISTA --- */
    .view-header {
        background: #fff;
        padding: 1.5rem 2rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        margin-bottom: 2rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .view-title {
        margin: 0;
    }

    .view-title h1 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--uhe-black);
        margin-bottom: 5px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .view-breadcrumb {
        font-size: 0.85rem;
        color: #888;
    }

    /* --- BOTONES DE ACCIÓN ESTÁNDAR --- */
    /* Botón Nuevo (Principal) */
    .btn-uhe-add {
        background-color: var(--uhe-black);
        color: var(--uhe-gold);
        border: 1px solid var(--uhe-gold);
        padding: 10px 20px;
        border-radius: 8px;
        font-weight: 600;
        transition: 0.3s;
    }

    .btn-uhe-add:hover {
        background-color: var(--uhe-gold);
        color: #000;
    }

    /* Botones de Tabla (CRUD) */
    .btn-crud {
        width: 35px;
        height: 35px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        transition: all 0.2s;
        color: #fff;
        margin: 0 2px;
    }

    /* Editar: Azul Oxford o Gris Azulado */
    .btn-edit { background-color: #34495e; }
    .btn-edit:hover { background-color: #2c3e50; transform: scale(1.1); }

    /* Eliminar: Rojo Suave/Elegante */
    .btn-delete { background-color: #e74c3c; }
    .btn-delete:hover { background-color: #c0392b; transform: scale(1.1); }

    /* Estado/Switch: Dorado o Verde */
    .btn-status { background-color: var(--uhe-gold); color: #000; }
    .btn-status:hover { background-color: #b08e21; transform: scale(1.1); }

    /* --- MODALES ESTILO UHE --- */
    .modal-uhe .modal-content {
        border-radius: 15px;
        border: none;
        overflow: hidden;
        box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    }

    .modal-uhe .modal-header {
        background: var(--uhe-black);
        color: var(--uhe-gold);
        border-bottom: 2px solid var(--uhe-gold);
    }

    .modal-uhe .btn-close {
        filter: invert(1) brightness(2); /* Hace la X blanca */
    }

    .modal-uhe .modal-footer {
        border-top: 1px solid #eee;
        background: #fcfcfc;
    }

    /* ==========================================================
    COMPONENTES DE FILTROS - UHE GENERIC STYLE
    ========================================================== */

    /* Contenedor Principal Genérico */
    .uhe-filter-section {
        background: #ffffff;
        padding: 25px 20px 20px 20px;
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
        margin-bottom: 2rem;
        position: relative;
    }

    /* Etiqueta flotante de la sección (Opcional) */
    .uhe-filter-section::before {
        content: "FILTROS DE BÚSQUEDA";
        position: absolute;
        top: -10px;
        left: 20px;
        background: var(--uhe-black);
        color: var(--uhe-gold);
        font-size: 0.65rem;
        font-weight: 800;
        padding: 2px 12px;
        border-radius: 4px;
        letter-spacing: 1px;
        border: 1px solid var(--uhe-gold);
    }

    /* Wrapper del Formulario */
    .filter-wrapper {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        align-items: flex-end;
    }

    /* Grupos de Control */
    .uhe-filter-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .uhe-filter-group label {
        font-size: 0.7rem;
        font-weight: 700;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-left: 2px;
    }

    /* Inputs y Selects */
    .uhe-select, .uhe-input {
        background-color: #fcfcfc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 9px 14px;
        font-size: 0.85rem;
        color: var(--uhe-black);
        transition: all 0.2s ease-in-out;
        min-width: 200px;
    }

    .uhe-select:focus, .uhe-input:focus {
        outline: none;
        border-color: var(--uhe-gold);
        background-color: #fff;
        box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.1);
    }

    /* Botones de Acción de Filtro */
    .btn-filter-apply {
        background-color: var(--uhe-black);
        color: var(--uhe-gold);
        border: 1px solid var(--uhe-gold);
        height: 42px;
        padding: 0 20px;
        border-radius: 8px;
        font-weight: 700;
        font-size: 0.8rem;
        text-transform: uppercase;
        transition: 0.3s;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .btn-filter-apply:hover {
        background-color: var(--uhe-gold);
        color: #000;
        transform: translateY(-1px);
    }

    .btn-filter-reset {
        background-color: #fff;
        color: #666;
        border: 1px solid #e2e8f0;
        height: 42px;
        padding: 0 15px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.8rem;
        transition: 0.3s;
        display: inline-flex;
        align-items: center;
    }

    .btn-filter-reset:hover {
        background-color: #f8f9fa;
        color: #333;
        border-color: #cbd5e0;
    }
    /* ==========================================================
   AJUSTES DE RESPONSIVIDAD (MOBILE FRIENDLY)
   ========================================================== */

/* Header responsivo */
@media (max-width: 768px) {
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .view-header .d-flex {
        flex-direction: column; /* Botones uno debajo de otro */
        width: 100%;
    }

    .btn-uhe-add {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Filtros responsivos */
@media (max-width: 768px) {
    .uhe-filter-section {
        padding: 20px 15px;
    }
    
    .filter-wrapper {
        flex-direction: column;
        align-items: stretch; /* Inputs al 100% de ancho */
    }

    .uhe-select, .uhe-input {
        min-width: 100%; /* Ocupar todo el ancho disponible */
    }

    .btn-filter-apply, .btn-filter-reset {
        width: 100%;
        justify-content: center;
    }
}

/* Tabla responsiva (Scroll horizontal suave) */
.table-responsive-uhe {
    width: 100%;
    overflow-x: auto; /* Permite scroll lateral en móvil */
    -webkit-overflow-scrolling: touch;
}

.table-uhe {
    min-width: 700px; /* Evita que la tabla se colapse y se vea mal */
}


    /* --- ESTILOS PARA PAGINACIÓN CCPD --- */
    .pagination .page-link {
        color: #495057; /* Color de texto neutro */
        background-color: #ffffff;
        border: none;
        padding: 0.5rem 0.85rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        font-weight: 600;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
    }

    /* Efecto Hover en los números y botones */
    .pagination .page-link:hover {
        background-color: #f8f9fa;
        color: #0d6efd;
        transform: translateY(-2px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
        z-index: 2;
    }

    /* Estado Activo (Página actual) */
    .pagination .page-item.active .page-link {
        background-color: #212529 !important; /* Negro elegante */
        color: #ffffff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        border: none;
    }

    /* Botones Anterior y Siguiente */
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        background-color: #f1f3f5;
        color: #212529;
    }

    /* Quitar el foco azul feo de Bootstrap */
    .pagination .page-link:focus {
        box-shadow: none;
        outline: none;
    }

    /* Responsive: Ajuste para móviles */
    @media (max-width: 576px) {
        .pagination-sm .page-link {
            padding: 0.4rem 0.7rem;
            font-size: 0.75rem;
        }
    }