/* ============================================================
   totalizado.css - Estilos inventario totalizado + listas precios
   Ultramodular: variables CSS del tema, sin hardcodeo
   ============================================================ */

/* === INVENTARIO TOTALIZADO === */

.tot-kpis-grid {
  display: flex; gap: 10px; padding: 16px;
  flex-wrap: wrap;
}
.tot-kpi {
  flex: 1 1 140px; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 10px;
  background: var(--brand-surface); border: 1.5px solid var(--brand-border);
}
.tot-kpi i { font-size: 1.4rem; color: var(--brand-text-muted); }
.tot-kpi-total i { color: var(--brand-accent); }
.tot-kpi-unidades i { color: #3b82f6; }
.tot-kpi-valor i { color: #16a34a; }

.tot-bodegas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px; padding: 0 16px 16px;
}
.tot-bodega-card {
  padding: 14px; border-radius: 10px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface); transition: all 0.15s;
}
.tot-bodega-card:hover { border-color: var(--brand-accent); transform: translateY(-1px); }
.tot-bodega-empty { opacity: 0.5; }
.tot-bodega-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tot-bodega-header i { color: var(--brand-accent); font-size: 1.1rem; }
.tot-bodega-header strong { font-size: 0.85rem; }
.tot-bodega-stats {
  display: flex; justify-content: space-between; gap: 8px;
}
.tot-bodega-stats > div { text-align: center; }
.tot-stat-val { display: block; font-weight: 700; font-size: 0.95rem; color: var(--brand-text); }
.tot-stat-lbl { display: block; font-size: 0.65rem; color: var(--brand-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

.tot-table th { white-space: nowrap; }
.tot-sortable { cursor: pointer; user-select: none; }
.tot-sortable:hover { color: var(--brand-accent); }
.tot-footer-row td {
  background: var(--brand-bg); font-weight: 700;
  border-top: 2px solid var(--brand-border);
  padding: 12px;
}

/* === LISTAS DE PRECIOS === */

.lp-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px; padding: 16px;
}
.lp-card {
  padding: 16px; border-radius: 12px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface); transition: all 0.2s; cursor: default;
}
.lp-card:hover { border-color: var(--brand-accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.lp-card-active { border-color: var(--brand-accent); background: rgba(147,193,31,0.04); box-shadow: 0 0 0 2px rgba(147,193,31,0.15); }
.lp-card-disabled { opacity: 0.55; }

.lp-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.lp-card-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: rgba(147,193,31,0.1); color: var(--brand-accent);
  font-size: 1rem;
}
.lp-card-info { flex: 1; min-width: 0; }
.lp-card-info strong { display: block; font-size: 0.9rem; }
.lp-card-info small { display: block; font-size: 0.72rem; color: var(--brand-text-muted); margin-top: 2px; line-height: 1.3; }
.lp-badge-base {
  padding: 2px 8px; border-radius: 10px; font-size: 0.65rem; font-weight: 700;
  background: rgba(59,130,246,0.1); color: #3b82f6; flex-shrink: 0;
}

.lp-card-stats { display: flex; justify-content: space-around; gap: 8px; margin-bottom: 12px; }
.lp-card-stats > div { text-align: center; }
.lp-stat-val { display: block; font-weight: 700; font-size: 0.9rem; color: var(--brand-text); }
.lp-stat-lbl { display: block; font-size: 0.6rem; color: var(--brand-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

.lp-card-footer { display: flex; justify-content: space-between; align-items: center; }
.lp-status { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 8px; }
.lp-status-on { background: rgba(34,197,94,0.1); color: #16a34a; }
.lp-status-off { background: rgba(239,68,68,0.1); color: #dc2626; }

.lp-btn-ver {
  padding: 5px 12px; border-radius: 8px; border: 1.5px solid var(--brand-accent);
  background: rgba(147,193,31,0.08); color: var(--brand-accent-dark, #5a7a0f);
  font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
  font-family: var(--font-family);
}
.lp-btn-ver:hover { background: var(--brand-accent); color: #fff; }

/* Detalle panel */
.lp-detalle-panel {
  margin: 0 16px 16px; padding: 16px; border-radius: 12px;
  border: 1.5px solid var(--brand-border); background: var(--brand-surface);
}
.lp-detalle-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.lp-detalle-header h3 { margin: 0; font-size: 1rem; }
.lp-detalle-header h3 i { color: var(--brand-accent); margin-right: 6px; }
.lp-detalle-actions { display: flex; gap: 8px; }

.lp-btn-global {
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid #3b82f6;
  background: rgba(59,130,246,0.08); color: #3b82f6;
  font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
  font-family: var(--font-family);
}
.lp-btn-global:hover { background: #3b82f6; color: #fff; }

.lp-kpis-row { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.lp-kpi {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 16px; border-radius: 8px; background: var(--brand-bg);
  border: 1px solid var(--brand-border); min-width: 80px;
}

/* Tabla precios */
.lp-table td { vertical-align: middle; }
.lp-row-editing td { background: rgba(147,193,31,0.04); }
.lp-input-precio {
  width: 100px; height: 32px; border: 1.5px solid var(--brand-accent);
  border-radius: 6px; text-align: right; font-size: 0.85rem;
  padding: 0 8px; font-family: var(--font-family); background: var(--brand-surface);
  color: var(--brand-text);
}
.lp-input-precio:focus { outline: none; box-shadow: 0 0 0 2px rgba(147,193,31,0.2); }

.lp-margen-pos { color: #16a34a; font-weight: 600; }
.lp-margen-neg { color: #dc2626; font-weight: 600; }

.lp-btn-edit, .lp-btn-save, .lp-btn-cancel {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--brand-border);
  background: var(--brand-surface); cursor: pointer; font-size: 0.75rem;
  color: var(--brand-text-muted); transition: all 0.15s;
}
.lp-btn-edit:hover { border-color: var(--brand-accent); color: var(--brand-accent); }
.lp-btn-save { border-color: #16a34a; color: #16a34a; }
.lp-btn-save:hover { background: #16a34a; color: #fff; }
.lp-btn-cancel:hover { border-color: #dc2626; color: #dc2626; }

/* Dialog global % */
.lp-dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.lp-dialog {
  background: var(--brand-surface); border-radius: 14px; padding: 24px;
  width: 90%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.lp-dialog h4 { margin: 0 0 8px; font-size: 1rem; }
.lp-dialog h4 i { color: #3b82f6; margin-right: 6px; }
.lp-dialog-field { margin: 16px 0; }
.lp-dialog-field label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }
.lp-dialog-field input {
  width: 100%; height: 40px; border: 1.5px solid var(--brand-border);
  border-radius: 8px; padding: 0 12px; font-size: 1rem;
  font-family: var(--font-family); background: var(--brand-bg); color: var(--brand-text);
}
.lp-dialog-field input:focus { outline: none; border-color: #3b82f6; }
.lp-dialog-field small { display: block; margin-top: 4px; }
.lp-dialog-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.lp-btn-cancel-dlg {
  padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface); cursor: pointer; font-family: var(--font-family);
  font-size: 0.8rem; color: var(--brand-text);
}
.lp-btn-apply-dlg {
  padding: 8px 16px; border-radius: 8px; border: none;
  background: #3b82f6; color: #fff; cursor: pointer;
  font-family: var(--font-family); font-size: 0.8rem; font-weight: 600;
}
.lp-btn-apply-dlg:hover { background: #2563eb; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .tot-kpis-grid { flex-direction: column; }
  .tot-bodegas-grid { grid-template-columns: 1fr 1fr; }
  .lp-grid { grid-template-columns: 1fr; }
  .lp-detalle-panel { margin: 0 8px 8px; padding: 12px; }
  .lp-kpis-row { gap: 8px; }
  .lp-kpi { min-width: 60px; padding: 6px 10px; }
  .lp-detalle-header { flex-direction: column; }
}
