.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid var(--ds-laseme-card-border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    margin: 1.5rem 0 2.5rem;
    padding: 0;
    background-color: var(--ds-laseme-card-background-color);

    /* Estas sombras aparecen solo cuando hay contenido para desplazar */
    background:
        linear-gradient(to right, var(--ds-laseme-card-background-color) 30%, transparent),
        linear-gradient(to left, var(--ds-laseme-card-background-color) 30%, transparent) 100% 0,
        linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent 20px),
        linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent 20px) 100% 0;
    background-attachment: local, local, scroll, scroll;
    background-repeat: no-repeat;
    background-size: 50px 100%, 50px 100%, 20px 100%, 20px 100%;

    /* Firefox scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--ds-laseme-card-border-color) transparent;
}

[data-theme="dark"] .table-responsive {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: var(--ds-laseme-black-border);
    background-image:
        linear-gradient(to right, var(--ds-laseme-card-background-color) 30%, transparent),
        linear-gradient(to left, var(--ds-laseme-card-background-color) 30%, transparent) 100% 0,
        linear-gradient(to right, rgba(0, 0, 0, 0.4), transparent 20px),
        linear-gradient(to left, rgba(0, 0, 0, 0.4), transparent 20px) 100% 0;
}

.table,
.views-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-family: var(--ds-laseme-main-font-family), sans-serif;
    color: var(--ds-laseme-primary-text-color);
}

/* Header styling */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--ds-laseme-secondary-pure-color-background);
    color: var(--ds-laseme-primary-heading-color);
    font-family: var(--ds-laseme-title-font-family), sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1.25rem 1.5rem;
    border: none;
    border-bottom: 2px solid var(--ds-laseme-card-border-color);
    text-align: left;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.table thead th:has(a):hover {
    background-color: var(--ds-laseme-secondary-pure-color-hover);
}


[data-theme="dark"] .table thead th {
    border-bottom-color: var(--ds-laseme-black-border);
}

/* Table sorting */
.table thead th a {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
    position: relative;
}

.table thead th a:hover {
    color: var(--ds-laseme-primary-color);
}

.table thead th a::after {
    content: '';
    width: 18px;
    height: 18px;
    margin-left: 4px;
    background-color: currentColor;
    transition: all 0.2s ease;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.table thead th a:hover::after {
    opacity: 0.3;
    transform: translateY(2px);
}

.tablesort {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    background-color: var(--ds-laseme-primary-color);
    background-image: none !important;
    vertical-align: middle;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: transform 0.2s ease;
}

.table thead th:has(.tablesort) a::after {
    display: none;
}

.tablesort--asc {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E");
}

.tablesort--desc {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .tablesort {
    background-color: var(--ds-laseme-primary-color);
}



/* Cell styling */
.table th,
.table td {
    padding: 1.25rem 1.5rem;
    vertical-align: middle;
}

.table tbody td {
    border-top: none;
    border-bottom: 1px solid var(--ds-laseme-card-border-color);
    font-size: 0.875rem;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .table tbody td {
    border-bottom-color: var(--ds-laseme-black-border);
}

.table tbody tr:last-of-type td {
    border-bottom: none;
}

.views-field-title,
.views-field-title-table-column {
    font-weight: 500;
    color: var(--ds-laseme-primary-heading-color);
}

/* Zebra striping - very subtle */
.table tbody tr:nth-of-type(even) {
    background-color: var(--ds-laseme-pure-color-background);
}

/* Hover state */
.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--ds-laseme-secondary-pure-color-hover) !important;
}

.table tbody tr:hover td:first-child {
    box-shadow: inset 4px 0 0 var(--ds-laseme-primary-color);
}

/* Pagination */
nav[aria-label="pagination-heading"] {
    margin: 3rem 0;
}

.pagination.js-pager__items {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    list-style: none;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    width: auto;
    padding: 0 8px;
    background-color: var(--ds-laseme-card-background-color);
    color: var(--ds-laseme-primary-text-color);
    border: 1px solid var(--ds-laseme-card-border-color);
    border-radius: 10px;
    font-family: var(--ds-laseme-title-font-family);
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination .page-item.active .page-link {
    background-color: var(--ds-laseme-primary-color);
    color: #ffffff;
    border-color: var(--ds-laseme-primary-color);
    box-shadow: 0 4px 12px rgba(120, 38, 52, 0.25);
    font-weight: 600;
}

.pagination .page-item .page-link:hover {
    background-color: var(--ds-laseme-secondary-pure-color-hover);
    color: var(--ds-laseme-primary-heading-color);
    border-color: var(--ds-laseme-secondary-pure-color-hover);
    transform: translateY(-2px);
}

[data-theme="dark"] .pagination .page-item .page-link {
    border-color: var(--ds-laseme-black-border);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.25;
    background-color: transparent;
    cursor: default;
    pointer-events: none;
}

/* Links inside tables */
.table tbody td a {
    color: var(--ds-laseme-link-color);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.table tbody td a:hover {
    color: var(--ds-laseme-link-hover-color);
    border-bottom-color: var(--ds-laseme-link-hover-color);
}

table tr th {
    color: var(--ds-laseme-primary-heading-color);
}

table tr th a {
    color: inherit;
    text-decoration: none;
}

table tr th,
table tr th a,
table tr th a:hover,
table tr th a:focus {
    color: var(--ds-laseme-primary-text-color);
}

tr td,
tr th {
    border: none;
}

/* Custom scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--ds-laseme-card-border-color);
    border-radius: 10px;
    border: 2px solid var(--ds-laseme-card-background-color);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--ds-laseme-primary-color);
}