﻿/* ===== MODAL VER LISTA (escala dinámica) ===== */
.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.45);
    z-index: 99998 !important;
}

.modal-lista {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 96vw !important;
    height: 90vh !important;
    background: #eaf3fb;
    border: 1px solid #b6d0e8;
    border-radius: 10px;
    padding: 10px 12px;
    padding-top: 0px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    z-index: 99999 !important;
    box-sizing: border-box;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body.modal-open {
    overflow: hidden !important;
}

.modal-close {
    border: none;
    background: #ffeded;
    color: #b40000;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 20px;
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
}

    .modal-close:hover {
        background: #ffd6d6;
    }

/* CONTENEDOR ÚNICO DEL CONTENIDO DE LA LISTA */
#listaCanvas {
    width: 100%;
    height: 100%;
    padding: 10px 20px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

#contentLista {
    display: block;
    width: 100%;
    max-width: 1350px; /* o 1150px si quieres */
    margin: 0 auto;
}

/* ============================
   🧱 ESTRUCTURA MODO NORMAL
   ============================ */
.lista-unica-normal {
    width: fit-content; /* 👈 clave */
    max-width: 1150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 auto; /* 👈 centra todo */
}

/* ============================
   🧱 ESTRUCTURA MODO REVENTADO
   ============================ */
.lista-unica-rev {
    width: fit-content;
    max-width: 1350px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 auto;
}

/* === TÍTULO Y FECHA === */
.fila-titulo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.titulo-sorteo-modal {
    font-weight: 900;
    font-size: 1.6rem;
    color: #c68200;
}

.fecha-modal {
    font-weight: 700;
    font-size: 1rem;
    color: #255;
}

/* === TOTALES GENERALES (arriba) === */
.fila-totales-normal,
.fila-totales-rev {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 6px;
}

    .fila-totales-normal .label,
    .fila-totales-rev .label {
        font-weight: 900;
        font-size: 0.95rem;
        color: #04192e;
    }

    .fila-totales-normal .valor,
    .fila-totales-rev .valor {
        font-weight: 900;
        font-size: 0.95rem;
        color: #b31523;
    }

    .fila-totales-rev .sep {
        margin: 0 6px;
        opacity: .6;
    }

/* ============================
   🧮 REJILLA PRINCIPAL
   ============================ */

/* Modo NORMAL: 5 bloques (N° + Monto) = 10 columnas */
.lista-unica-normal .fila-cabecera,
.lista-unica-normal .fila-numeros,
.lista-unica-normal .fila-totales-f {
    display: grid;
    grid-template-columns: repeat(5, 64px 95px);
    column-gap: 4px;
    row-gap: 4px;
    justify-content: center;
}

/* Modo REVENTADO: 5 bloques (N° + Monto + R) = 15 columnas */
.lista-unica-rev .fila-cabecera,
.lista-unica-rev .fila-numeros,
.lista-unica-rev .fila-totales-f-rev {
    display: grid;
    grid-template-columns: repeat(5, 64px 95px 95px);
    column-gap: 4px;
    row-gap: 4px;
    justify-content: center;
}

/* ============================
   🎨 CABECERAS
   ============================ */
.h-num {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d6efd;
    color: white;
    font-size: 11px;
    font-weight: 900;
    border-radius: 6px;
    border: 1px solid #0a58ca;
    height: 22px;
    box-sizing: border-box;
}

.h-monto {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3CB371;
    color: white;
    font-size: 11px;
    font-weight: 900;
    border-radius: 6px;
    border: 1px solid #2e8b57;
    height: 22px;
    box-sizing: border-box;
}

.h-monto-rev {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E74C3C;
    color: white;
    font-size: 11px;
    font-weight: 900;
    border-radius: 6px;
    border: 1px solid #c0392b;
    height: 22px;
    box-sizing: border-box;
}

/* ============================
   🎨 CELDAS
   ============================ */
.celda-num,
.celda-monto,
.celda-monto-rev {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    padding: 0 6px;
    border-radius: 10px;
    height: 22px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.celda-num {
    background: #e4f1fb;
    color: #0a406e;
    border: 1px solid #8db7d8;
}

.celda-monto {
    background: #e9f7ef;
    color: #0a5c38;
    border: 1px solid #8cc7a9;
}

.celda-monto-rev {
    background: #faecec;
    color: #b02222;
    border: 1px solid #d3a3a3;
}

.celda-num.prohibido {
    color: #d32f2f;
    font-size: 14px;
}

/* ============================
   🟦 TOTALES F1..F5 NORMAL
   ============================ */
.fila-totales-f {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-top: 4px;
}

    .fila-totales-f .label,
    .fila-totales-f .valor {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 26px;
        font-size: 14px;
        font-weight: 950;
        border-radius: 6px;
        box-sizing: border-box;
        padding: 0 6px;
    }

    .fila-totales-f .label {
        background: #eaf8ff;
        color: #0c6aa6;
        border: 1px dashed #0c6aa6;
        white-space: nowrap;
    }

    .fila-totales-f .valor {
        background: #f1fff5;
        color: #0f7a3a;
        border: 1px dashed #0f7a3a;
    }

/* ============================
   🔴 TOTALES F1..F5 REVENTADO
   ============================ */
.fila-totales-f-rev {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 4px;
    margin-top: 4px;
}

    .fila-totales-f-rev .label,
    .fila-totales-f-rev .valor-normal,
    .fila-totales-f-rev .valor-rev {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 26px;
        font-size: 14px;
        font-weight: 950;
        border-radius: 6px;
        box-sizing: border-box;
        padding: 0 6px;
    }

    .fila-totales-f-rev .label {
        background: #eaf8ff;
        color: #0c6aa6;
        border: 1px dashed #0c6aa6;
        white-space: nowrap;
    }

    .fila-totales-f-rev .valor-normal {
        background: #f1fff5;
        color: #0f7a3a;
        border: 1px dashed #0f7a3a;
    }

    .fila-totales-f-rev .valor-rev {
        background: #fff5f5;
        color: #c62828;
        border: 1px dashed #c62828;
    }

/* Asegurar que nada se desborde raro */
#listaCanvas > div {
    min-width: 0;
    min-height: 0;
}
