/*
 * Hyo 表: table built from an Excel or CSV file.
 * Default colours follow the Tailwind v3 slate palette and can be overridden from the widget.
 * Typography is never imposed: font, size, weight, line height, letter spacing and case come from the theme
 * until they are set in the widget. Only the editor notice has its own size.
 */

.hyo {
	--hyo-bg: #ffffff;
	--hyo-text: #334155;
	--hyo-head-bg: #f1f5f9;
	--hyo-head-color: #0f172a;
	--hyo-border: #e2e8f0;
	--hyo-stripe: #f8fafc;
	--hyo-hover: #f1f5f9;
	--hyo-muted: #64748b;
	--hyo-accent: #0f172a;
	--hyo-accent-contrast: #ffffff;
	--hyo-focus: #3b82f6;
	--hyo-input-bg: #ffffff;
	--hyo-input-color: #0f172a;
	--hyo-input-border: #cbd5e1;

	position: relative;
	width: 100%;
	color: var(--hyo-text);
}

.hyo *,
.hyo *::before,
.hyo *::after {
	box-sizing: border-box;
}

.hyo .hyo-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Toolbar and search */

.hyo__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.hyo__toolbar[hidden] {
	display: none;
}

.hyo__search {
	flex: 1 1 14rem;
	max-width: 22rem;
}

/*
 * The selector is long on purpose: Elementor Site Settings > Form Fields and many themes style
 * input:not([type="button"]):not([type="submit"]), which would otherwise win over these rules.
 */
.hyo .hyo__toolbar .hyo__search input.hyo__input[type="search"] {
	display: block;
	width: 100%;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0.5em 0.875em;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	color: var(--hyo-input-color);
	background: var(--hyo-input-bg);
	border: 1px solid var(--hyo-input-border);
	border-radius: 6px;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.hyo .hyo__toolbar .hyo__search input.hyo__input[type="search"]:focus {
	color: var(--hyo-input-color);
	background: var(--hyo-input-bg);
	outline: 2px solid var(--hyo-focus);
	outline-offset: 1px;
	border-color: var(--hyo-focus);
	box-shadow: none;
}

/* Scroll container */

.hyo__scroll {
	overflow: auto;
	background: var(--hyo-bg);
	border: 1px solid var(--hyo-border);
	border-radius: 8px;
	-webkit-overflow-scrolling: touch;
}

.hyo__scroll:focus-visible {
	outline: 2px solid var(--hyo-focus);
	outline-offset: 2px;
}

/* Table */

.hyo .hyo__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	background: transparent;
}

.hyo .hyo__table th,
.hyo .hyo__table td {
	border: 0;
	vertical-align: top;
	text-align: left;
}

.hyo .hyo__caption {
	padding: 0.75rem 1rem;
	text-align: left;
	color: var(--hyo-head-color);
}

.hyo .hyo__table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: var(--hyo-head-pad, 0.75rem 1rem);
	color: var(--hyo-head-color);
	background: var(--hyo-head-bg);
	border-bottom: 1px solid var(--hyo-border);
}

.hyo .hyo__table tbody tr {
	--hyo-row-bg: var(--hyo-bg);
}

.hyo--striped:not(.hyo--ready) .hyo__table tbody tr:nth-child(even),
.hyo--striped .hyo__table tbody tr.is-alt {
	--hyo-row-bg: var(--hyo-stripe);
}

.hyo .hyo__table tbody tr:hover {
	--hyo-row-bg: var(--hyo-hover);
}

.hyo .hyo__table tbody tr[hidden] {
	display: none;
}

.hyo .hyo__table tbody td {
	padding: var(--hyo-cell-pad, 0.75rem 1rem);
	color: var(--hyo-text);
	background: var(--hyo-row-bg);
	border-bottom: 1px solid var(--hyo-border);
}

.hyo .hyo__table tbody tr:last-child td {
	border-bottom: 0;
}

.hyo--borders-none .hyo__table tbody td {
	border-bottom: 0;
}

