/**
 * VK Chart Builder — Table chart type styles.
 */

/* ── Table container ───────────────────────────────────────────── */

.vk-chart-table-block {
    position: relative;
}

.vk-chart-table-wrap {
    overflow-x: auto;
}

.vk-chart-table-wrap.vk-chart-table-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Table ──────────────────────────────────────────────────────── */

.vk-chart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.vk-chart-table th,
.vk-chart-table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.vk-chart-table thead th {
    background: #f5f5f5;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

.vk-chart-table thead th:hover {
    background: #eaeaea;
}

.vk-chart-table tbody tr:nth-child(even) {
    background: #fafafa;
}

/* ── Sort indicators ───────────────────────────────────────────── */

.vk-chart-sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
}

.vk-chart-table thead th.vk-chart-sort-active .vk-chart-sort-indicator {
    color: #2271b1;
}

/* ── Pagination ────────────────────────────────────────────────── */

.vk-chart-table-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.vk-chart-table-pagination button {
    padding: 4px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f7f7f7;
    cursor: pointer;
    font-size: 13px;
}

.vk-chart-table-pagination button:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #999;
}

.vk-chart-table-pagination button:disabled {
    opacity: 0.5;
    cursor: default;
}

.vk-chart-table-page-info {
    color: #666;
}

/* ── Context menu (data download) ───────────────────────────────── */

.vk-chart-table-menu-wrap {
    position: absolute;
    top: 0;
    right: 20px;
    z-index: 10;
}

.vk-chart-table-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #666;
    cursor: pointer;
}

.vk-chart-table-menu-btn:hover,
.vk-chart-table-menu-btn[aria-expanded="true"] {
    background: #e6e6e6;
    color: #333;
}

.vk-chart-table-menu-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #2271b1;
}

.vk-chart-table-menu-icon,
.vk-chart-table-menu-icon::before,
.vk-chart-table-menu-icon::after {
    display: block;
    width: 14px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.vk-chart-table-menu-icon {
    position: relative;
}

.vk-chart-table-menu-icon::before,
.vk-chart-table-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.vk-chart-table-menu-icon::before {
    top: -4px;
}

.vk-chart-table-menu-icon::after {
    top: 4px;
}

.vk-chart-table-menu {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    min-width: 160px;
    padding: 7px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.vk-chart-table-menu[hidden] {
    display: none;
}

.vk-chart-table-menu-item {
    display: block;
    width: 100%;
    padding: 6px;
    border: none;
    background: transparent;
    color: #333;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.vk-chart-table-menu-item:hover,
.vk-chart-table-menu-item:focus {
    background: #f2f2f2;
    outline: none;
}

.vk-chart-table-menu-sep {
    height: 1px;
    margin: 5px 0;
    background: #e0e0e0;
}