/* ===================== RESET ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===================== BODY ===================== */
body{

    margin:0;

    font-family:
        'Segoe UI',
        sans-serif;

    background-image:url('/img/fondo.png');

    background-size:cover;

    background-position:center;

    background-attachment:fixed;

    overflow-x:visible;
}

/* ===================== CONTENEDOR PRINCIPAL ===================== */
.contenedor {
    width: 100%;
    min-height: 100vh;
    padding: 30px;
    background: rgba(8,15,25,0.28);
    backdrop-filter: blur(0.5px);
}

/* ===================== TITULOS ===================== */
h1 {
    text-align: center;
    font-size: 24px;
    color: #17325c;
    margin-bottom: 22px;
    font-weight: 800;
    letter-spacing: 0.2px;
}

h2 {
    text-align: center;
    color: #2a2f36;
    font-size: 20px;
    margin: 28px 0 16px;
    font-weight: 700;
}

/* ===================== FORMULARIO ===================== */
form,
.formulario {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

input[type="file"] {
    padding: 10px 12px;
    border: 1px solid #ccd6e3;
    border-radius: 10px;
    background: #f8fbff;
    color: #334155;
    font-size: 14px;
}

/* ===================== BOTONES ===================== */
button,
#btnExcel {
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

button:hover,
#btnExcel:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

button:active,
#btnExcel:active {
    transform: translateY(0);
}

#btnExcel {
    display: block;
    margin: 22px auto 0;
}

/* ===================== MENSAJES ===================== */
#mensaje,
.mensaje{
    margin:14px 0 22px;
    padding:16px 20px;
    border-radius:14px;
    font-weight:700;
    font-size:15px;
    min-height:24px;
    white-space:pre-line;
    text-align:left;
    display:none;
    box-shadow:0 8px 18px rgba(0,0,0,.08);
    border:1px solid transparent;
}

/* Mostrar estados */
.mensaje.ok,
#mensaje.ok,
.mensaje.error,
#mensaje.error,
.mensaje.cargando,
#mensaje.cargando{
    display:block;
}

/* Éxito */
.mensaje.ok,
#mensaje.ok{
    background:#ecfdf5;
    color:#166534;
    border-color:#86efac;
}

/* Error */
.mensaje.error,
#mensaje.error{
    background:#fef2f2;
    color:#991b1b;
    border-color:#fca5a5;
}

/* Procesando */
.mensaje.cargando,
#mensaje.cargando{
    background:#fff7ed;
    color:#b45309;
    border-color:#fdba74;
}

/* ===================== TABLA ===================== */
.tabla-contenedor {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

/* Scroll horizontal */
.tabla-contenedor::-webkit-scrollbar {
    height: 12px;
}

.tabla-contenedor::-webkit-scrollbar-track {
    background: #edf2f8;
    border-radius: 10px;
}

.tabla-contenedor::-webkit-scrollbar-thumb {
    background: #a8b6ca;
    border-radius: 10px;
}

.tabla-contenedor::-webkit-scrollbar-thumb:hover {
    background: #8e9db4;
}

table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
}

/* Encabezado */
thead th {
    background: linear-gradient(180deg, #eef4ff 0%, #e6eefb 100%);
    color: #17325c;
    font-weight: 800;
    border-bottom: 1px solid #cdd8e8;
    position: sticky;
    top: 0;
    z-index: 0;
}

/* Celdas */
th,
td {
    border: 1px solid #e1e7f0;
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

td {
    position: relative;
    z-index: 5;
}

/* Filas */
tbody tr:nth-child(even) {
    background: #fafcff;
}

tbody tr:hover {
    background: #eef5ff;
    transition: background 0.15s ease;
}

/* ===================== ANCHOS DE COLUMNAS ===================== */
/* ===================== ANCHOS COLUMNAS ===================== */

#tablaResultados th,
#tablaResultados td{
    min-width:150px;
}

#tablaResultados th:nth-child(1),
#tablaResultados td:nth-child(1){
    min-width:140px;
}

