/* Fase 9.2 — CSS verbatim de los <style> de Pages/Inventarios/Productos/Main/ProductoGrid.razor. Igual que hoy, es global mientras el componente está en pantalla:
   se enlaza con <link> donde estaba el <style>. Cambios: @@ → @ y capas D-51. */
/* =====================================================
               ProductoGrid.razor.css  v2
               Prefijo: pg-
               ===================================================== */

.pg-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 0.5px solid #CFE3F7;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    font-size: 11px;
    font-family: system-ui, sans-serif;
    color: #1a1a2e;
}

/* ── Toolbar ── */
.pg-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #E3F2FD;
    border-bottom: 0.5px solid #CFE3F7;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pg-toolbar-title {
    font-size: 12px;
    font-weight: 600;
    color: #0D47A1;
    white-space: nowrap;
    margin-right: 2px;
}

.pg-search-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 0.5px solid #BBDEFB;
    border-radius: 6px;
    padding: 0 7px;
    gap: 4px;
    height: 26px;
    flex: 1;
    min-width: 180px;
    max-width: 380px;
}

    .pg-search-wrap i {
        font-size: 12px;
        color: #1E88E5;
    }

    .pg-search-wrap input {
        border: none;
        outline: none;
        font-size: 11px;
        width: 100%;
        color: #1a1a2e;
        background: transparent;
        font-family: inherit;
    }

.pg-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 7px;
    height: 22px;
    background: #fff;
    border: 0.5px solid #BBDEFB;
    border-radius: 10px;
    font-size: 10px;
    color: #1565C0;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .1s;
}

    .pg-chip:hover {
        background: #E3F2FD;
    }

    .pg-chip.chip-on {
        background: #1565C0;
        color: #fff;
        border-color: #1565C0;
    }

.pg-btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    height: 26px;
    border: 0.5px solid #BBDEFB;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    color: #0D47A1;
    font-family: inherit;
    white-space: nowrap;
    transition: background .12s;
}

    .pg-btn-toolbar:hover {
        background: #BBDEFB;
    }

.pg-total-label {
    font-size: 10px;
    color: #6B7280;
    margin-left: auto;
    white-space: nowrap;
}

/* ── Scroll ── */
.pg-scroll {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* ── Tabla ── */
.pg-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
}

    .pg-table thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #1565C0;
        color: #fff;
        font-size: 10px;
        font-weight: 500;
        padding: 5px 5px;
        text-align: center;
        border-right: 0.5px solid rgba(255,255,255,.18);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        user-select: none;
    }

        .pg-table thead th:last-child {
            border-right: none;
        }

        .pg-table thead th.sortable {
            cursor: pointer;
        }

            .pg-table thead th.sortable:hover {
                background: #1E88E5;
            }

        .pg-table thead th.th-right {
            text-align: right;
        }

        .pg-table thead th.th-left {
            text-align: left;
        }

        .pg-table thead th.th-center {
            text-align: center;
        }

    .pg-table tbody tr {
        cursor: pointer;
        border-bottom: 0.5px solid #CFE3F7;
    }

        .pg-table tbody tr:nth-child(even) {
            background: #F5F9FF;
        }

        .pg-table tbody tr:nth-child(odd) {
            background: #fff;
        }

        .pg-table tbody tr:hover {
            background: #E8F4FE;
        }

        .pg-table tbody tr.row-active {
            background: #DBEAFE;
        }

    .pg-table td {
        padding: 3px 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
        color: #374151;
        border-right: 0.5px solid #CFE3F7;
        line-height: 1.5;
    }

        .pg-table td:last-child {
            border-right: none;
        }

.td-center {
    text-align: center;
}

.td-right {
    text-align: right;
}

.td-left {
    text-align: left;
}

.td-actions {
    text-align: center;
    padding: 2px 3px;
}

/* Punto de alerta en avatar */
.pg-alert-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #DC2626;
    border: 1px solid #fff;
}

/* Imagen thumb */
.pg-img-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 5px;
    border: 0.5px solid #CFE3F7;
    display: block;
    margin: auto;
}

