/* Fase 9.2 — verbatim de wwwroot/css/productos/producto-view.css. Igual que hoy la enlaza ProductoEdicionModal con <link> (global mientras
   el Centro de productos está en pantalla). Único cambio: capas D-51. */
/* ============================================================
   VANTASTIC ERP — producto-view.css
   Paleta Cobalto Suave v2
   ============================================================ */

:root {
    --em-cobalt:        #1a4fba;
    --em-cobalt-deep:   #0f3494;
    --em-cobalt-light:  #2d6ae0;
    --em-cobalt-pale:   #e8eef9;
    --em-cobalt-subtle: #f0f4fb;
    --em-txt:           #1e293b;
    --em-muted:         #64748b;
    --em-border:        #dde3f0;
    --em-border-soft:   #edf1f9;
    --em-success:       #1a7a3e;
    --em-success-bg:    #e6f4ec;
    --em-danger:        #b91c1c;
    --em-danger-bg:     #fee2e2;
    --em-warning:       #92400e;
    --em-warning-bg:    #fef3c7;
    --em-radius:        5px;
    --em-radius-card:   10px;
    --em-shadow:        0 1px 4px rgba(26,79,186,.08);
    --em-shadow-md:     0 4px 16px rgba(26,79,186,.12);
    --em-font:          'Segoe UI', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--em-font);
    font-size: 13px;
    color: var(--em-txt);
    background: var(--em-cobalt-subtle);
    margin: 0;
}

/* ── page shell ── */
.produto-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.produto-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 16px;
    scrollbar-width: thin;
    scrollbar-color: #c9d5f0 transparent;
}

.produto-body::-webkit-scrollbar { width: 5px; }
.produto-body::-webkit-scrollbar-thumb { background: #c9d5f0; border-radius: 4px; }

/* ── section card ── */
.section-card {
    background: #fff;
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-card);
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: var(--em-shadow);
}

.section-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--em-cobalt);
    text-transform: uppercase;
    letter-spacing: .045em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title i { font-size: 13px; opacity: .85; }

/* ── form grid ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 10px;
}

.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

/* ── field ── */
.field { display: flex; flex-direction: column; gap: 3px; }

.field label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--em-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius);
    padding: 5px 8px;
    font-size: 12.5px;
    color: var(--em-txt);
    background: #fff;
    outline: none;
    font-family: var(--em-font);
    transition: border-color .15s, box-shadow .15s;
    height: 30px;
}

.field textarea { height: 54px; resize: none; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--em-cobalt-light);
    box-shadow: 0 0 0 3px rgba(45,106,224,.12);
}

.field input:disabled {
    background: var(--em-cobalt-subtle);
    color: #94a3b8;
    cursor: not-allowed;
}

/* ── layout principal datos generales ── */
.dg-layout {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 10px;
    align-items: start;
}

.dg-layout.nuevo { grid-template-columns: 1fr 240px; }

/* ── imagen ── */
.img-container {
    border: 1.5px dashed #c5d5f5;
    border-radius: 8px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--em-cobalt-subtle);
    overflow: hidden;
    position: relative;
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #b0c0e0;
    font-size: 11px;
}

.img-placeholder i { font-size: 28px; }

.img-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── switch row ── */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--em-border-soft);
    font-size: 12.5px;
    color: var(--em-txt);
}
.switch-row:last-child { border: none; }

/* ── triple layout propiedades ── */
.triple-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

/* ── radio group ── */
.radio-group { display: flex; flex-direction: column; gap: 5px; }

.radio-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    cursor: pointer;
}

.radio-item input[type=radio] {
    accent-color: var(--em-cobalt);
    width: 14px; height: 14px;
}

/* ── scroll interno ── */
.scroll-area {
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c9d5f0 transparent;
}

/* ── badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--em-radius);
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
}

.badge-info    { background: var(--em-cobalt-pale); color: var(--em-cobalt); border: 1px solid #c0d0f0; }
.badge-success { background: var(--em-success-bg); color: var(--em-success); border: 1px solid #b6dfca; }
.badge-danger  { background: var(--em-danger-bg); color: var(--em-danger); border: 1px solid #fca5a5; }
.badge-warning { background: var(--em-warning-bg); color: var(--em-warning); border: 1px solid #fcd34d; }

/* ── loading overlay ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 52, 148, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-bloqueo); /* D-51 (era 9999) */
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 38px; height: 38px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── progress overlay (bloqueante) ── */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 52, 148, .4);
    z-index: var(--z-bloqueo); /* D-51 (era 9998) */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 40px;
    backdrop-filter: blur(3px);
}

