/* sheet-renderer.css — Transparente Virtual
 * CSS del renderizador universal de hojas con shortcode [tv_hoja].
 * Reutiliza clases BEM de catedras-template.css para la tabla.
 * Los selectores del contenedor son propios (.tv-sheet-container, .tv-sheet__info, etc.)
 */

/* Ocultar título de página del tema (mismo que los templates legacy) */
.kingster-page-title-wrap {
    display: none;
}

/* ============================================================
   Contenedor principal del shortcode
   ============================================================ */
.tv-sheet-container {
    max-width: 75rem;
    margin: 0 auto;
    padding: 1.25rem;
    font-family: Arial, sans-serif;
}

.tv-sheet__header {
    background: #e8f4fd;
    border: 0.0625rem solid #bee5eb;
    border-radius: 0.5rem;
    padding: 0.9375rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.tv-sheet__title {
    color: #0c5460;
    margin: 0 0 0.625rem 0;
}

.tv-sheet__info {
    background: #f5f5f5;
    padding: 0.9375rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.tv-sheet__table-container {
    /* wrapper para la tabla y DataTables */
}

/* ============================================================
   Tabla compartida (clases BEM reutilizadas por el renderer)
   ============================================================ */
.catedras__table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.catedras__table-header {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: bold;
    font-size: 1.125rem;
    text-transform: capitalize;
}

.catedras__table-cell {
    padding: 0.625rem 0.5rem;
    border-bottom: 0.0625rem solid #eee;
    font-size: 0.8125rem;
    vertical-align: top;
    text-align: left;
}

.catedras__table-row:hover {
    background-color: #f8f9fa;
}

.catedras__table-row--alerta {
    background-color: rgba(255, 0, 0, 0.339) !important;
}

/* ============================================================
   Buscador DataTables
   ============================================================ */
.catedras_search-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.catedras_search-wrapper input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.catedras_search-wrapper .dataTables_filter {
    width: 100%;
}

/* Buscador full-width para tablas del renderer (selector genérico por sufijo de ID) */
[id$="_wrapper"] .dataTables_filter {
    width: 100%;
    margin-bottom: 1rem;
}

[id$="_wrapper"] .dataTables_filter label {
    width: 100%;
    margin: 0;
    display: block;
}

[id$="_wrapper"] .dataTables_filter input {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Ocultar iconos de ordenación */
[id$="_wrapper"] thead th.sorting::before,
[id$="_wrapper"] thead th.sorting::after,
[id$="_wrapper"] thead th.sorting_asc::before,
[id$="_wrapper"] thead th.sorting_asc::after,
[id$="_wrapper"] thead th.sorting_desc::before,
[id$="_wrapper"] thead th.sorting_desc::after {
    display: none !important;
    content: none !important;
}

[id$="_wrapper"] thead th.sorting,
[id$="_wrapper"] thead th.sorting_asc,
[id$="_wrapper"] thead th.sorting_desc {
    background-image: none !important;
}

/* ============================================================
   Datos y estados
   ============================================================ */
.catedras-data {
    font-weight: 500;
    color: #2c3e50;
    font-size: 1rem;
}

.estado {
    text-align: center;
    padding: 2.5rem;
    color: #666;
}

.estado--error {
    background: #e74c3c;
    color: white;
    padding: 0.9375rem;
    border-radius: 0.5rem;
    text-align: center;
    margin: 1.25rem 0;
}

/* ============================================================
   Integración BEM con DataTables
   ============================================================ */
.catedras__table.dataTable {
    margin-top: 0;
}

.catedras__table.dataTable thead th {
    background: #2c3e50;
    color: white;
    border-bottom: 0.125rem solid #34495e;
}

.catedras__table.dataTable tbody tr:hover {
    background-color: #f8f9fa;
}

.catedras__table-header::after,
.catedras__table-header::before {
    display: none !important;
}

/* ============================================================
   Barra de filtros por columna
   ============================================================ */
.tv-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e8e8e8;
}

.tv-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 10rem;
    flex: 1 1 10rem;
    max-width: 18rem;
}

.tv-filter-item__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tv-filter-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
    color: #2c3e50;
}

.tv-filter-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.15);
}

/* Filtros activos */
.tv-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
}

.tv-active-filters__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #666;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.tv-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem 0.25rem 0.625rem;
    background: #e8f4fb;
    border: 1px solid #bee3f8;
    border-radius: 999px;
    font-size: 0.8125rem;
    color: #0c5c8a;
}

.tv-filter-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    margin-left: 0.1rem;
    background: none;
    border: none;
    border-radius: 50%;
    color: #0073aa;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.tv-filter-chip__remove:hover {
    background: #0073aa;
    color: #fff;
}

.tv-filter-clear-all {
    padding: 0.2rem 0.6rem;
    background: none;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: #666;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.tv-filter-clear-all:hover {
    border-color: #d63638;
    color: #d63638;
}

/* ============================================================
   Responsive — vista de tarjeta en móvil
   ============================================================ */
@media (max-width: 48rem) {
    .tv-sheet-container {
        padding: 0.75rem;
    }

    .catedras__table {
        font-size: 0.75rem;
    }

    .catedras__table-header,
    .catedras__table-cell {
        padding: 0.5rem 0.25rem;
    }

    .tv-sheet__info {
        flex-direction: column;
        text-align: center;
    }

    .catedras__table thead {
        display: none;
    }

    .catedras__table tbody .catedras__table-row {
        display: block;
        margin-bottom: 0.9375rem;
        border: 0.0625rem solid #ddd;
        border-radius: 0.5rem;
        padding: 0.75rem;
        background: white;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    }

    .catedras__table tbody .catedras__table-cell {
        display: block;
        padding: 0.5rem 0;
        border: none;
        position: relative;
        padding-left: 7.5rem;
        min-height: 1.25rem;
    }

    .catedras__table tbody .catedras__table-cell:before {
        content: attr(data-th)": ";
        position: absolute;
        left: 0;
        top: 0.5rem;
        font-weight: bold;
        color: #2c3e50;
        font-size: 1rem;
        text-transform: uppercase;
        width: 6.875rem;
    }
}

/* ============================================================
   Details / Summary — columnas colapsables dentro de otra celda
   ============================================================ */
.tv-details {
    cursor: default;
}

.tv-details__summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.tv-details__summary::-webkit-details-marker { display: none; }

.tv-details__summary::before {
    content: '▶';
    font-size: 0.6em;
    color: #888;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.tv-details[open] > .tv-details__summary::before {
    transform: rotate(90deg);
}

.tv-details__content {
    margin-top: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: rgba(0, 0, 0, 0.04);
    border-left: 2px solid #c0cdd8;
    border-radius: 0 0.25rem 0.25rem 0;
    font-size: 0.85em;
    line-height: 1.6;
}

.tv-details__item + .tv-details__item {
    margin-top: 0.1rem;
}

.tv-details__label {
    font-weight: 600;
    color: #4a5568;
}
