/*
 * ============================================================================
 *  Bot DIAN Taxxa — Notas Crédito / Débito / Documentos Soporte (Estilos)
 *  Archivo:  public/css/bot-taxxa-notas.css
 *  Proyecto: Celumania (app.ryhdistribuciones.com)
 *  Autor:    Claude para Andrés R&H — 2026-06-06
 *
 *  Se carga DESPUÉS de bot-taxxa.css.
 *  Sólo agrega estilos adicionales para el tab "Notas DIAN".
 * ============================================================================
 */

/* ── HEADER DEL PANEL ────────────────────────────────────────────────────── */
.bt-n-panel .bt-n-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.bt-n-panel .bt-n-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

/* ── SUB-TABS ────────────────────────────────────────────────────────────── */
.bt-n-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bt-n-subtab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 2px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.bt-n-subtab:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: #eef2ff;
}

.bt-n-subtab.active {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

/* ── FILTROS ─────────────────────────────────────────────────────────────── */
.bt-n-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 16px;
}

.bt-n-filtros select,
.bt-n-filtros input[type="date"] {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #374151;
  background: #fff;
  min-width: 140px;
  height: 34px;
}

.bt-n-filtros select:focus,
.bt-n-filtros input[type="date"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* ── TABLA WRAP ──────────────────────────────────────────────────────────── */
.bt-n-tabla-wrap {
  min-height: 80px;
}

.bt-n-tabla-scroll {
  overflow-x: auto;
}

.bt-n-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.bt-n-tabla th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid #e5e7eb;
}

.bt-n-tabla td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.bt-n-tabla tr:hover td {
  background: #f9fafb;
}