.progress-bar-wrap {
    background: #fff;
    border-radius: 10px;
    padding: 16px 24px;
    min-width: 300px;
    text-align: center;
    box-shadow: var(--em-shadow-md);
}

.progress-bar-wrap p { font-size: 12.5px; color: var(--em-muted); margin-bottom: 10px; }

.progress-bar {
    height: 6px;
    background: var(--em-cobalt-pale);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--em-cobalt);
    border-radius: 3px;
    animation: progress 1.4s ease-in-out infinite;
}

@keyframes progress {
    0%   { width: 0%; margin-left: 0; }
    50%  { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* ── responsive ── */
@media (max-width: 1024px) {
    .triple-section { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .dg-layout, .dg-layout.nuevo { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .triple-section { grid-template-columns: 1fr; }
    .produto-body { padding: 8px 10px 12px; }
}

@media (max-width: 480px) {
    .form-grid, .form-grid-4, .form-grid-3, .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .span-2, .span-3, .span-4 { grid-column: span 1; }
}

/*switch region*/
/* SWITCH COMPACTO */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

    .switch-row label:first-child {
        font-size: 11px;
        font-weight: 600;
        color: #4a5578;
    }

/* SWITCH */
.vt-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

    .vt-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.vt-switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: 999px;
    background: #d7dfef;
    transition: .22s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}

    .vt-switch-slider::before {
        content: "";
        position: absolute;
        width: 14px;
        height: 14px;
        left: 3px;
        top: 3px;
        border-radius: 50%;
        background: white;
        transition: .22s ease;
        box-shadow: 0 1px 4px rgba(0,0,0,.16);
    }

.vt-switch input:checked + .vt-switch-slider {
    background: linear-gradient(135deg,#2f6bff,#5d90ff);
}

    .vt-switch input:checked + .vt-switch-slider::before {
        transform: translateX(18px);
    }

    /*RadioGroup region*/
/* RADIO MODERNO */
.modern-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.modern-radio-item {
    position: relative;
    cursor: pointer;
}

    .modern-radio-item input {
        display: none;
    }

    .modern-radio-item span {
        display: flex;
        align-items: center;
        gap: 7px;
        padding: 8px 14px;
        border-radius: 12px;
        background: #f4f7fc;
        border: 1px solid #dbe5f4;
        font-size: 12px;
        font-weight: 600;
        color: #52607c;
        transition: .2s ease;
    }

    .modern-radio-item.active span {
        background: linear-gradient(135deg,#2d6cff,#5a8cff);
        color: white;
        border-color: #2d6cff;
        box-shadow: 0 6px 14px rgba(45,108,255,.20);
    }

    .modern-radio-item:not(.active):hover span {
        border-color: #9fbaf7;
        background: #edf3ff;
    }

    /*Inventario symbol lista precios*/
/* ─── BASE COMPARTIDO ─────────────────────────── */
.tab-inv,
.tab-lp {
    padding: 2px 0 8px;
}

.tab-inv-header,
.tab-lp-header {
    font-size: 11.5px;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 6px 2px 8px;
    display: flex;
    align-items: center;
    opacity: .85;
}

/* scroll horizontal en tablas anchas */
.inv-scroll-wrap,
.lp-scroll-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #f8faff;
}

/* ─── ESTILOS TABLA INVENTARIO ────────────────── */
.inv-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto;
    min-width: 860px;
}

.inv-th {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 7px 8px;
    border-bottom: 1.5px solid #bfdbfe;
    white-space: nowrap;
    text-align: center;
}

    .inv-th:first-child {
        text-align: left;
    }

.inv-th-fix {
    min-width: 140px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #eff6ff;
}

.inv-th-num {
    min-width: 82px;
}

.inv-th-date {
    min-width: 116px;
}

.inv-th-loc {
    min-width: 130px;
}

.inv-tr:nth-child(even) {
    background: #f0f7ff;
}

.inv-tr:nth-child(odd) {
    background: #ffffff;
}

.inv-tr:hover {
    background: #dbeafe;
    transition: background .12s;
}

.inv-td-fix {
    padding: 5px 10px;
    border-bottom: 1px solid #dbeafe;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
}

.inv-td-num {
    padding: 4px 5px;
    border-bottom: 1px solid #dbeafe;
    text-align: center;
}

    .inv-td-num.inv-td-highlight {
        background: #eff6ff;
    }

.inv-td-date {
    padding: 4px 5px;
    border-bottom: 1px solid #dbeafe;
    text-align: center;
}

.inv-td-loc {
    padding: 4px 6px;
    border-bottom: 1px solid #dbeafe;
}

/* Almacén badge */
.inv-alm-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inv-badge-suc {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    border: 1px solid #93c5fd;
    letter-spacing: .02em;
    max-width: fit-content;
}

.inv-alm-name {
    font-size: 11.5px;
    color: #374151;
    padding-left: 2px;
}

/* Inputs de inventario */
.inv-input {
    width: 76px;
    height: 26px;
    font-size: 11.5px;
    text-align: right;
    border: 1px solid #bfdbfe;
    border-radius: 5px;
    background: #ffffff;
    color: #1e3a8a;
    padding: 0 5px;
    outline: none;
    transition: border .15s, box-shadow .15s;
}

    .inv-input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px #bfdbfe;
    }

.inv-input-hi {
    border-color: #93c5fd;
    background: #eff6ff;
    font-weight: 600;
    color: #1d4ed8;
    width: 82px;
}

.inv-input-date {
    width: 108px;
    text-align: left;
}

.inv-input-loc {
    width: 118px;
    text-align: left;
    color: #374151;
}

/* ─── ESTILOS TABLA LISTA PRECIOS ─────────────── */
.lp-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 580px;
}

.lp-th {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 7px 8px;
    border-bottom: 1.5px solid #bfdbfe;
    white-space: nowrap;
    text-align: center;
}

.lp-th-nom {
    text-align: left;
    min-width: 180px;
}

.lp-th-num {
    min-width: 86px;
}

.lp-th-sm {
    min-width: 68px;
}

.lp-th-mon {
    min-width: 62px;
}

.lp-tr:nth-child(even) {
    background: #f0f7ff;
}

.lp-tr:nth-child(odd) {
    background: #ffffff;
}

.lp-tr:hover {
    background: #dbeafe;
    transition: background .12s;
}

.lp-td-nom {
    padding: 5px 10px;
    border-bottom: 1px solid #dbeafe;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lp-td-num {
    padding: 4px 6px;
    border-bottom: 1px solid #dbeafe;
    text-align: center;
    vertical-align: middle;
}

.lp-td-mon {
    padding: 4px 6px;
    border-bottom: 1px solid #dbeafe;
    text-align: center;
    vertical-align: middle;
}

/* Valor calculado (readonly) */
.lp-td-calc {
    color: #1d4ed8;
    font-weight: 600;
    font-size: 11.5px;
    background: #eff6ff;
    font-variant-numeric: tabular-nums;
}

/* Badge "Lista" (agrupación) */
.lp-lista-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    border: 1px solid #a5b4fc;
    letter-spacing: .02em;
    white-space: nowrap;
}

/* Badge nombre — colores dinámicos desde DTO (style inline) */
.lp-nombre-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid;
    white-space: nowrap;
    letter-spacing: .01em;
}

/* Inputs lista precios */
.lp-input {
    width: 80px;
    height: 26px;
    font-size: 12px;
    text-align: right;
    border: 1px solid #bfdbfe;
    border-radius: 5px;
    background: #ffffff;
    color: #1e3a8a;
    padding: 0 5px;
    outline: none;
    transition: border .15s, box-shadow .15s;
    font-variant-numeric: tabular-nums;
}

    .lp-input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px #bfdbfe;
    }

.lp-input-precio {
    border-color: #93c5fd;
    background: #f0f9ff;
    font-weight: 600;
    color: #1d4ed8;
}

.lp-input-sm {
    width: 60px;
}

/* Tags de moneda */
.lp-mon-tag {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .04em;
}

.lp-mon-PEN {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.lp-mon-USD {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.lp-mon-EUR {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Empty states */
.inv-empty,
.lp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    color: #60a5fa;
    font-size: 12.5px;
    gap: 4px;
    background: #f8faff;
    border-radius: 8px;
    border: 1px dashed #bfdbfe;
}