/* ProTables frontend styles */
.pt-wrap {
	--pt-accent: #2563eb;
	--pt-border: #e2e8f0;
	--pt-head-bg: #f1f5f9;
	--pt-head-color: #0f172a;
	--pt-text: inherit;
	--pt-bg: transparent;
	--pt-stripe: rgba(15, 23, 42, .035);
	--pt-hover: rgba(37, 99, 235, .07);
	--pt-radius: 6px;
	--pt-pad: .6em .75em;
	--pt-font: inherit;
	position: relative;
	margin: 0 0 1.5em;
	max-width: 100%;
	font-family: var(--pt-font);
	color: var(--pt-text);
	box-sizing: border-box;
}
.pt-wrap *, .pt-wrap *::before, .pt-wrap *::after { box-sizing: border-box; }
.pt-table-name { margin: 0 0 .5em; }
.pt-table-description { margin: .5em 0; opacity: .85; }
.pt-error { padding: .75em 1em; border: 1px dashed #dc2626; color: #b91c1c; border-radius: 4px; font-size: 14px; }

.pt-scroll { width: 100%; border-radius: var(--pt-radius); }
.pt-responsive-scroll .pt-scroll,
.pt-responsive-collapse .pt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pt-scroll-y .pt-scroll { overflow: auto; }
.pt-scroll-y .pt-table thead th { position: sticky; top: 0; z-index: 3; }
.pt-scroll-y .pt-table thead tr.pt-filter-row th { top: var(--pt-filter-top, 2.4em); }

/* Base table */
.pt-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	margin: 0;
	background: var(--pt-bg);
	font-size: 0.95em;
	line-height: 1.45;
	border: 1px solid var(--pt-border);
	border-radius: var(--pt-radius);
	overflow: visible;
}
.pt-table th, .pt-table td {
	padding: var(--pt-pad);
	text-align: start;
	vertical-align: top;
	border: 0;
	border-bottom: 1px solid var(--pt-border);
	background-clip: padding-box;
}
.pt-table thead th, .pt-table tfoot th {
	background: var(--pt-head-bg);
	color: var(--pt-head-color);
	font-weight: 600;
	vertical-align: middle;
}
.pt-table thead tr:first-child th:first-child { border-top-left-radius: var(--pt-radius); }
.pt-table thead tr:first-child th:last-child { border-top-right-radius: var(--pt-radius); }
.pt-table tbody tr:last-child > * { border-bottom: 0; }
.pt-table tfoot th { border-top: 1px solid var(--pt-border); border-bottom: 0; }
.pt-table tbody tr > * { background-color: var(--pt-bg); }
.pt-striped tbody tr.even > *, .pt-striped tbody tr:nth-child(even):not(.odd) > * { background-color: var(--pt-stripe); }
.pt-hover tbody tr:not(.pt-group):not(.pt-child):hover > * { background-color: var(--pt-hover); }
.pt-table tbody th { font-weight: 600; }
.pt-table img { max-width: 100%; height: auto; vertical-align: middle; }
.pt-table .pt-highlight { background-color: #fef9c3; }
.pt-table tr.pt-highlight-row > * { background-color: inherit; }
.pt-formula-error { color: #b91c1c; font-size: .85em; }

/* Themes */
.pt-theme-minimal { border: 0; }
.pt-theme-minimal thead th { background: transparent; border-bottom: 2px solid var(--pt-head-color); }
.pt-theme-bordered th, .pt-theme-bordered td { border: 1px solid var(--pt-border); }
.pt-theme-bordered { border-collapse: collapse; }
.pt-theme-modern { border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(15,23,42,.08); overflow: hidden; }
.pt-theme-modern thead th { background: var(--pt-accent); color: #fff; text-transform: uppercase; letter-spacing: .03em; font-size: .82em; }
.pt-theme-dark { --pt-bg: #0f172a; --pt-stripe: #131c33; --pt-hover: #1e293b; --pt-border: #1f2a44; --pt-head-bg: #020617; --pt-head-color: #e2e8f0; color: #cbd5e1; }
.pt-wrap:has(.pt-theme-dark) { --pt-bg: #0f172a; --pt-stripe: #131c33; --pt-hover: #1e293b; --pt-border: #1f2a44; --pt-head-bg: #020617; --pt-head-color: #e2e8f0; }
.pt-theme-compact { font-size: .85em; }
.pt-theme-compact th, .pt-theme-compact td { padding: .3em .5em; }
.pt-theme-none, .pt-theme-none th, .pt-theme-none td { border: revert; background: revert; padding: revert; border-radius: 0; }

/* Controls */
.pt-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6em 1em; font-size: .9em; }
.pt-top { margin-bottom: .75em; }
.pt-bottom { margin-top: .75em; }
.pt-search { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .4em; }
.pt-length { display: inline-flex; align-items: center; gap: .4em; }
.pt-controls input[type=search], .pt-controls select, .pt-filter-row input, .pt-filter-row select {
	font: inherit; font-size: .95em; padding: .35em .6em; border: 1px solid var(--pt-border); border-radius: 5px;
	background: #fff; color: #0f172a; min-height: 2.1em; max-width: 100%;
}
.pt-controls input[type=search] { min-width: 180px; }
.pt-controls input:focus, .pt-controls select:focus, .pt-filter-row input:focus, .pt-filter-row select:focus { outline: 2px solid var(--pt-accent); outline-offset: 1px; }
.pt-buttons { display: inline-flex; flex-wrap: wrap; gap: .35em; position: relative; }
.pt-btn {
	font: inherit; font-size: .9em; cursor: pointer; padding: .4em .85em; border: 1px solid var(--pt-border);
	background: #fff; color: #0f172a; border-radius: 5px; line-height: 1.3;
}
.pt-btn:hover { border-color: var(--pt-accent); color: var(--pt-accent); }
.pt-colvis-menu {
	position: absolute; top: 100%; inset-inline-start: 0; z-index: 30; margin-top: 4px; background: #fff; color: #0f172a;
	border: 1px solid var(--pt-border); border-radius: 6px; box-shadow: 0 10px 25px rgba(0,0,0,.12); padding: .4em; min-width: 200px; max-height: 320px; overflow: auto;
}
.pt-colvis-menu label { display: flex; gap: .5em; align-items: center; padding: .3em .5em; cursor: pointer; border-radius: 4px; white-space: nowrap; }
.pt-colvis-menu label:hover { background: #f1f5f9; }

.pt-info { opacity: .8; }
.pt-pages { display: inline-flex; flex-wrap: wrap; gap: .25em; align-items: center; margin-inline-start: auto; }
.pt-page {
	font: inherit; cursor: pointer; min-width: 2.2em; padding: .35em .7em; border: 1px solid var(--pt-border);
	background: #fff; color: #0f172a; border-radius: 5px; line-height: 1.2;
}
.pt-page:hover:not([disabled]):not(.is-current) { border-color: var(--pt-accent); color: var(--pt-accent); }
.pt-page.is-current { background: var(--pt-accent); border-color: var(--pt-accent); color: #fff; cursor: default; }
.pt-page[disabled] { opacity: .45; cursor: not-allowed; }
.pt-ellipsis { padding: 0 .3em; opacity: .6; }

.pt-alpha { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: .75em; }
.pt-alpha button { font: inherit; font-size: .85em; cursor: pointer; padding: .25em .5em; min-width: 2em; border: 1px solid var(--pt-border); background: #fff; color: #0f172a; border-radius: 4px; }
.pt-alpha button.is-active { background: var(--pt-accent); color: #fff; border-color: var(--pt-accent); }

/* Sorting */
.pt-table th.pt-sortable { cursor: pointer; user-select: none; position: relative; padding-inline-end: 1.8em; }
.pt-table th.pt-sortable::after {
	content: ""; position: absolute; inset-inline-end: .6em; top: 50%; width: .5em; height: .85em; margin-top: -.42em; opacity: .3;
	background: linear-gradient(currentColor, currentColor) no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 0l4 5H0zM4 14l4-5H0z'/%3E%3C/svg%3E") center/contain no-repeat;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 0l4 5H0zM4 14l4-5H0z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.pt-table th.pt-sort-asc::after { opacity: 1; -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 0l4 5H0z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 0l4 5H0z'/%3E%3C/svg%3E"); }
.pt-table th.pt-sort-desc::after { opacity: 1; -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 14l4-5H0z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M4 14l4-5H0z'/%3E%3C/svg%3E"); }
.pt-table th.pt-sortable:focus-visible { outline: 2px solid var(--pt-accent); outline-offset: -2px; }

/* Filters */
.pt-table thead tr.pt-filter-row th { background: var(--pt-bg); padding: .35em .5em; font-weight: normal; }
.pt-filter-row input, .pt-filter-row select { width: 100%; min-width: 70px; }
.pt-range { display: flex; gap: 4px; }
.pt-range input { min-width: 50px; }
.pt-invalid { outline: 2px solid #dc2626 !important; }

/* Search marks, groups, counter */
mark.pt-mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.pt-table tr.pt-group td { background: var(--pt-head-bg) !important; color: var(--pt-head-color); font-weight: 700; }
.pt-table .pt-counter { width: 1%; white-space: nowrap; text-align: center; opacity: .75; }
.pt-table tr.pt-empty td { text-align: center; padding: 1.5em; opacity: .7; }
.pt-colvis-hidden { display: none !important; }
.pt-loading .pt-scroll { opacity: .55; transition: opacity .2s; }

/* Collapse mode */
.pt-collapsed { display: none !important; }
.pt-toggle {
	display: inline-flex; align-items: center; justify-content: center; width: 1.25em; height: 1.25em; margin-inline-end: .5em;
	border-radius: 50%; background: var(--pt-accent); color: #fff; cursor: pointer; font-size: .9em; line-height: 1; vertical-align: -.15em; flex-shrink: 0;
}
.pt-toggle::before { content: "+"; font-weight: 700; }
tr.pt-open .pt-toggle { background: #dc2626; }
tr.pt-open .pt-toggle::before { content: "−"; }
.pt-table tr.pt-child > td { background: var(--pt-bg); padding: .4em .75em .75em; }
.pt-child-list { list-style: none; margin: 0; padding: 0; }
.pt-child-list li { display: flex; gap: .75em; padding: .35em 0; border-bottom: 1px dashed var(--pt-border); }
.pt-child-list li:last-child { border-bottom: 0; }
.pt-child-label { font-weight: 600; min-width: 35%; }

/* Stack mode (cards) */
.pt-is-stacked .pt-table, .pt-is-stacked .pt-table tbody, .pt-is-stacked .pt-table tr, .pt-is-stacked .pt-table td, .pt-is-stacked .pt-table tbody th { display: block; width: 100%; }
.pt-is-stacked .pt-table { border: 0; background: transparent; }
.pt-is-stacked .pt-table thead tr:not(.pt-filter-row) { display: none; }
.pt-is-stacked .pt-table thead tr.pt-filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-is-stacked .pt-table thead tr.pt-filter-row th { flex: 1 1 140px; border: 0; }
.pt-is-stacked .pt-table thead tr.pt-filter-row th:empty { display: none; }
.pt-is-stacked .pt-table thead { display: block; }
.pt-is-stacked .pt-table tbody tr { border: 1px solid var(--pt-border); border-radius: var(--pt-radius); margin-bottom: .8em; overflow: hidden; background: var(--pt-bg); }
.pt-is-stacked .pt-table tbody tr > * { display: flex; gap: 1em; justify-content: space-between; text-align: end; border-bottom: 1px solid var(--pt-border); }
.pt-is-stacked .pt-table tbody tr > *:last-child { border-bottom: 0; }
.pt-is-stacked .pt-table tbody tr > *[data-label]::before { content: attr(data-label); font-weight: 600; text-align: start; flex: 0 0 40%; }
.pt-is-stacked .pt-table tbody tr > *:empty { display: none; }
.pt-is-stacked .pt-table tr.pt-group { border: 0; background: none; }
.pt-is-stacked .pt-table tr.pt-group > td { justify-content: flex-start; border-radius: var(--pt-radius); }
.pt-is-stacked .pt-table tfoot { display: block; }
.pt-is-stacked .pt-table tfoot tr { display: flex; flex-wrap: wrap; }
.pt-is-stacked .pt-table tfoot th { flex: 1; }

/* Flip mode */
.pt-is-flipped .pt-scroll { overflow-x: auto; }
.pt-is-flipped .pt-table { display: flex; width: auto; max-width: none; }
.pt-is-flipped .pt-table thead, .pt-is-flipped .pt-table tbody, .pt-is-flipped .pt-table tfoot { display: flex; flex-shrink: 0; }
.pt-is-flipped .pt-table tbody { display: flex; }
.pt-is-flipped .pt-table tr { display: flex; flex-direction: column; min-width: 8em; flex-shrink: 0; }
.pt-is-flipped .pt-table th, .pt-is-flipped .pt-table td { display: block; border-bottom: 1px solid var(--pt-border); border-inline-end: 1px solid var(--pt-border); }
.pt-is-flipped .pt-table thead tr.pt-filter-row { display: none; }
.pt-is-flipped .pt-table thead th { position: sticky; inset-inline-start: 0; z-index: 2; }

/* Fixed columns / header */
.pt-table .pt-fixed-left, .pt-table .pt-fixed-right { position: sticky; z-index: 2; background-color: var(--pt-head-bg); }
.pt-table tbody .pt-fixed-left, .pt-table tbody .pt-fixed-right { background-color: #fff; }
.pt-theme-dark tbody .pt-fixed-left, .pt-theme-dark tbody .pt-fixed-right { background-color: #0f172a; }
.pt-table .pt-fixed-edge { box-shadow: 4px 0 6px -4px rgba(0,0,0,.25); }
.pt-table .pt-fixed-edge-r { box-shadow: -4px 0 6px -4px rgba(0,0,0,.25); }
.pt-table thead .pt-fixed-left, .pt-table thead .pt-fixed-right { z-index: 4; }
.pt-fixed-head { position: fixed; z-index: 999; overflow: hidden; display: none; pointer-events: auto; }
.pt-fixed-head .pt-table { margin: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: 0 4px 10px -6px rgba(0,0,0,.3); }
.pt-fixed-head .pt-table thead tr:first-child th:first-child, .pt-fixed-head .pt-table thead tr:first-child th:last-child { border-radius: 0; }

/* Toast */
.pt-toast {
	position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 99999;
	background: #0f172a; color: #fff; padding: .6em 1.1em; border-radius: 8px; font-size: 14px; transition: all .25s; pointer-events: none;
	box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw;
}
.pt-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* WooCommerce product table */
.pt-products .pt-product-image { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.pt-products td { vertical-align: middle; }
.pt-products .pt-qty { width: 4.5em; padding: .35em; border: 1px solid var(--pt-border); border-radius: 4px; font: inherit; }
.pt-products .pt-add-to-cart, .pt-bulk-add, .pt-products .pt-product-link {
	cursor: pointer; white-space: nowrap; background: var(--pt-accent); color: #fff; border: 1px solid var(--pt-accent);
	border-radius: 5px; padding: .45em .9em; font: inherit; font-size: .9em; line-height: 1.2; text-decoration: none; display: inline-block;
}
.pt-products .pt-add-to-cart.loading, .pt-bulk-add.loading { opacity: .6; cursor: wait; }
.pt-products .pt-add-to-cart.added { background: #16a34a; border-color: #16a34a; }
.pt-bulk-add[disabled] { opacity: .5; cursor: not-allowed; }
.pt-variation-wrap { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; }
.pt-variation { max-width: 220px; padding: .35em; border: 1px solid var(--pt-border); border-radius: 4px; font: inherit; font-size: .9em; }
.pt-view-cart { display: block; font-size: .85em; margin-top: .35em; }
.pt-bulk-bar { display: flex; gap: 1em; align-items: center; margin-bottom: .75em; }
.pt-stock-instock { color: #15803d; }
.pt-stock-outofstock { color: #b91c1c; }
.pt-stock-onbackorder { color: #b45309; }
.pt-out-of-stock { color: #b91c1c; font-size: .9em; }
.pt-products .star-rating { float: none; }

/* RTL (Urdu/Arabic) */
[dir=rtl] .pt-table th, [dir=rtl] .pt-table td { text-align: right; }
[dir=rtl] .pt-table .pt-fixed-edge { box-shadow: -4px 0 6px -4px rgba(0,0,0,.25); }

@media (max-width: 600px) {
	.pt-controls { flex-direction: column; align-items: stretch; }
	.pt-search, .pt-pages { margin-inline-start: 0; }
	.pt-search input { flex: 1; min-width: 0 !important; }
	.pt-pages { justify-content: center; }
	.pt-info { text-align: center; }
}

@media print {
	.pt-controls, .pt-alpha, .pt-filter-row, .pt-fixed-head, .pt-toggle, .pt-bulk-bar { display: none !important; }
	.pt-collapsed, .pt-colvis-hidden { display: table-cell !important; }
}