.pg-img-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    border: 0.5px dashed #BBDEFB;
    background: #F5F9FF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #BBDEFB;
    font-size: 13px;
    margin: auto;
}

/* Descripción */
.pg-desc-main {
    font-size: 10.5px;
    color: #0D47A1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.pg-badge-alert {
    display: inline-block;
    font-size: 8.5px;
    background: #FEE2E2;
    color: #B91C1C;
    border: 0.5px solid #FCA5A5;
    border-radius: 4px;
    padding: 0 4px;
    margin-top: 1px;
}

.pg-muted {
    color: #9CA3AF;
}

.pg-precio-venta {
    font-weight: 500;
    color: #0D47A1;
}

.pg-stock-cero {
    color: #DC2626;
    font-weight: 600;
}

.pg-stock-alto {
    color: #059669;
    font-weight: 600;
}

/* ── Badges ── */
.pg-bx {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
}

.pg-bx-serie {
    background: #EDE9FE;
    color: #5B21B6;
}

.pg-bx-lote {
    background: #FEF3C7;
    color: #92400E;
}

.pg-bx-na {
    background: #F3F4F6;
    color: #4B5563;
}

.pg-bx-ok {
    background: #D1FAE5;
    color: #065F46;
}

.pg-bx-off {
    background: #FEE2E2;
    color: #991B1B;
}

/* ── Acciones ── */
.pg-act-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.pg-ba {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    transition: filter .12s;
}

    .pg-ba:hover {
        filter: brightness(.82);
    }

    .pg-ba.edit {
        background: #EFF6FF;
        color: #1D4ED8;
    }

    .pg-ba.del {
        background: #FEF2F2;
        color: #DC2626;
    }

    .pg-ba.more {
        background: #F9FAFB;
        color: #374151;
    }

/* ── Menú contextual (tres puntos) ── */
.pg-ctx-wrap {
    position: relative;
    display: inline-block;
}

.pg-ctx-menu {
    position: absolute;
    right: 0;
    top: 22px;
    background: #fff;
    border: 0.5px solid #CFE3F7;
    border-radius: 7px;
    min-width: 168px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(21,101,192,.12);
    overflow: hidden;
}

.pg-ctx-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    font-size: 11px;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: background .08s;
}

    .pg-ctx-item:hover {
        background: #E3F2FD;
        color: #1565C0;
    }

    .pg-ctx-item i {
        font-size: 13px;
        width: 14px;
        text-align: center;
    }

.pg-ctx-danger {
    color: #DC2626;
}

    .pg-ctx-danger:hover {
        background: #FEF2F2;
        color: #B91C1C;
    }

.pg-ctx-sep {
    border: none;
    border-top: 0.5px solid #CFE3F7;
    margin: 2px 0;
}

/* ── Fila expandida ── */
.pg-exp-row td {
    background: #EFF6FF !important;
    padding: 0 !important;
    border-top: 2px solid #BBDEFB;
}

.pg-exp-inner {
    display: flex;
    gap: 12px;
    padding: 8px 10px;
    flex-wrap: wrap;
}

.pg-exp-sec {
    flex: 1;
    min-width: 160px;
}

.pg-exp-hdr {
    font-size: 9.5px;
    font-weight: 600;
    color: #0D47A1;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 5px;
    padding-bottom: 3px;
    border-bottom: 0.5px solid #BBDEFB;
}

/* ── Skeleton ── */
.pg-skel {
    height: 12px;
    background: linear-gradient(90deg,#e0eaf8 25%,#f0f6ff 50%,#e0eaf8 75%);
    background-size: 200% 100%;
    animation: pg-shimmer 1.4s infinite;
    border-radius: 3px;
    margin: 4px 8px;
}

@keyframes pg-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Paginador ── */
.pg-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px 10px;
    background: #E3F2FD;
    border-top: 0.5px solid #CFE3F7;
    flex-shrink: 0;
    font-size: 10px;
    color: #6B7280;
}

