/* style.css */

body {
  background-color: #f8f9fa;
}

.table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.table thead {
  background: linear-gradient(to right, #f8f9fa, #e9ecef);
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
}

.table thead th {
  padding: 0.75rem 1rem;
  color: #495057;
  border-right: 1px solid #dee2e6;
}

.table tbody td {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  border-top: 1px solid #f1f3f5;
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #f5f8fa;
  transition: background-color 0.2s ease;
}

.table tbody tr td:first-child {
  border-left: 4px solid transparent;
  transition: border-color 0.3s;
}

.table tbody tr:hover td:first-child {
  border-left-color: #0d6efd;
}

.table-truncable {
  table-layout: fixed;
  word-wrap: break-word;
}

.table-truncable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  border-radius: 0 0 6px 6px;
  padding: 0;
  margin-top: -1px;
}

.autocomplete-suggestion {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease;
}

.autocomplete-suggestion:last-child {
  border-bottom: none;
}

.autocomplete-suggestion:hover {
  background: #f2f2f2;
}

.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
}
.login-title {
  text-align: center;
  margin-bottom: 1.5rem;
}
/* Estilo para el botón de historial */
.historial-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  line-height: 1.2;
  white-space: nowrap;
}
.truncate-cell {
  max-width: 160px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncate-cell.expanded {
  white-space: normal;
  max-height: none;
  background: #fff3cd;
  padding: 0.25rem;
  border-radius: 0.25rem;
  display: inline-block;
}

.truncate-cell.expandible-cell.expanded {
  white-space: normal;
  max-width: none;
}

.modal .table td, .modal .table th {
  font-size: 0.8rem;
}


@media (hover: none) and (pointer: coarse) {
  .truncate-cell.expanded {
    white-space: normal;
    max-height: none;
    background: #fff3cd;
    padding: 0.25rem;
    border-radius: 0.25rem;
  }
}
#spinner {
  transition: opacity 0.3s ease;
}

body {
  overflow-x: hidden; /* Evita scroll horizontal */
}

.table {
  table-layout: fixed; /* Asegura que las columnas no crezcan infinitamente */
  word-wrap: break-word; /* Rompe palabras largas */
}

.table td, .table th {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.truncate-cell {
  max-width: 160px; /* Ya tenías 200px, puede ajustarse aquí para móviles */
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tabla-articulos-body tr td:nth-child(11), /* observaciones */
#tabla-articulos-body tr td:nth-child(12)  /* tipo, si se ensancha mucho */
{
  white-space: normal;
  word-break: break-word;
}
.expandible-cell {
  position: relative;
  cursor: pointer;
}

.expandible-cell .more-icon {
  opacity: 0.4;
  font-size: 0.8em;
  margin-left: 5px;
  transition: opacity 0.2s ease;
}

.expandible-cell:hover .more-icon {
  opacity: 0.8;
}

.expandible-cell.expanded .more-icon {
  display: none;
}

.truncate-cell.expanded {
  white-space: normal;
  max-height: none;
  background: #fff3cd;
  padding: 0.25rem;
  border-radius: 0.25rem;
  display: inline-block;
}
.campo-valor-pair {
  margin-bottom: 12px;
}
.btn-remove-campo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border-width: 2px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-remove-campo i {
  pointer-events: none;
  font-weight: bold;
}
.btn-remove-campo:hover,
.btn-remove-campo:focus {
  background: #f8d7da;
  border-color: #dc3545;
  color: #a71d2a;
}
/* Fila seleccionada por checkbox */
.selected-row,
.selected-row td {
  background-color: #fffbe6 !important; /* Amarillo clarito */
  transition: background 0.2s;
}

.row-obsoleto {
  color: #aaa;
  background: #f3f3f3 !important;
}

/* Badges para campos clave */
.badge-estado {
  font-size: 0.8em;
  padding: 0.35em 0.75em;
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background: #f7faff;
}

.table thead.sticky-top {
  background: #f8f9fa;
  z-index: 1020;
  position: sticky;
  top: 0;
}

/* Animación verde tras guardar/cambiar */
@keyframes success-flash {
  0% { background: #d4edda; }
  100% { background: transparent; }
}
.table-success-flash {
  animation: success-flash 1.5s;
}
/* Tooltip (opcional, si quieres personalizar aún más) */
.bs-tooltip-auto[x-placement^=top], .bs-tooltip-top {
  font-size: 0.85em;
}
/* Grip de resize visible */
.th-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
  background: transparent;
  transition: background 0.2s;
}
.th-resizer:hover {
  background: #e9ecef;
}
th {
  position: relative; /* Necesario para el grip */
}