.hyo--borders-grid .hyo__table th:not(:last-child),
.hyo--borders-grid .hyo__table td:not(:last-child) {
	border-right: 1px solid var(--hyo-border);
}

.hyo--nowrap .hyo__table th,
.hyo--nowrap .hyo__table td {
	white-space: nowrap;
}

.hyo .hyo__table .hyo-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.hyo .hyo__table td a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Sticky first column */

.hyo--sticky-col .hyo__table tbody td:first-child,
.hyo--sticky-col .hyo__table thead th:first-child {
	position: sticky;
	left: 0;
}

.hyo--sticky-col .hyo__table tbody td:first-child {
	z-index: 1;
}

.hyo--sticky-col .hyo__table thead th:first-child {
	z-index: 3;
}

/* Sort buttons */

.hyo .hyo__sort {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	font: inherit;
	letter-spacing: inherit;
	text-align: inherit;
	text-transform: inherit;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 2px;
	box-shadow: none;
	cursor: pointer;
}

.hyo .hyo__sort:hover,
.hyo .hyo__sort:focus {
	color: inherit;
	background: none;
	box-shadow: none;
}

.hyo .hyo__sort:focus-visible {
	outline: 2px solid var(--hyo-focus);
	outline-offset: 3px;
}

.hyo__sort-icon {
	position: relative;
	flex: none;
	width: 0.625rem;
	height: 0.875rem;
	opacity: 0.35;
}

.hyo__sort-icon::before,
.hyo__sort-icon::after {
	content: "";
	position: absolute;
	left: 0;
	border-right: 0.3125rem solid transparent;
	border-left: 0.3125rem solid transparent;
}

.hyo__sort-icon::before {
	top: 0;
	border-bottom: 0.3125rem solid currentColor;
}

.hyo__sort-icon::after {
	bottom: 0;
	border-top: 0.3125rem solid currentColor;
}

.hyo th[aria-sort="ascending"] .hyo__sort-icon,
.hyo th[aria-sort="descending"] .hyo__sort-icon {
	opacity: 1;
}

.hyo th[aria-sort="ascending"] .hyo__sort-icon::after,
.hyo th[aria-sort="descending"] .hyo__sort-icon::before {
	visibility: hidden;
}

/* Status and pagination */

.hyo__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 0.75rem;
	color: var(--hyo-muted);
}

.hyo__status,
.hyo__gap {
	margin: 0;
}

.hyo__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.hyo__pager[hidden] {
	display: none;
}

.hyo .hyo__page {
	margin: 0;
	padding: 0.5em 0.75em;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	color: var(--hyo-head-color);
	background: var(--hyo-bg);
	border: 1px solid var(--hyo-border);
	border-radius: 6px;
	box-shadow: none;
	cursor: pointer;
}

.hyo .hyo__page:hover,
.hyo .hyo__page:focus {
	color: var(--hyo-head-color);
	background: var(--hyo-hover);
	border-color: var(--hyo-border);
}

.hyo .hyo__page:focus-visible {
	outline: 2px solid var(--hyo-focus);
	outline-offset: 2px;
}

/* Stronger than the Border control of the widget, so the active page keeps its own border color. */
.hyo.hyo .hyo__foot .hyo__pager .hyo__page[aria-current="page"],
.hyo.hyo .hyo__foot .hyo__pager .hyo__page[aria-current="page"]:hover {
	color: var(--hyo-accent-contrast);
	background: var(--hyo-accent);
	border-color: var(--hyo-accent);
}

.hyo .hyo__page[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

.hyo__gap {
	display: inline-flex;
	align-items: center;
	min-width: 1.5rem;
	justify-content: center;
}

/* Note and notices */

.hyo__note {
	margin-top: 0.75rem;
	color: var(--hyo-muted);
}

.hyo__note > :first-child {
	margin-top: 0;
}

.hyo__note > :last-child {
	margin-bottom: 0;
}

.hyo-notice {
	margin: 0.75rem 0 0;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #92400e;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-left: 4px solid #f59e0b;
	border-radius: 6px;
}

.hyo-notice:first-child {
	margin-top: 0;
}