#tablaResultados th:nth-child(2),
#tablaResultados td:nth-child(2){
    min-width:240px;
}

#tablaResultados th:nth-child(3),
#tablaResultados td:nth-child(3){
    min-width:170px;
}

#tablaResultados th:nth-child(4),
#tablaResultados td:nth-child(4){
    min-width:180px;
}

#tablaResultados th:nth-child(5),
#tablaResultados td:nth-child(5){
    min-width:130px;
}

#tablaResultados th:nth-child(6),
#tablaResultados td:nth-child(6){
    min-width:140px;
}

#tablaResultados th:nth-child(7),
#tablaResultados td:nth-child(7){
    min-width:140px;
}

#tablaResultados th:nth-child(8),
#tablaResultados td:nth-child(8){
    min-width:170px;
}

#tablaResultados th:nth-child(9),
#tablaResultados td:nth-child(9){
    min-width:220px;
}

#tablaResultados th:nth-child(10),
#tablaResultados td:nth-child(10){
    min-width:170px;
}

#tablaResultados th:nth-child(11),
#tablaResultados td:nth-child(11){
    min-width:170px;
}

#tablaResultados th:nth-child(12),
#tablaResultados td:nth-child(12){
    min-width:190px;
}

#tablaResultados th:nth-child(13),
#tablaResultados td:nth-child(13){
    min-width:170px;
}

#tablaResultados th:nth-child(14),
#tablaResultados td:nth-child(14){
    min-width:160px;
}

#tablaResultados th:nth-child(15),
#tablaResultados td:nth-child(15){
    min-width:190px;
}

#tablaResultados th:nth-child(16),
#tablaResultados td:nth-child(16){
    min-width:140px;
}

#tablaResultados th:nth-child(17),
#tablaResultados td:nth-child(17){
    min-width:260px;
}

/* ===================== COLORES ESTADO ===================== */
.estado-completo {
    color: #15803d;
    font-weight: 800;
}

.estado-incompleto {
    color: #d97706;
    font-weight: 800;
}

.estado-critico {
    color: #dc2626;
    font-weight: 800;
}

/* ===================== CELDA VACÍA MÁS SUAVE ===================== */
td:empty::before {
    content: "\00a0";
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    body {
        padding: 12px;
    }

    .container,
    .contenedor {
        padding: 16px;
        border-radius: 14px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 18px;
    }

    th,
    td {
        padding: 9px 10px;
        font-size: 13px;
    }

    button,
    #btnExcel {
        width: 100%;
        max-width: 260px;
    }
    .tabla-contenedor {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    backdrop-filter: blur(4px);
    overflow-x: auto;
    position: relative;
    z-index: 1;
}

table {
    background: rgba(255, 255, 255, 0.45);
}

thead th {
    background: rgba(226, 236, 250, 0.70);
}

tbody td {
    background: rgba(255, 255, 255, 0.55);
}
}

.usuario-box{
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 9999;

    background: rgba(0,0,0,0.45);
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    backdrop-filter: blur(6px);
    min-width: 210px;
    text-align: right;
    box-shadow: 0 8px 22px rgba(0,0,0,.20);
}

.usuario-box strong{
    display:block;
    font-size:16px;
}

.usuario-box span{
    display:block;
    font-size:13px;
    opacity:.8;
    margin-top:2px;
}

.usuario-box a{
    display:inline-block;
    margin-top:8px;
    color:#ffb3b3;
    text-decoration:none;
    font-size:13px;
}

.usuario-box a:hover{
    color:white;
}

.bienvenida {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.90);
    z-index: 9999;
    opacity: 0;
    /* --- AÑADE ESTA LÍNEA --- */
    pointer-events: none; 
    /* ----------------------- */
    transition: all .45s ease;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    font-size: 24px;
    font-weight: bold;
    color: #1e293b;
}

/* Y añade también esta línea aquí */
.bienvenida.mostrar {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto; /* Para que sí funcione mientras se ve */
}
/* ===================== MODAL PRO ===================== */
.modal{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.modal.mostrar{
    display:flex;
}

.modal-contenido{
    background: white;
    width: 95%;
    max-width: 430px;
    border-radius: 18px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0,0,0,.22);
    animation: subir .25s ease;
}