.bt-n-tabla code {
  font-size: 0.75rem;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

.bt-n-acciones {
  display: flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.bt-n-count {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 8px;
}

.bt-n-loading,
.bt-n-empty {
  text-align: center;
  color: #9ca3af;
  padding: 32px 0;
  font-size: 0.9rem;
}

.bt-n-error {
  color: #dc2626;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
  margin-top: 8px;
}

/* ── BADGES DE ESTADO ────────────────────────────────────────────────────── */
[class^="bt-n-badge-"] {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.bt-n-badge-credito  { background: #d1fae5; color: #065f46; }
.bt-n-badge-debito   { background: #ffedd5; color: #9a3412; }
.bt-n-badge-pendiente { background: #fef9c3; color: #854d0e; }
.bt-n-badge-exitoso  { background: #d1fae5; color: #065f46; }
.bt-n-badge-error    { background: #fee2e2; color: #991b1b; }
.bt-n-badge-enviando { background: #dbeafe; color: #1e40af; }
.bt-n-badge-omitido  { background: #f3f4f6; color: #4b5563; }
.bt-n-badge-doc      { background: #ede9fe; color: #5b21b6; }

/* ── BOTONES ESTILO BD ───────────────────────────────────────────────────── */
.bt-btn-sm {
  padding: 3px 8px !important;
  font-size: 0.75rem !important;
  height: auto !important;
}

.bt-btn-info {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.bt-btn-info:hover {
  background: #93c5fd;
  color: #1e40af;
}

/* ── TOOLTIP ─────────────────────────────────────────────────────────────── */
.bt-n-tooltip {
  cursor: help;
  position: relative;
}

.bt-n-tooltip::after {
  content: attr(title);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 1000;
}

.bt-n-tooltip:hover::after {
  opacity: 1;
}

/* ── MODAL OVERLAY ───────────────────────────────────────────────────────── */
.bt-n-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.bt-n-modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.bt-n-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.bt-n-modal-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.bt-n-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.bt-n-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.bt-n-modal-body {
  padding: 20px;
}

.bt-n-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
}

/* ── FORMULARIO MODAL ────────────────────────────────────────────────────── */
.bt-n-form-row {
  margin-bottom: 14px;
}

.bt-n-form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.bt-n-form-label .bt-n-req {
  color: #ef4444;
}

.bt-n-form-input,
.bt-n-form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.88rem;
  color: #111827;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.bt-n-form-input:focus,
.bt-n-form-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.bt-n-form-input[type="number"] {
  text-align: right;
}

textarea.bt-n-form-input {
  resize: vertical;
  min-height: 80px;
}

.bt-n-form-row small {
  font-size: 0.76rem;
  color: #9ca3af;
  margin-top: 3px;
  display: block;
}

/* ── TABLA RESUMEN EN MODAL ──────────────────────────────────────────────── */
.bt-n-resumen {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.87rem;
}

.bt-n-resumen td {
  padding: 6px 10px;
  border-bottom: 1px solid #f3f4f6;
}

.bt-n-resumen td:first-child {
  color: #6b7280;
  width: 40%;
}

/* ── ALERTAS EN MODAL ────────────────────────────────────────────────────── */
.bt-n-advertencia {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.83rem;
  color: #854d0e;
  margin-top: 12px;
}

.bt-n-alert-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  padding: 12px 16px;
  color: #065f46;
  font-size: 0.87rem;
  margin-top: 12px;
}

.bt-n-alert-success code {
  font-size: 0.76rem;
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

.bt-n-alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  color: #991b1b;
  font-size: 0.87rem;
  margin-top: 12px;
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */
.bt-n-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  color: #fff;
  z-index: 99999;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: btNToastIn 0.25s ease;
}

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

.bt-n-toast-success { background: #10b981; }
.bt-n-toast-error   { background: #ef4444; }
.bt-n-toast-info    { background: #6366f1; }
.bt-n-toast-warning { background: #f59e0b; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bt-n-filtros {
    flex-direction: column;
  }

  .bt-n-filtros select,
  .bt-n-filtros input[type="date"] {
    width: 100%;
    min-width: unset;
  }

  .bt-n-modal-box {
    max-height: 95vh;
  }

  .bt-n-tabla th,
  .bt-n-tabla td {
    padding: 6px 8px;
    font-size: 0.78rem;
  }
}

/* ── MODAL: BÚSQUEDA Y DETALLE DE FACTURA (paso 2) ──────────────────────── */

/* Tarjeta resumen de la factura encontrada */
.bt-n-fact-card {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 4px;
}

.bt-n-fact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #374151;
  padding: 2px 0;
}

.bt-n-fact-totales {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #bbf7d0;
  font-weight: 500;
  color: #166534;
}

/* Tabla de ítems seleccionables */
.bt-n-items-wrap {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-top: 6px;
}

.bt-n-items-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.bt-n-items-tabla thead {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
}

.bt-n-items-tabla th {
  padding: 7px 8px;
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.bt-n-items-tabla td {
  padding: 7px 8px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.bt-n-items-tabla tr:hover td {
  background: #f0fdf4;
}

.bt-n-items-tabla tr:last-child td {
  border-bottom: none;
}

.bt-n-item-chk {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #059669;
}

/* Totales calculados */
.bt-n-totales-calc {
  margin: 8px 0 12px;
}

.bt-n-totales-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #065f46;
}

.bt-n-totales-vacio {
  background: #fff7ed;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #92400e;
}

/* ── DOCUMENTO SOPORTE (bt-ds-) ──────────────────────────────────────────── */
.bt-ds-enc h4 { font-size: 1.125rem; }
.bt-ds-sub { margin: 2px 0 0; font-size: 14px; color: #4b5563; }
.bt-ds-cuerpo { display: flex; flex-direction: column; gap: 14px; background: #f5f7fb; font-size: 14px; }
.bt-ds-aviso { background: #eef3fc; border: 1px solid #c7d6f3; border-left: 4px solid #1A3C8F; border-radius: 6px; padding: 10px 12px; font-size: 14px; color: #1f2a44; }
.bt-ds-card { background: #fff; border: 1px solid #e0e6f1; border-radius: 10px; padding: 14px 16px; }
.bt-ds-card-t { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 15px; font-weight: 700; color: #1A3C8F; }
.bt-ds-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #1A3C8F; color: #fff; font-size: 13px; font-weight: 700; }
.bt-ds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.bt-ds-ancho { grid-column: 1 / -1; }
.bt-ds-campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bt-ds-lbl { font-size: 14px; font-weight: 600; color: #1f2937; }
.bt-ds-req { color: #b91c1c; }
.bt-ds-ayuda { font-size: 13px; color: #4b5563; }
.bt-ds-ctl { min-height: 40px; font-size: 14px; width: 100%; box-sizing: border-box; }
.bt-ds-ctl:focus, .bt-ds-quitar:focus, .bt-ds-agregar:focus { outline: 3px solid #93b4f5; outline-offset: 1px; border-color: #1A3C8F; }
.bt-ds-item { display: grid; grid-template-columns: 2.2fr 1fr .9fr 1.3fr .9fr 1.2fr 40px; gap: 8px; align-items: end; padding: 6px 0; border-bottom: 1px solid #eef1f6; }
.bt-ds-item-head { font-size: 13px; font-weight: 700; color: #4b5563; align-items: center; border-bottom: 2px solid #d6deec; }
.bt-ds-cel { display: flex; flex-direction: column; min-width: 0; }
.bt-ds-cel-l { display: none; font-size: 13px; font-weight: 600; color: #4b5563; margin-bottom: 2px; }
.bt-ds-sub-fila { min-height: 40px; display: flex; align-items: center; font-weight: 600; color: #111827; }
.bt-ds-cel-x { align-items: center; justify-content: flex-end; }
.bt-ds-quitar { min-width: 40px; min-height: 40px; border: 1px solid #fca5a5; background: #fff; color: #b91c1c; border-radius: 6px; cursor: pointer; }
.bt-ds-quitar:hover { background: #fef2f2; }
.bt-ds-agregar { margin-top: 10px; min-height: 40px; border: 1px dashed #1A3C8F; color: #1A3C8F; background: #fff; font-weight: 600; }
.bt-ds-pie { flex-direction: column; align-items: stretch; gap: 10px; }
.bt-ds-resumen { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: flex-end; }
.bt-ds-r { display: flex; flex-direction: column; font-size: 14px; color: #4b5563; text-align: right; }
.bt-ds-r b { font-size: 15px; color: #111827; }
.bt-ds-total { padding-left: 24px; border-left: 2px solid #1A3C8F; }
.bt-ds-total span { font-weight: 700; color: #1A3C8F; }
.bt-ds-total b { font-size: 24px; color: #1A3C8F; }
.bt-ds-error { margin: 0; font-size: 14px; }
.bt-ds-acciones { display: flex; justify-content: flex-end; gap: 10px; }
.bt-ds-acciones .bt-btn { min-height: 40px; }
.bt-ds-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.bt-ds-badge--ok { background: #dcfce7; color: #14532d; border-color: #86efac; }
.bt-ds-badge--warn { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.bt-ds-badge--bad { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
@media (max-width: 640px) {
  .bt-ds-grid { grid-template-columns: 1fr; }
  .bt-ds-item-head { display: none; }
  .bt-ds-item { grid-template-columns: 1fr 1fr; padding: 10px 0; }
  .bt-ds-item .bt-ds-cel:first-child, .bt-ds-item .bt-ds-cel:nth-child(2) { grid-column: 1 / -1; }
  .bt-ds-cel-l { display: block; }
  .bt-ds-resumen { justify-content: space-between; }
  .bt-ds-total { border-left: 0; padding-left: 0; width: 100%; flex-direction: row; justify-content: space-between; align-items: baseline; }
}
