/* Módulo TPV (hoja global con versión en App.razor para evitar cachés antiguas) */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #ffebee;
    padding: 0.6rem 1.25rem 0.7rem;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}

.tpv-panel {
    height: calc(100vh - 150px);
    min-height: 480px;
    border: 1px solid #e3e9e3;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ---------- Catálogo ---------- */
.tpv-catalogo {
    display: flex;
    flex-direction: column;
    padding: 0.85rem;
    background: #fafcfa;
    overflow: hidden;
}

.tpv-catalogo-cabecera {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.tpv-buscador {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    border: 1px solid #d5ded5;
    border-radius: 8px;
    padding: 0 0.85rem;
    height: 46px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tpv-buscador:focus-within {
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.tpv-buscador .bi {
    color: #7a8a7a;
    font-size: 1.05rem;
}

.tpv-buscador input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: #1f2a1f;
}

.tpv-contador {
    font-size: 0.8rem;
    color: #6b7a6b;
    white-space: nowrap;
}

.tpv-categorias {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.6rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #e6ece6;
    scrollbar-width: thin;
}

.tpv-categoria {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    border: 1px solid #cfdccf;
    background: #fff;
    color: #2e5e30;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.tpv-categoria:hover {
    border-color: #2e7d32;
    background: #f1f8f1;
}

.tpv-categoria.activa {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.tpv-productos {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: min-content;
    gap: 0.85rem;
    padding: 0.6rem 0.2rem 0.4rem;
    align-content: start;
}

.tpv-producto {
    display: flex;
    flex-direction: column;
    padding: 0;
    text-align: left;
    background: #fff;
    border: 1px solid #e1e8e1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
    appearance: none;
}

.tpv-producto:hover {
    border-color: #66bb6a;
    box-shadow: 0 6px 16px rgba(30, 126, 52, 0.15);
    transform: translateY(-2px);
}

.tpv-producto:active {
    transform: scale(0.97);
}

.tpv-producto:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.4);
    outline-offset: 2px;
}

.tpv-producto.agotado {
    opacity: 0.6;
}

.tpv-producto-imagen {
    position: relative;
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f4f8f4, #eef3ee);
    border-bottom: 1px solid #edf1ed;
}

.tpv-producto-imagen img {
    max-width: 88%;
    max-height: 88px;
    object-fit: contain;
}

.tpv-producto-imagen > .bi {
    font-size: 2.3rem;
    color: #9cbf9a;
}

.tpv-etiqueta {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    line-height: 1.3;
}

.tpv-etiqueta.ok { background: #e3f2e4; color: #1e7e34; }
.tpv-etiqueta.bajo { background: #fff3cd; color: #8a6100; }
.tpv-etiqueta.agotado { background: #fde2e1; color: #b02a37; }
.tpv-etiqueta.servicio { background: #e7eefc; color: #2f5bb7; }

.tpv-producto-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.7rem 0.65rem;
    flex: 1;
}

.tpv-producto-nombre {
    font-size: 0.86rem;
    font-weight: 600;
    color: #1f2a1f;
    line-height: 1.25;
    min-height: 2.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpv-producto-ref {
    font-size: 0.72rem;
    color: #7a8a7a;
}

.tpv-producto-precio {
    margin-top: auto;
    padding-top: 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e7e34;
}

.tpv-vacio {
    grid-column: 1 / -1;
    text-align: center;
    color: #7a8a7a;
    padding: 3rem 1rem;
}

.tpv-vacio .bi {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ---------- Ticket ---------- */
.tpv-lineas {
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    min-height: 120px;
}

.tpv-lineas tr {
    cursor: pointer;
}

.tpv-totales {
    border-top: 2px solid #1a3a1a;
    padding-top: 0.4rem;
}

.tpv-dto-global {
    width: 90px;
}

.tpv-total {
    font-size: 2rem;
    font-weight: 800;
    color: #1a3a1a;
}

.tpv-acciones {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
}

.tpv-acciones .tpv-cobrar {
    grid-column: 1 / -1;
    font-size: 1.5rem;
    padding: 0.75rem;
}

@media (max-width: 991px) {
    .tpv-panel {
        height: auto;
    }

    .tpv-productos {
        max-height: 60vh;
    }
}