.modal-contenido h3{
    font-size: 24px;
    color:#17325c;
    margin-bottom: 12px;
}

.modal-contenido p{
    color:#475569;
    font-size:15px;
    margin-bottom: 24px;
}

.modal-botones{
    display:flex;
    gap:12px;
    justify-content:center;
    flex-wrap:wrap;
}

#cancelarBorrar{
    background:#64748b;
}

#confirmarBorrar{
    background:linear-gradient(135deg,#dc2626,#b91c1c);
}

/* ===================== TOAST ===================== */
.toast{
    position: fixed;
    right: 25px;
    bottom: 25px;
    background:#15803d;
    color:white;
    padding:14px 22px;
    border-radius:12px;
    font-weight:700;
    box-shadow:0 12px 28px rgba(0,0,0,.18);
    opacity:0;
    transform:translateY(20px);
    transition:.35s ease;
    z-index:10001;
}

.toast.mostrar{
    opacity:1;
    transform:translateY(0);
}

/* ===================== BOTON BORRAR ===================== */
#btnBorrarHistorial{
    background:linear-gradient(135deg,#dc2626,#b91c1c);
    margin-left:10px;
}

#btnBorrarHistorial:hover{
    box-shadow:0 10px 22px rgba(220,38,38,.28);
}

/* ===================== ANIMACION ===================== */
@keyframes subir{
    from{
        opacity:0;
        transform:translateY(18px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

/* ===== FIX TABLA CLICK ===== */

/* Evita que el fondo bloquee clicks */
body::before,
body::after {
    pointer-events: none;
}

/* ===================== LAYOUT NUEVO ===================== */

.layout{
    display:flex;
    min-height:100vh;
}

/* ===================== SIDEBAR ===================== */

.sidebar{
background:
linear-gradient(
    180deg,
    rgba(15,35,75,.92),
    rgba(20,45,95,.90),
    rgba(15,30,65,.92)
);
    backdrop-filter:blur(8px);
    
    box-shadow: 8px 0 25px rgba(0,0,0,.18);
    
    border-right:1px solid rgba(255,255,255,.08);

    display:flex;
    flex-direction:column;
    justify-content:space-between;

    padding:24px 18px;

    position:fixed;
    left:0;
    top:0;
    bottom:0;

    z-index:1000;
}

.logo{
    text-align:center;
    color:white;
    margin-bottom:30px;
}

.logo h1{

    color:#d91e18;

    font-size:34px;

    margin-bottom:10px;

    letter-spacing:1px;

    font-weight:900;

    -webkit-text-stroke: 1.2px black;

    text-shadow:
        0 0 10px rgba(217,30,24,.35),
        2px 2px 4px rgba(0,0,0,.45);
}

.logo span{
    display:block;

    font-size:13px;

    line-height:1.5;

    opacity:.78;

    margin-top:8px;
}

/* ===================== MENU ===================== */

.menu{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.menu-btn{
    width:100%;
    text-align:left;

    padding:14px 16px;

    border:none;
    border-radius:12px;

    background:transparent;
    color:white;

    font-size:15px;
    font-weight:600;

    cursor:pointer;

    transition:.2s ease;
}

.menu-btn:hover{
    background:rgba(255,255,255,.08);
}

.menu-btn.activo{

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        );
}

/* ===================== USUARIO SIDEBAR ===================== */

.sidebar-user{
    margin-top:30px;
    padding-top:20px;

    border-top:1px solid rgba(255,255,255,.08);

    color:white;
}

.sidebar-user strong{
    display:block;
    font-size:16px;
}

.sidebar-user span{
    display:block;
    font-size:13px;
    opacity:.75;
    margin-top:3px;
}

.logout-btn{
    display:inline-block;
    margin-top:14px;

    color:#ffb4b4;
    text-decoration:none;
    font-size:14px;
}

.logout-btn:hover{
    color:white;
}

/* ===================== CONTENIDO ===================== */

.contenido{
    margin-left:260px;
    width:calc(100vw - 260px);

    padding:35px;
}

/* ===================== VISTAS ===================== */

.vista{
    display:none;
}

.vista.activa{
    display:block;
}

/* ===================== CARDS ===================== */

.card{

    background:rgba(255,255,255,.72);

    border-radius:24px;

    padding:24px;

    border:1px solid rgba(255,255,255,.35);

    backdrop-filter:blur(10px);

    box-shadow:
        0 10px 30px rgba(0,0,0,.10);
}

.card-simple{
    background:rgba(255,255,255,.70);

    border-radius:16px;

    padding:24px;

    backdrop-filter:blur(6px);

    color:#1f2937;

    font-size:15px;
}

/* ===================== HEADER ===================== */

.top-header{
    margin-bottom:24px;
}

.top-header h1{
    margin-bottom:8px;
}

.top-header p{
    text-align:center;
    color:#475569;
}

/* ===================== HISTORIAL ===================== */

.historial-header{
    display:flex;
    justify-content:space-between;
    align-items:center;

    gap:20px;

    flex-wrap:wrap;

    margin-bottom:20px;
}

.acciones{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

#accionesProgramador{
    display:flex;
    align-items:center;
}

.acciones{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

#accionesProgramador{
    display:flex;
    align-items:center;
    margin:0;
    padding:0;
}

#accionesProgramador button{
    margin:0;
}

.acciones{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

#accionesProgramador{
    display:flex;
    align-items:center;
}

/* ===================== FILTROS ===================== */

.filtros-card{
    margin-bottom:20px;
}

#buscadorGuias{
    width:100%;

    padding:14px 16px;

    border-radius:12px;

    border:1px solid #dbe3ef;

    font-size:15px;
}

/* ===================== REPORTES ===================== */

.reportes-grid{
    display:grid;

    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));

    gap:20px;
}

