/* VARIABLES Y CONFIGURACIÓN INICIAL (Adaptadas) */
:root {
  --color-primary: #3b82f6; /* blue-500 */
  --color-bg-light: #f9fafb; /* gray-50 */
  --color-text-dark: #1f2937; /* gray-900 */
  --color-border: #e2e8f0; /* slato-200 */
  /* Ajuste de espaciado para que sea visible la separación entre tarjetas */
  --spacing-sm: 0.75rem; /* Aumentado a 0.75rem para ver la separación */
  --spacing-md: 0.5rem; /* Ajuste interno de padding a 0.5rem */
  --tblr-body-color: #334155;
  --tblr-secondary: #64748b;
  --tblr-list-gap: 0.5rem;
}

/* ESTILOS BASE DE ESCRITORIO (CARD-TABLE / TAILADMIN) */

/* Clases de ancho (alg-X) para desktop */
.card-table .alg-5 {
  width: 5%;
}
.card-table .alg-10 {
  width: 10%;
}
.card-table .alg-15 {
  width: 15%;
}
.card-table .alg-20 {
  width: 20%;
}
.card-table .alg-25 {
  width: 25%;
}
.card-table .alg-30 {
  width: 30%;
}
.card-table .alg-35 {
  width: 35%;
}
.card-table .alg-40 {
  width: 40%;
}
.card-table .alg-45 {
  width: 45%;
}
.card-table .alg-50 {
  width: 50%;
}
.card-table .alg-55 {
  width: 55%;
}
.card-table .alg-60 {
  width: 60%;
}
.card-table .alg-65 {
  width: 65%;
}
.card-table .alg-70 {
  width: 70%;
}
.card-table .alg-75 {
  width: 75%;
}
.card-table .alg-80 {
  width: 80%;
}
.card-table .alg-85 {
  width: 85%;
}
.card-table .alg-90 {
  width: 90%;
}
.card-table .alg-95 {
  width: 95%;
}
.card-table .alg-100 {
  width: 100%;
}

/* Controla que el texto no desborde las celdas */
.card-table th,
.card-table td {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.card-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-table thead th {
  background-color: #fff;
  color: #0f172a;
  padding: 5px 5px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 1px solid #cbd5e1;
}

.card-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.2s ease;
}

.card-table tbody tr:hover {
  background-color: #f8fafc;
}

.card-table tbody td {
  padding: 2px 5px;
  font-size: 14px;
  color: #000;
}

/* Estilos de botones de acciones */
.card-table .btn-list {
  --tblr-list-gap: 0.5rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--tblr-list-gap);
}

@media (max-width: 767.98px) {
  .table-mobile-md {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
  }

  .table-mobile-md thead {
    display: none;
  }

  /* TR como Card de Bootstrap */
  .table-mobile-md tbody {
    width: 100%;
    display: block;
    border-radius: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1); /* Borde sutil */
  }

  .table-mobile-md tr {
    display: block;
    width: 100%;
    /* AÑADIDO: Margen para la separación entre tarjetas (registros) */
    margin-bottom: var(--spacing-sm);

    /* Estilo de la Card */
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1); /* Borde sutil */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); /* Sombra suave de Bootstrap */
    background-color: #ffffff; /* Fondo de la tarjeta */
    overflow: hidden;
  }

  /* TD como Item de la Card */
  .table-mobile-md td {
    display: block;
    padding: var(--spacing-md) 0.75rem; /* Padding interno de la Card-Item */
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* Separador suave */
    font-size: 0.9rem;
    color: var(--tblr-body-color);
    line-height: 1.3;
    white-space: normal !important;
    position: relative;
    text-align: right;
  }

  /* Última celda sin borde (Parte inferior de la Card) */
  .table-mobile-md td:last-child {
    border-bottom: none;
  }

  /* Etiqueta + Valor (Lógica data-label) */
  .table-mobile-md td[data-label]:not([data-label=""]) {
    padding-left: 50%;
    text-align: left;
    font-size: 0.9rem;
  }

  .table-mobile-md td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 45%;
    padding-left: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--tblr-secondary);
    text-align: left;
  }

  /* Celdas SIN data-label (Ocupan 100%) */
  .table-mobile-md td:not([data-label]),
  .table-mobile-md td[data-label=""] {
    padding-left: 0.75rem;
    text-align: left;
    justify-content: flex-start;
  }

  /* Ajuste para los botones en la vista móvil */
  .table-mobile-md .btn-list {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--tblr-list-gap, 0.5rem);
    margin-top: 0.25rem;
    width: 100%;
  }
}
/* === CONTROL DE SCROLL INTERNO (para tablas con max-height) === */
.table-mobile-md {
  overflow-y: auto; /* permite scroll */
  -webkit-overflow-scrolling: touch; /* suaviza en iOS */
}

/* Oculta scrollbar visual pero mantiene el scroll funcional */
.table-mobile-md::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.table-mobile-md {
  scrollbar-width: none; /* Firefox */
}
