/* ============================================================
   inventario.css - Estilos modulo inventario (~180 lin)
   KPIs, filtros combinados, chips, tabla, exportar, cards
   ============================================================ */

/* --- KPIs Grid --- */
.inv-kpis-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  padding: 16px 16px 0;
}
.inv-kpi {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  background: var(--brand-surface); border: 1.5px solid var(--brand-border);
  transition: all 0.15s;
}
.inv-kpi:hover { border-color: var(--brand-accent); transform: translateY(-1px); }
.inv-kpi.kpi-active { border-color: var(--brand-accent); background: rgba(147,193,31,0.06); }
.inv-kpi i { font-size: 1.3rem; color: var(--brand-text-muted); }
.inv-kpi.kpi-ok i { color: var(--brand-success); }
.inv-kpi.kpi-warn i { color: #e6a817; }
.inv-kpi.kpi-danger i { color: var(--brand-error); }
.kpi-data { display: flex; flex-direction: column; }
.kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--brand-text); line-height: 1.2; }
.kpi-label { font-size: 0.7rem; color: var(--brand-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* --- Toolbar filtros --- */
.inv-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px;
  border-bottom: 1px solid var(--brand-border);
}
.inv-filter {
  flex: 1 1 140px; min-width: 0; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--brand-border); border-radius: 8px;
  background: var(--brand-surface); font-size: 0.8rem; font-family: var(--font-family);
  color: var(--brand-text); transition: border-color 0.15s;
}
.inv-filter:focus { outline: none; border-color: var(--brand-accent); }
.inv-filter-search {
  flex: 2 1 200px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.inv-filter-search i { color: var(--brand-text-muted); font-size: 0.85rem; flex-shrink: 0; }
.inv-filter-search input {
  border: none; background: none; width: 100%; height: 100%;
  font-size: 0.8rem; font-family: var(--font-family); color: var(--brand-text);
}
.inv-filter-search input:focus { outline: none; }
.inv-filter-precio {
  flex: 0 1 200px; display: flex; align-items: center; gap: 4px; padding: 0 8px;
}
.inv-filter-precio input {
  border: none; background: none; width: 50%; height: 100%;
  font-size: 0.8rem; font-family: var(--font-family); color: var(--brand-text); text-align: center;
}
.inv-filter-precio input:focus { outline: none; }
.precio-sep { color: var(--brand-text-muted); font-size: 0.8rem; }
.inv-btn-clear {
  flex: 0 0 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface); cursor: pointer; color: var(--brand-text-muted);
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.inv-btn-clear:hover { border-color: var(--brand-error); color: var(--brand-error); }

/* --- Chips filtros activos --- */
.inv-chips-bar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px;
}
.inv-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  background: rgba(147,193,31,0.1); color: var(--brand-accent-dark, #5a7a0f);
  border: 1px solid rgba(147,193,31,0.3); cursor: pointer; transition: all 0.15s;
}
.inv-chip:hover { background: rgba(147,193,31,0.2); }
.inv-chip i { font-size: 0.65rem; }

/* --- Panel header con acciones --- */
.panel-actions { display: flex; gap: 8px; }
.btn-export {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; 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.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
  font-family: var(--font-family);
}
.btn-export:hover { background: var(--brand-accent); color: #fff; }

/* --- Count --- */
.inv-count { padding: 10px 16px; font-size: 0.78rem; color: var(--brand-text-muted); }

/* --- Tabla --- */
.inv-table-wrap { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.inv-table th {
  position: sticky; top: 0; background: var(--brand-bg);
  padding: 10px 12px; text-align: left; font-weight: 600;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--brand-text-muted); border-bottom: 2px solid var(--brand-border);
}
.inv-table td { padding: 10px 12px; border-bottom: 1px solid var(--brand-border); vertical-align: top; }
.inv-table tr:hover td { background: rgba(147,193,31,0.03); }
.text-right { text-align: right; }
.text-muted { color: var(--brand-text-muted); }

/* --- Stock badges --- */
.stock-badge { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; }
.stock-ok { background: rgba(34,197,94,0.1); color: #16a34a; }
.stock-low { background: rgba(234,179,8,0.1); color: #b45309; }
.stock-out { background: rgba(239,68,68,0.1); color: #dc2626; }

/* --- Cards mobile --- */
.inv-cards { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; }
.inv-card {
  padding: 12px; border-radius: 10px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface);
}
.card-top strong { font-size: 0.85rem; display: block; }
.card-ref { font-size: 0.72rem; color: var(--brand-text-muted); }
.card-meta { display: flex; justify-content: space-between; margin: 6px 0; font-size: 0.72rem; color: var(--brand-text-muted); }
.card-bottom { display: flex; justify-content: space-between; align-items: center; }
.card-price { font-weight: 700; color: var(--brand-text); }

/* --- Paginacion --- */
.inv-pagination { display: flex; justify-content: center; gap: 4px; padding: 16px; }
.inv-pagination button {
  min-width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--brand-border);
  background: var(--brand-surface); cursor: pointer; font-size: 0.8rem; font-family: var(--font-family);
  color: var(--brand-text); transition: all 0.15s;
}
.inv-pagination button:hover:not(:disabled) { border-color: var(--brand-accent); }
.inv-pagination button.active { background: var(--brand-accent); color: #fff; border-color: var(--brand-accent); }
.inv-pagination button:disabled { opacity: 0.4; cursor: default; }
.pag-dots { display: flex; align-items: center; padding: 0 4px; color: var(--brand-text-muted); }

/* --- Empty / Loading --- */
.inv-empty, .inv-loading {
  text-align: center; padding: 48px 24px; color: var(--brand-text-muted);
}
.inv-empty i, .inv-loading i { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.btn-clear-empty {
  margin-top: 12px; 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); transition: all 0.15s;
}
.btn-clear-empty:hover { border-color: var(--brand-accent); }

/* --- Responsive --- */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .inv-kpis-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
  .inv-kpi { padding: 10px; }
  .kpi-value { font-size: 1.1rem; }
  .inv-toolbar { padding: 12px; }
  .inv-filter { flex: 1 1 100%; }
  .inv-filter-search { flex: 1 1 100%; }
  .inv-filter-precio { flex: 1 1 100%; }
  .desktop-only { display: none; }
  .mobile-only { display: block; }
}

@media (min-width: 769px) {
  .inv-toolbar { padding: 16px 20px; gap: 10px; }
  .inv-filter { flex: 0 1 160px; }
  .inv-filter-search { flex: 1 1 220px; }
  .inv-filter-precio { flex: 0 1 180px; }
}