.reporte-card{
    background:rgba(255,255,255,.75);

    border-radius:18px;

    padding:28px;

    backdrop-filter:blur(6px);

    box-shadow:0 10px 25px rgba(0,0,0,.10);

    text-align:center;
}

.reporte-card h3{
    color:#17325c;
    margin-bottom:14px;
}

.reporte-card p{
    font-size:38px;
    font-weight:800;
    color:#2563eb;
}

/* ===================== CONFIG ===================== */

.configuracion-card{
    display:flex;
    justify-content:center;
}

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

@media(max-width:1000px){

    .sidebar{
        position:relative;
        width:100%;
        height:auto;
    }

    .contenido{
        margin-left:0;
        width:100%;
        padding:20px;
    }

    .layout{
        flex-direction:column;
    }

}

/* ===================== INICIO ===================== */

.inicio-cards{
    display:grid;

    grid-template-columns:
        repeat(auto-fit,minmax(220px,1fr));

    gap:20px;

    margin-bottom:25px;
}

.inicio-card{

    background:rgba(255,255,255,.72);

    border-radius:22px;

    padding:24px;

    border:1px solid rgba(255,255,255,.35);

    backdrop-filter:blur(10px);

    box-shadow:
        0 10px 25px rgba(0,0,0,.10);

    text-align:center;

    transition:.2s ease;
}

.inicio-card h3{
    color:#17325c;
    margin-bottom:12px;
}

.inicio-card p{

    font-size:40px;

    font-weight:800;

    color:#2563eb;
}

.upload-card{
    margin-bottom:25px;
}

.upload-card h2{
    margin-bottom:18px;
}

.ultimas-card h2{
    margin-bottom:18px;
}

.tabla-mini{
    overflow-x:auto;
}

.tabla-mini table{
    width:100%;
    border-collapse:collapse;
}

.tabla-mini th{
    background:#17325c;
    color:white;

    padding:12px;
}

.tabla-mini td{
    padding:12px;

    background:rgba(255,255,255,.75);

    border-bottom:1px solid #dbe3ef;
}
