/* Table Components */

/* 1. Interactive Rows */
.table-interactive tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table-interactive tbody tr:hover {
    background-color: var(--primary-50);
}

/* 2. Sticky Headers */
.table-wrapper {
    /* Define a max-height to enable scrolling within the wrapper if desired, 
       or rely on window scroll. For sticky headers to work within a container, 
       the container needs a height. */
    position: relative;
    overflow-x: auto; /* Keep horizontal scroll */
}

.table-sticky thead th {
    position: sticky;
    top: 0;
    background-color: #fff; /* Match card background */
    z-index: 10;
    box-shadow: 0 1px 0 var(--gray-200); /* Subtle separator */
}

/* 3. Contextual Actions */
.table-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

/* Show actions on hover */
.table-interactive tbody tr:hover .table-actions {
    opacity: 1;
}

/* Always show actions if a focusable element inside is focused (accessibility) */
.table-interactive tbody tr:focus-within .table-actions {
    opacity: 1;
}

/* Mobile fallback: always show actions on small screens */
@media (max-width: 768px) {
    .table-actions {
        opacity: 1;
    }
}

/* 4. Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background-color: var(--gray-50);
    border-radius: 0.5rem;
    border: 2px dashed var(--gray-200);
    color: var(--gray-500);
    margin-top: 1rem;
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--gray-400);
    /* You can use an SVG background or font icon here */
}

.empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state__description {
    max-width: 400px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* 5. Grupos Listing Layout */
.grupos-table td {
    vertical-align: top;
    padding: 1.25rem;
}

.grupo-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.grupo-row__heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.grupo-row__code {
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

.grupo-row__course {
    margin: 0.15rem 0 0;
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

.grupo-row__heading-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grupo-row__dates {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

.grupo-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grupo-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.grupo-kpi {
    background-color: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.grupo-kpi span {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grupo-kpi strong {
    font-size: var(--font-size-base);
    color: var(--gray-900);
}

.grupo-kpi small {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.grupo-kpi--span {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .grupo-row__heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .grupo-kpi--span {
        grid-column: span 1;
    }
}

.grupos-table .table-actions {
    flex-direction: column;
    align-items: flex-end;
}

.grupos-table .table-actions .btn {
    width: 100%;
}
