/* ============================================================
   traslados.css - Estilos para Traslados entre bodegas (<200 lin)
   Lista, crear, detalle, buscador de productos mejorado
   ============================================================ */

/* --- Estado badge --- */
.trs-estado {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 10px; font-size: 0.7rem; font-weight: 600;
  white-space: nowrap;
}
.trs-borrador  { background: rgba(156,163,175,0.15); color: #6b7280; }
.trs-transito  { background: rgba(59,130,246,0.1);  color: #2563eb; }
.trs-recibido  { background: rgba(34,197,94,0.1);   color: #16a34a; }
.trs-cerrado   { background: rgba(16,185,129,0.1);  color: #059669; }
.trs-anulado   { background: rgba(220,38,38,0.1);   color: #dc2626; }

/* --- Tabla --- */
.trs-table td { font-size: 0.78rem; }
.trs-table tr { cursor: pointer; transition: background 0.1s; }
.trs-table tr:hover { background: rgba(147,193,31,0.04); }

/* --- Card mobile --- */
.trs-card { cursor: pointer; }
.trs-card .card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.trs-card-route {
  display: flex; align-items: center; gap: 6px; font-size: 0.78rem;
  margin-bottom: 8px; color: var(--brand-text);
}
.trs-card-route i { font-size: 0.68rem; }
.trs-arrow { color: var(--brand-accent); font-size: 0.7rem; }

/* --- Crear form --- */
.trs-crear-form { max-width: 600px; margin: 0 auto; }
.trs-crear-header {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  border-bottom: 1px solid var(--brand-border);
}
.trs-crear-header h3 { margin: 0; font-size: 1rem; color: var(--brand-text); }
.trs-crear-body { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.trs-crear-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trs-crear-actions { display: flex; justify-content: flex-end; }
.trs-crear-alert {
  padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.trs-alert-error { background: rgba(220,38,38,0.08); color: #dc2626; border: 1px solid rgba(220,38,38,0.2); }
.trs-alert-success { background: rgba(34,197,94,0.08); color: #16a34a; border: 1px solid rgba(34,197,94,0.2); }

/* --- Detalle --- */
.trs-detalle { display: flex; flex-direction: column; }
.trs-det-header {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  border-bottom: 1px solid var(--brand-border);
}
.trs-det-title { display: flex; align-items: center; gap: 12px; }
.trs-det-title h3 { margin: 0; font-size: 1rem; color: var(--brand-text); }

/* --- Buscador de productos (mejorado) --- */
.trs-buscador { padding: 12px 16px; position: relative; }
.trs-buscador-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 40px; border: 1.5px solid var(--brand-border);
  border-radius: 10px; background: var(--brand-bg); transition: border-color 0.15s;
}
.trs-buscador-bar:focus-within { border-color: var(--brand-accent); background: #fff; box-shadow: 0 0 0 3px rgba(147,193,31,0.1); }
.trs-buscador-bar i { color: var(--brand-text-muted); font-size: 0.82rem; }
.trs-buscador-bar input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 0.82rem; font-family: var(--font-family); color: var(--brand-text);
}
.trs-buscar-results {
  position: absolute; top: calc(100% - 2px); left: 16px; right: 16px; z-index: 50;
  background: var(--brand-surface); border: 1.5px solid var(--brand-border);
  border-radius: 0 0 10px 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 320px; overflow-y: auto;
}
.trs-buscar-results:empty { display: none; }

/* --- Resultado individual (fila tipo tabla) --- */
.trs-result-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--brand-border); transition: background 0.1s;
}
.trs-result-row:last-child { border-bottom: none; }
.trs-result-row:hover { background: rgba(147,193,31,0.04); }
.trs-result-row.trs-sin-stock { opacity: 0.45; }

.trs-result-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.trs-result-code code { font-size: 0.72rem; white-space: nowrap; }
.trs-result-name {
  font-size: 0.8rem; font-weight: 600; color: var(--brand-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.trs-result-ref { font-size: 0.7rem; color: var(--brand-text-muted); white-space: nowrap; flex-shrink: 0; }

.trs-result-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.trs-result-marca { font-size: 0.68rem; color: var(--brand-text-muted); white-space: nowrap; }
.trs-result-stock {
  font-size: 0.72rem; font-weight: 700; color: var(--brand-accent);
  white-space: nowrap; display: flex; align-items: center; gap: 3px;
}
.trs-result-stock i { font-size: 0.62rem; }
.trs-result-stock.agotado { color: var(--brand-error); }

.trs-result-action { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.trs-cant-input {
  width: 52px; height: 30px; border: 1.5px solid var(--brand-border); border-radius: 6px;
  padding: 0 4px; font-size: 0.8rem; font-family: var(--font-family);
  color: var(--brand-text); background: var(--brand-bg); text-align: center;
  -moz-appearance: textfield;
}
.trs-cant-input::-webkit-inner-spin-button,
.trs-cant-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.trs-cant-input:focus { outline: none; border-color: var(--brand-accent); background: #fff; }

.trs-btn-agregar {
  width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--brand-accent);
  background: rgba(147,193,31,0.08); color: var(--brand-accent);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; transition: all 0.15s;
}
.trs-btn-agregar:hover { background: var(--brand-accent); color: #fff; }

.trs-no-results {
  padding: 16px; text-align: center; font-size: 0.82rem; color: var(--brand-text-muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* --- Items table --- */
.trs-items-table td { font-size: 0.78rem; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .trs-crear-grid { grid-template-columns: 1fr; }
  .trs-crear-header { flex-wrap: wrap; }
  .trs-det-header { flex-wrap: wrap; gap: 8px; }
  .trs-det-title { flex-wrap: wrap; }
  .trs-buscador { padding: 10px 12px; }
  .trs-buscar-results { left: 12px; right: 12px; }
  .trs-result-main { flex-wrap: wrap; gap: 2px; }
  .trs-result-ref { display: none; }
  .trs-result-marca { display: none; }
  .trs-result-row { flex-wrap: wrap; gap: 6px; }
  .trs-result-meta { width: 100%; justify-content: space-between; }
  .trs-result-action { margin-left: auto; }
}
