/* ==========================================================
   1. CONTENEDOR PRINCIPAL Y TIPOGRAFÍA ACCESIBLE
   ========================================================== */
.uleam-buscador-container {
    max-width: 1000px;
    margin: 0 auto;
    font-family: 'Verdana', 'Roboto', 'Arial', sans-serif; /* Fuentes de alta legibilidad */
    font-size: 16px; /* Letra base más grande para personas mayores */
    color: #333;
}

.uleam-titulo-busqueda {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #000;
}

.uleam-barra-roja {
    height: 10px;
    background-color: #a30000; /* Rojo institucional ULEAM */
    margin-bottom: 20px;
}

/* ==========================================================
   2. FORMULARIO Y CAMPOS DE BÚSQUEDA
   ========================================================== */
.uleam-input-group-doble {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.uleam-campo-doble {
    flex: 1;
    min-width: 250px;
}

/* Estilo unificado para la altura de las cajas */
.uleam-input-estandar,
.uleam-input-prefijo {
    width: 100%;
    height: 48px; /* Forzamos la misma altura para ambos */
    box-sizing: border-box; /* Evita que el padding deforme el alto */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

/* Campo de Cédula/Pasaporte tradicional */
.uleam-input-estandar {
    padding: 0 15px;
    background: #fff;
    outline: none;
}

.uleam-input-estandar:focus {
    border-color: #0056b3;
    box-shadow: 0 0 5px rgba(0,86,179,0.3);
}

/* --- Truco visual del Prefijo Fijo para el Nro. de Registro --- */
.uleam-input-prefijo {
    display: flex;
    align-items: stretch; /* Hace que los elementos internos llenen la altura */
    background: #e9ecef; 
    overflow: hidden;
}

.uleam-input-prefijo .prefijo-fijo {
    display: flex;
    align-items: center; /* Centra el texto verticalmente */
    padding: 0 15px;
    color: #333;
    font-weight: bold;
    white-space: nowrap;
    user-select: none; 
}

.uleam-input-prefijo input {
    flex: 1;
    border: none !important;
    padding: 0 15px !important;
    font-size: 16px;
    background: #fff;
    outline: none; 
    height: 100%; /* Llena el contenedor de 48px */
    box-sizing: border-box;
}

.uleam-input-prefijo:focus-within {
    border-color: #0056b3;
    box-shadow: 0 0 5px rgba(0,86,179,0.3);
}

/* ==========================================================
   3. BOTONES DE ACCIÓN
   ========================================================== */
.uleam-acciones {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.btn-seecaint {
    background-color: #e0e0e0;
    border: 1px solid #999;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    font-weight: bold;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.btn-seecaint:hover {
    background-color: #d0d0d0;
}

/* ==========================================================
   4. ANIMACIÓN DE CARGA (SPINNER)
   ========================================================== */
.uleam-spinner-container {
    text-align: center;
    padding: 40px 20px;
}

.uleam-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border-left-color: #a30000;
    animation: uleam-spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes uleam-spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* ==========================================================
   5. TABLA DE RESULTADOS INSTITUCIONAL
   ========================================================== */
.uleam-table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

.uleam-tabla-resultados {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px; /* Tamaño legible */
    text-align: center;
}

.uleam-tabla-resultados th, 
.uleam-tabla-resultados td {
    border: 1px solid #ddd;
    padding: 14px 10px;
    vertical-align: middle;
}

.uleam-tabla-resultados th {
    background-color: #d9edf7; /* Celeste institucional */
    color: #31708f;
    font-weight: bold;
    text-transform: uppercase;
}

.uleam-tabla-resultados tr:nth-child(even) {
    background-color: #fcfcfc; /* Zebra striping suave */
}

/* ==========================================================
   6. CONTROLES DE PAGINACIÓN
   ========================================================== */
.uleam-pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    font-size: 14px;
    color: #333;
    flex-wrap: wrap;
    gap: 15px;
}

.uleam-pagination-controls {
    display: flex;
    flex-wrap: wrap;
}

.uleam-page-btn {
    border: 1px solid #ddd;
    padding: 8px 14px;
    background: #fff;
    color: #337ab7;
    cursor: pointer;
    margin-left: -1px; /* Une los bordes de los botones */
    font-size: 14px;
}

.uleam-page-btn:hover:not(:disabled) {
    background-color: #eee;
}

.uleam-page-btn.active {
    background-color: #f5f5f5;
    color: #999;
    cursor: default;
    font-weight: bold;
}

.uleam-page-btn:disabled {
    color: #777;
    cursor: not-allowed;
}

/* ==========================================================
   7. DISEÑO RESPONSIVE Y ACORDEÓN PARA MÓVILES (BLINDADO)
   ========================================================== */

/* REGLA 1: Ocultar TODO lo móvil en computadoras (PC) */
@media screen and (min-width: 769px) {
    button.btn-expandir-fila,
    .btn-expandir-fila {
        display: none !important;
    }
    .uleam-fila-detalles {
        display: none !important;
    }
}

/* REGLA 2: Mostrar y blindar estilos en Celulares/Tablets */
@media screen and (max-width: 768px) {
    
    /* Vista movil dinamica: mostrar solo la primera columna en fila compacta */
    .uleam-tabla-resultados th:not(:first-child),
    .uleam-tabla-resultados td:not(:first-child) {
        display: none !important;
    }
    
    /* Ajustes para que la caja de búsqueda se vea bien en celular */
    .uleam-campo-doble {
        min-width: 100% !important;
    }
    .uleam-pagination-wrapper {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    /* ESTILO BLINDADO DEL BOTÓN + Y - (Sobrescribe a Elementor) */
    button.btn-expandir-fila,
    .btn-expandir-fila {
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        background-color: #2271b1 !important; /* Azul ULEAM */
        color: white !important;
        border: 2px solid white !important;
        border-radius: 50% !important;
        width: 24px !important;
        height: 24px !important;
        font-size: 16px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        padding: 0 !important;
        margin-right: 10px !important;
        box-shadow: 0 0 3px rgba(0,0,0,0.3) !important;
        line-height: 1 !important;
    }

    /* Color rojo cuando está abierto el acordeón (-) */
    button.btn-expandir-fila.expandido,
    .btn-expandir-fila.expandido {
        background-color: #d63638 !important; 
    }

    /* Estilos interiores de la fila expandida */
    .uleam-fila-detalles td {
        background-color: #f9f9f9 !important;
        text-align: left !important;
        padding: 15px 20px !important;
        border-top: none !important;
        box-shadow: inset 0 3px 6px rgba(0,0,0,0.05) !important;
    }

    .uleam-fila-detalles .d-label {
        font-weight: bold !important;
        color: #31708f !important;
        display: inline-block !important;
        width: 160px !important; 
    }

    .uleam-fila-detalles div {
        margin-bottom: 10px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid #eee !important;
    }

    .uleam-fila-detalles div:last-child {
        border-bottom: none !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
}

/* ==========================================================
   8. MINIATURAS DE PDF Y LIGHTBOX (VISOR DE IMAGEN)
   ========================================================== */

/* La miniatura que aparece en la tabla */
.uleam-cert-miniatura {
    width: 60px; /* Tamaño pequeño en la tabla */
    height: auto;
    cursor: zoom-in;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    /* Bloqueos básicos */
    user-select: none;
    -webkit-user-drag: none;
}

.uleam-cert-miniatura:hover {
    transform: scale(1.1);
    border-color: #2271b1;
}

/* El fondo oscuro que cubre toda la pantalla */
.uleam-lightbox-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    cursor: zoom-out; /* Indica que al hacer clic se cierra */
    text-align: center;
    padding: 20px;
}

.uleam-lightbox-overlay.is-open {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* El contenedor de la imagen ampliada */
.uleam-lightbox-content {
    position: relative;
    max-width: 70%; /* No se expande tanto (Requisito 2) */
    max-height: 85vh;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    margin: 0 auto;
}

.uleam-lightbox-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #a30000;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    z-index: 3;
    pointer-events: auto !important;
}

.uleam-lightbox-close:hover {
    background: #7d0000;
}

.uleam-lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* La imagen grande blindada */
.uleam-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: calc(85vh - 20px);
    object-fit: contain;
    margin: 0 auto;
    
    /* BLINDAJE ANTI-DESCARGA */
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: none !important; /* Desactiva completamente el clic derecho y las interacciones del ratón SOBRE la imagen */
}

@media screen and (max-width: 768px) {
    .uleam-lightbox-content {
        max-width: 95%;
    }

    .uleam-lightbox-close {
        top: 8px;
        right: 8px;
    }
}