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

.produto-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px 8px;
    background: #fff;
    border-bottom: 1px solid var(--em-border);
    gap: 10px;
    flex-wrap: wrap;
    min-height: 50px;
}

.header-left { display: flex; flex-direction: column; }

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--em-txt);
    line-height: 1.2;
}

.header-sub {
    font-size: 11px;
    color: var(--em-muted);
    margin-top: 1px;
}

.header-center { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* ── toolbar ── */
.toolbar-wrap {
    display: flex;
    align-items: center;
    padding: 7px 16px;
    background: #fff;
    border-bottom: 1px solid var(--em-border);
    gap: 5px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(26,79,186,.05);
}

.toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--em-border);
    margin: 0 4px;
}

/* ── buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--em-radius);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--em-font);
    cursor: pointer;
    border: none;
    transition: background .14s, box-shadow .14s, transform .1s;
    white-space: nowrap;
    height: 30px;
    line-height: 1;
}

.btn:active { transform: scale(.97); }
.btn i { font-size: 12px; }

.btn-primary {
    background: var(--em-cobalt);
    color: #fff;
    border: 1px solid var(--em-cobalt-deep);
}
.btn-primary:hover { background: var(--em-cobalt-deep); }

.btn-secondary {
    background: var(--em-cobalt-pale);
    color: var(--em-cobalt);
    border: 1px solid #c5d5f5;
}
.btn-secondary:hover { background: #dce8ff; }

.btn-danger {
    background: var(--em-danger-bg);
    color: var(--em-danger);
    border: 1px solid #fca5a5;
}
.btn-danger:hover { background: #fecaca; }

.btn-ghost {
    background: transparent;
    color: var(--em-muted);
    border: 1px solid var(--em-border);
}
.btn-ghost:hover { background: var(--em-cobalt-subtle); color: var(--em-cobalt); }

.btn-ai {
    background: linear-gradient(135deg, var(--em-cobalt) 0%, var(--em-cobalt-light) 100%);
    color: #fff;
    border: 1px solid var(--em-cobalt-deep);
    font-weight: 600;
    padding: 5px 13px;
}
.btn-ai:hover { opacity: .9; }
.btn-ai i { font-size: 13px; }

.btn-icon { padding: 5px 8px; min-width: 30px; justify-content: center; }

@media (max-width: 768px) {
    .btn .btn-label { display: none; }
    .toolbar-sep { display: none; }
}

/* ============================================================
   producto-tabs.css
   ============================================================ */

.tabs-wrap {
    background: #fff;
    border-bottom: 2px solid var(--em-border);
    padding: 0 16px;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-wrap::-webkit-scrollbar { display: none; }

.tab-item {
    padding: 8px 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--em-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.tab-item i { font-size: 13px; }

.tab-item:hover { color: var(--em-cobalt-light); }

.tab-item.active {
    color: var(--em-cobalt);
    border-bottom-color: var(--em-cobalt);
    font-weight: 700;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   producto-table.css
   ============================================================ */

.em-table-wrap {
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--em-border);
    scrollbar-width: thin;
    scrollbar-color: #c9d5f0 transparent;
}

.em-table-wrap::-webkit-scrollbar { height: 5px; width: 5px; }
.em-table-wrap::-webkit-scrollbar-thumb { background: #c9d5f0; border-radius: 3px; }

.em-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 400px;
}

.em-table thead th {
    background: var(--em-cobalt-pale);
    color: var(--em-cobalt);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .045em;
    padding: 7px 10px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    border-bottom: 2px solid var(--em-cobalt-light);
}

.em-table tbody tr {
    border-bottom: 1px solid var(--em-border-soft);
    transition: background .12s;
}

.em-table tbody tr:nth-child(even) { background: var(--em-cobalt-subtle); }

.em-table tbody tr:hover { background: #dce8ff; }

.em-table tbody td {
    padding: 6px 10px;
    color: var(--em-txt);
    vertical-align: middle;
}

.em-table tfoot td {
    padding: 6px 10px;
    font-weight: 700;
    background: var(--em-cobalt-pale);
    color: var(--em-cobalt);
    border-top: 2px solid var(--em-cobalt-light);
    font-size: 12px;
}

.em-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.em-table .col-center { text-align: center; }

.em-table .cell-pos { color: var(--em-success); font-weight: 600; }
.em-table .cell-neg { color: var(--em-danger); font-weight: 600; }

.em-table .btn-row {
    padding: 2px 7px;
    height: 24px;
    font-size: 11px;
}

/* ============================================================
   producto-modal.css
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 60, .5);
    z-index: var(--z-modal-2); /* D-51 (era 1000): modales que se abren sobre la ficha */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    animation: fadeIn .18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 460px;
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(15, 52, 148, .22);
    animation: slideUp .2s ease;
}

.modal-box.modal-sm { width: 380px; }
.modal-box.modal-lg { width: 680px; }

@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    background: linear-gradient(135deg, var(--em-cobalt) 0%, var(--em-cobalt-light) 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 7px;
}

.modal-header-title i { font-size: 15px; opacity: .9; }

.modal-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.3); }

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

.modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--em-border);
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    background: var(--em-cobalt-subtle);
    flex-shrink: 0;
}

/* ============================================================
   producto-forms.css — controls compactos
   ============================================================ */

.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.price-col { display: flex; flex-direction: column; gap: 8px; }

.price-row { display: flex; gap: 8px; align-items: flex-end; }
.price-row .flex-1 { flex: 1; }
.price-row .compact-ctrl { width: 100px; }

.switch-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--em-cobalt);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
    margin-top: 4px;
}

/* ============================================================
   producto-ia.css
   ============================================================ */

.ia-panel {
    background: linear-gradient(135deg, var(--em-cobalt-subtle) 0%, var(--em-cobalt-pale) 100%);
    border: 1px solid #c5d5f5;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    animation: slideDown .22s ease;
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.ia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ia-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--em-cobalt);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ia-subtitle { font-size: 11px; color: var(--em-muted); margin-top: 1px; }

.ia-modules {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    margin-bottom: 12px;
}

.ia-module {
    background: #fff;
    border: 1px solid var(--em-border);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    text-align: left;
}

.ia-module:hover {
    border-color: var(--em-cobalt-light);
    box-shadow: 0 2px 8px rgba(26,79,186,.1);
    transform: translateY(-1px);
}

.ia-module.active {
    border-color: var(--em-cobalt);
    background: var(--em-cobalt-pale);
}

.ia-module-icon {
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--em-cobalt);
    display: block;
}

.ia-module-label { font-size: 11.5px; font-weight: 700; color: var(--em-txt); }
.ia-module-desc  { font-size: 10.5px; color: var(--em-muted); margin-top: 2px; }

.ia-result {
    background: #fff;
    border: 1px solid var(--em-border);
    border-radius: 8px;
    overflow: hidden;
}

.ia-result-header {
    background: var(--em-cobalt-pale);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--em-cobalt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ia-result-body { padding: 10px 12px; }

.ia-insight {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--em-radius);
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.5;
}

.ia-insight-info    { background: var(--em-cobalt-pale); color: var(--em-cobalt); }
.ia-insight-success { background: var(--em-success-bg); color: var(--em-success); }
.ia-insight-warning { background: var(--em-warning-bg); color: var(--em-warning); }
.ia-insight-danger  { background: var(--em-danger-bg); color: var(--em-danger); }

.ia-insight i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.ia-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.ia-kpi {
    background: var(--em-cobalt-pale);
    border-radius: var(--em-radius);
    padding: 8px 10px;
    text-align: center;
}

.ia-kpi-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--em-cobalt);
    line-height: 1.1;
}

.ia-kpi-lbl { font-size: 10px; color: var(--em-muted); margin-top: 2px; }

@media (max-width: 1024px) {
    .ia-modules { grid-template-columns: repeat(4, 1fr); }
    .ia-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .ia-modules { grid-template-columns: repeat(2, 1fr); }
}
