/* tabletools.css — reusable filter/sort/pagination enhancer for plain tables.
   Theme-aware: relies on the app's CSS variables with safe fallbacks. */

.tt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 4px 0 12px;
}

.tt-toolbar .tt-search-wrap {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 340px;
}

.tt-toolbar .tt-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border, #E2E8F0);
    border-radius: 10px;
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    font-size: 0.9rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tt-toolbar .tt-search:focus {
    border-color: var(--primary, #4A6CF7);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4A6CF7) 18%, transparent);
}

.tt-toolbar .tt-search-ico {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    pointer-events: none;
}

.tt-toolbar .tt-spacer { flex: 1 1 auto; }

.tt-toolbar .tt-pagesize-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted, #64748b);
    font-size: 0.82rem;
    white-space: nowrap;
}

.tt-toolbar .tt-pagesize {
    padding: 7px 28px 7px 10px;
    border: 1px solid var(--border, #E2E8F0);
    border-radius: 10px;
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.tt-toolbar .tt-pagesize:focus {
    border-color: var(--primary, #4A6CF7);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #4A6CF7) 18%, transparent);
}

/* Sortable headers */
th.tt-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.tt-sortable .tt-caret {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.72em;
    line-height: 1;
    color: var(--text-muted, #94a3b8);
    opacity: 0.55;
    transition: opacity .15s ease, color .15s ease;
}

th.tt-sortable:hover .tt-caret { opacity: 0.9; }

th.tt-sortable.tt-asc .tt-caret,
th.tt-sortable.tt-desc .tt-caret {
    color: var(--primary, #4A6CF7);
    opacity: 1;
}

/* Footer / pagination */
.tt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.tt-footer .tt-info {
    color: var(--text-muted, #64748b);
    font-size: 0.82rem;
}

.tt-pager {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tt-pager button {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border, #E2E8F0);
    border-radius: 9px;
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.tt-pager button:hover:not(:disabled):not(.tt-active) {
    background: color-mix(in srgb, var(--primary, #4A6CF7) 10%, var(--surface, #fff));
    border-color: color-mix(in srgb, var(--primary, #4A6CF7) 40%, var(--border, #E2E8F0));
}

.tt-pager button.tt-active {
    background: var(--primary, #4A6CF7);
    border-color: var(--primary, #4A6CF7);
    color: #fff;
    font-weight: 600;
}

.tt-pager button:disabled {
    opacity: 0.45;
    cursor: default;
}

.tt-pager .tt-ellipsis {
    padding: 0 4px;
    color: var(--text-muted, #94a3b8);
    align-self: center;
}

.tt-empty-row td {
    text-align: center;
    color: var(--text-muted, #64748b);
    padding: 22px 12px !important;
    font-style: italic;
}