.pg-pager-size {
    display: flex;
    align-items: center;
    gap: 5px;
}

    .pg-pager-size select {
        font-size: 10px;
        border: 0.5px solid #BBDEFB;
        border-radius: 4px;
        padding: 1px 4px;
        color: #0D47A1;
        background: #fff;
        height: 22px;
        cursor: pointer;
    }

.pg-pager-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.pgr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border: 0.5px solid #BBDEFB;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 10px;
    color: #0D47A1;
    font-weight: 500;
    font-family: inherit;
    transition: background .1s;
}

    .pgr-btn:hover:not(:disabled) {
        background: #BBDEFB;
    }

    .pgr-btn:disabled {
        opacity: .4;
        cursor: default;
    }

    .pgr-btn.pgr-active {
        background: #1565C0;
        color: #fff;
        border-color: #1565C0;
        font-weight: 600;
    }

.pg-pager-info {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .pg-search-wrap {
        max-width: 100%;
    }

    .pg-total-label {
        display: none;
    }

    .pg-exp-inner {
        flex-direction: column;
    }
}
/* ============================================
           OCMENU2 — Menú de acciones (dropdown compacto)
           ============================================ */

.ocmenu2-cell {
    position: relative;
    overflow: visible;
    text-align: center;
    white-space: nowrap;
}

.ocmenu2-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: var(--z-modal); /* D-51 (era 9998): menú de la fila, sobre el shell */
}

.ocmenu2-wrapper {
    position: relative;
    display: inline-block;
}

.ocmenu2-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #D8DEE8;
    border-radius: 6px;
    background: #FFFFFF;
    color: #1565C0;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

    .ocmenu2-trigger:hover {
        background: #EEF5FD;
        border-color: #1565C0;
    }

.ocmenu2-wrapper--open .ocmenu2-trigger {
    background: #E3F0FC;
    border-color: #1565C0;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.15);
}

.ocmenu2-trigger-icon {
    font-size: 12px;
}

.ocmenu2-trigger-chevron {
    font-size: 10px;
    transition: transform .15s ease;
}

.ocmenu2-wrapper--open .ocmenu2-trigger-chevron {
    transform: rotate(180deg);
}


.ocmenu2-panel {
    /* display: none;*/
    position: fixed; /* antes: absolute */
    width: 236px;
    background: #FFFFFF;
    border: 1px solid #E3E7EE;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
    padding: 6px;
    z-index: var(--z-modal); /* D-51 (era 9999); va después del fondo */
    max-height: min(70vh, 420px);
    overflow-y: auto;
}

/*.ocmenu2-wrapper--open .ocmenu2-panel {
            display: block;
        }*/

.ocmenu2-group + .ocmenu2-group {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid #EEF1F5;
}

.ocmenu2-group-label {
    display: block;
    padding: 4px 8px 3px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #94A3B8;
}

.ocmenu2-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    font-size: 12.5px;
    text-align: left;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .12s ease;
}

    .ocmenu2-item:hover {
        background: #F1F5F9;
    }

.ocmenu2-item--disabled {
    color: #B6BECB;
    cursor: not-allowed;
}

    .ocmenu2-item--disabled:hover {
        background: transparent;
    }

    .ocmenu2-item--disabled .ocmenu2-item-icon {
        color: #C7CDD8;
    }

.ocmenu2-item--danger {
    color: #DC2626;
}

    .ocmenu2-item--danger:hover {
        background: #FEF2F2;
    }

.ocmenu2-item-icon {
    flex: 0 0 16px;
    font-size: 12.5px;
    text-align: center;
    color: #1565C0;
}

.ocmenu2-item-icon--warning {
    color: #D97706;
}

.ocmenu2-item-icon--danger {
    color: #DC2626;
}

.ocmenu2-item span:not(.ocmenu2-item-badge) {
    flex: 1 1 auto;
}

.ocmenu2-item-badge {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: #E8EDF3;
    color: #5B6B82;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .02em;
}

.ocmenu2-item-badge--full {
    background: #FEF3C7;
    color: #92400E;
}
