/**
 * Viva Elementor Kit - Table Widget Styles
 *
 * @package VivaElementorKit
 * @since 1.0.0
 */

/* ===== Wrapper ===== */
.vek-table-wrapper {
	width: 100%;
}

/* ===== Controls bar (search) ===== */
.vek-table-controls {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 12px;
}

.vek-table-search {
	padding: 6px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	outline: none;
	min-width: 200px;
}

.vek-table-search:focus {
	border-color: #aaa;
}

/* ===== Scroll wrapper (responsive) ===== */
.vek-table-scroll {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ===== Table ===== */
.vek-table {
	width: 100%;
	border-collapse: separate; /* collapse だと border-radius が効かないため separate を使用 */
	border-spacing: 0;         /* collapse と同等の隣接表示を維持 */
	table-layout: auto;
}

/* ===== Header ===== */
.vek-table thead th {
	text-align: left;
	white-space: nowrap;
	user-select: none;
}

.vek-table thead th.vek-sortable {
	cursor: pointer;
}

.vek-table thead th.vek-sortable:hover {
	opacity: 0.8;
}

/* Sort icon */
.vek-sort-icon {
	display: inline-block;
	margin-left: 4px;
	font-size: 11px;
	opacity: 0.4;
}

.vek-sort-icon::after {
	content: '⇅';
}

th.vek-sort-asc .vek-sort-icon::after {
	content: '▲';
	opacity: 1;
}

th.vek-sort-desc .vek-sort-icon::after {
	content: '▼';
	opacity: 1;
}

th.vek-sort-asc .vek-sort-icon,
th.vek-sort-desc .vek-sort-icon {
	opacity: 1;
}

/* ===== Body ===== */
.vek-table tbody tr {
	transition: background-color 0.15s ease;
}

/* Striped rows (toggled via JS class on table) */
.vek-table.vek-striped tbody tr:nth-child(even) {
	background-color: var(--vek-table-stripe-color, #f9f9f9);
}

/* ===== Cell ===== */
.vek-table th,
.vek-table td {
	vertical-align: middle;
	word-break: break-word;
}

/* border-collapse: separate による二重線防止 — 左・上の枠線を隣接セルに任せる */
.vek-table th + th,
.vek-table td + td {
	border-left-width: 0;
}
.vek-table tbody tr + tr th,
.vek-table tbody tr + tr td {
	border-top-width: 0;
}
.vek-table thead tr + tr th {
	border-top-width: 0;
}
.vek-table thead + tbody tr:first-child th,
.vek-table thead + tbody tr:first-child td {
	border-top-width: 0;
}

/* ===== Image cell ===== */
.vek-table-img {
	max-width: 80px;
	height: auto;
	display: block;
}

/* ===== Button cell ===== */
.vek-table-btn {
	display: inline-block;
	padding: 4px 14px;
	border-radius: 3px;
	text-decoration: none;
	font-size: 13px;
	white-space: nowrap;
	background-color: #333;
	color: #fff;
	transition: opacity 0.2s ease;
}

.vek-table-btn:hover {
	opacity: 0.8;
}

/* ===== No results ===== */
.vek-table-no-results {
	text-align: center;
	padding: 20px;
	color: #999;
}

/* ===== Footer (pagination) ===== */
.vek-table-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.vek-table-info {
	font-size: 13px;
	color: #666;
}

.vek-table-pages {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.vek-page-btn {
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: 1px solid #ddd;
	background: #fff;
	cursor: pointer;
	border-radius: 3px;
	font-size: 13px;
	line-height: 1;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.vek-page-btn:hover:not(:disabled) {
	background-color: #f0f0f0;
}

.vek-page-btn.vek-active {
	background-color: #333;
	color: #fff;
	border-color: #333;
}

.vek-page-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ===== Hidden row (search filter / pagination) ===== */
.vek-row-hidden {
	display: none !important;
}
