/**
 * ESTILOS RESPONSIVE PARA TABLAS
 * Convierte tablas a cards en móvil o permite scroll horizontal
 */

/* Tablas responsive - Scroll horizontal en móvil */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.table-responsive table {
  min-width: 600px;
  width: 100%;
}

/* Tablas que se convierten en cards en móvil */
.table-card-mobile {
  display: table;
  width: 100%;
}

.table-card-mobile thead {
  display: table-header-group;
}

.table-card-mobile tbody {
  display: table-row-group;
}

.table-card-mobile tr {
  display: table-row;
}

.table-card-mobile td,
.table-card-mobile th {
  display: table-cell;
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

/* En móvil, convertir tabla a cards */
@media (max-width: 768px) {
  .table-card-mobile {
    display: block;
  }

  .table-card-mobile thead {
    display: none;
  }

  .table-card-mobile tbody {
    display: block;
  }

  .table-card-mobile tr {
    display: block;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border: 1px solid #e0e0e0;
  }

  .table-card-mobile td {
    display: block;
    padding: 0.5rem 0;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-left: 50%;
  }

  .table-card-mobile td:last-child {
    border-bottom: none;
  }

  .table-card-mobile td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: #666;
  }
}

/* Tablet: mantener tabla pero ajustar */
@media (min-width: 768px) and (max-width: 1024px) {
  .table-responsive {
    overflow-x: auto;
  }

  .table-responsive table {
    font-size: 0.9rem;
  }

  .table-responsive td,
  .table-responsive th {
    padding: 0.625rem;
  }
}

/* Asegurar que las tablas no se desborden */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

table td,
table th {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

