/* ============================================================
   basictable_secretarios_v6.css
   Mejoras responsive para tablas de trámites DGAE-UNAM
   ============================================================ */

/* --- Estilo base de tabla (desktop) --- */
table.bt,
table.sortable {
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    width: 100%;
}

/* thead visible en desktop, oculto en móvil por basictable.js */
table.bt thead,
table.bt tbody th {
    display: none;
}

table.bt thead tr,
table.sortable thead tr {
    height: 35px;
    background: #36304a;
    border: 5px solid #36304a;
}

table.bt thead th {
    height: 60px;
    background: #36304a;
}

/* ============================================================
   VISTA MÓVIL — cada <td> se convierte en bloque con etiqueta
   ============================================================ */
table.bt tfoot th,
table.bt tfoot td,
table.bt tbody td {
    border: none;
    display: flex;               /* fila de etiqueta + contenido */
    flex-direction: row;
    align-items: flex-start;     /* alinear arriba cuando el texto es largo */
    vertical-align: middle !important;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 8px;
}

/* Etiqueta (data-th) en móvil */
table.bt tfoot th::before,
table.bt tfoot td::before,
table.bt tbody td::before {
    content: attr(data-th) ": ";
    display: inline-block;
    flex-shrink: 0;
    font-weight: bold;
    /* Ancho fijo suficiente para las etiquetas más largas */
    min-width: 130px;
    width: 130px;
    background: #36304a;        /* tono más oscuro que el original */
    color: #fff;
    margin-right: 10px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 3px;
    align-self: flex-start;     /* la etiqueta no estira aunque el texto sea largo */
}

/* Contenido del <td> ocupa el resto del ancho */
table.bt tfoot th .bt-content,
table.bt tfoot td .bt-content,
table.bt tbody td .bt-content {
    vertical-align: middle !important;
    flex: 1;
    min-width: 0;               /* permite que el texto haga word-wrap */
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Párrafos dentro de celdas */
table.bt tbody td p {
    margin: 0 0 6px 0;
    line-height: 1.5;
}

table.bt tbody td p:last-child {
    margin-bottom: 0;
}

/* Filas en móvil: separación entre registros */
table.bt tbody tr {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 12px;
    display: block;             /* cada fila = tarjeta */
    overflow: hidden;
    background: #fff;
}

/* Ocultar celdas marcadas como bt-hide */
table.bt tfoot th.bt-hide,
table.bt tfoot td.bt-hide,
table.bt tbody td.bt-hide {
    display: none;
}

/* Colores alternos en las etiquetas para legibilidad */
table.bt tbody tr td:nth-child(even)::before {
    background: #404040;
}

/* Links dentro de celdas */
span.bt-content a {
    margin-left: 0;
    word-break: break-all;
}

table.bt > tbody > tr > td {
    padding: 2px 0;
}

#table td,
#table th,
table.bt td > span,
table.bt th > span {
    vertical-align: middle !important;
}

/* ============================================================
   SCROLL WRAPPER — evita overflow horizontal en pantallas muy pequeñas
   ============================================================ */
.bt-wrapper.active {
    max-height: 310px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sin encabezado */
table.bt.bt--no-header tfoot td::before,
table.bt.bt--no-header tbody td::before {
    display: none;
}

/* ============================================================
   DESKTOP (≥ 768 px) — restaurar layout de tabla normal
   ============================================================ */
@media (min-width: 768px) {

    table.bt tbody tr {
        display: table-row;
        margin-bottom: 0;
        border-radius: 0;
        border: none;
    }

    table.bt tfoot th,
    table.bt tfoot td,
    table.bt tbody td {
        display: table-cell;
        padding: 8px 10px;
        vertical-align: top !important;
    }

    /* Ocultar las etiquetas generadas con ::before en desktop */
    table.bt tfoot th::before,
    table.bt tfoot td::before,
    table.bt tbody td::before {
        display: none;
    }

    /* Anchos de columna sugeridos para mejor legibilidad */
    table.bt tbody td:nth-child(1) { width: 18%; }
    table.bt tbody td:nth-child(2) { width: 9%;  }
    table.bt tbody td:nth-child(3) { width: 16%; }
    table.bt tbody td:nth-child(4) { width: 14%; }
    table.bt tbody td:nth-child(5) { width: 43%; }

    table.bt tbody td p {
        margin: 0 0 8px 0;
        line-height: 1.5;
    }
}
