/*
 * EntryVault public styles.
 *
 * NOTE: every selector here is `evt-` prefixed to match what
 * public/templates/submissions-table.php actually emits. An earlier version of this
 * file was written against `.entryvault-submissions-table` with `ev-` prefixed
 * children — names the template never used — so not one rule matched and the public
 * table shipped completely unstyled, inheriting whatever the active theme did to a
 * bare <table>. Rename here and in the template together or this breaks again.
 */

.evt-wrap {
	margin: 1.5em 0;
	font-size: 15px;
	line-height: 1.5;
	color: #1d2327;
}

/* ---------------------------------------------------------------- search */

.evt-search {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.evt-search-label {
	flex: 1 1 auto;
	max-width: 320px;
	margin: 0;
}

.evt-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 7px 12px;
	font-size: 14px;
	line-height: 1.4;
	color: #1d2327;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
}

.evt-search-input:focus {
	border-color: #2271b1;
	outline: 2px solid transparent;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

.evt-search-submit {
	padding: 7px 14px;
	font-size: 14px;
	font-weight: 500;
	color: #fff;
	background: #2271b1;
	border: 1px solid #2271b1;
	border-radius: 6px;
	cursor: pointer;
}

.evt-search-submit:hover,
.evt-search-submit:focus {
	background: #135e96;
	border-color: #135e96;
}

/* ----------------------------------------------------------------- table */

.evt-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	background: #fff;
	border: 1px solid #e0e0e3;
	border-radius: 8px;
	overflow: hidden;
	font-size: 14px;
}

.evt-th {
	text-align: start;
	padding: 11px 14px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #50575e;
	background: #f6f7f7;
	border-bottom: 1px solid #e0e0e3;
	white-space: nowrap;
}

.evt-sort-link {
	color: inherit;
	text-decoration: none;
}

.evt-sort-link:hover {
	color: #2271b1;
}

.evt-th.is-active .evt-sort-link {
	color: #2271b1;
}

.evt-td {
	padding: 11px 14px;
	vertical-align: middle;
	border-bottom: 1px solid #f0f0f1;
	word-break: break-word;
}

.evt-row:last-child .evt-td {
	border-bottom: 0;
}

.evt-row:nth-child(even) .evt-td {
	background: #fbfbfc;
}

.evt-row:hover .evt-td {
	background: #f2f7fc;
}

.evt-td-email {
	white-space: nowrap;
}

.evt-empty {
	padding: 2em 1em;
	text-align: center;
	color: #646970;
}

/* ------------------------------------------------------------ stage pill */

/*
 * The background colour is set inline per stage (from the stages table) and the
 * readable foreground is computed alongside it in PHP, so a pale stage colour gets
 * dark text instead of unreadable white. Everything that is NOT colour lives here.
 */
.evt-stage-pill {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.01em;
	white-space: nowrap;
	background: #2271b1;
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* ------------------------------------------------------------ pagination */

.evt-pagination {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 12px;
	font-size: 13px;
}

.evt-page-prev,
.evt-page-next {
	padding: 5px 12px;
	color: #2271b1;
	text-decoration: none;
	background: #f6f7f7;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
}

.evt-page-prev:hover,
.evt-page-next:hover {
	background: #fff;
	border-color: #2271b1;
}

.evt-page-status {
	color: #50575e;
}

@media (max-width: 600px) {
	.evt-wrap {
		font-size: 14px;
	}

	.evt-table {
		font-size: 13px;
	}

	.evt-th,
	.evt-td {
		padding: 9px 10px;
	}
}

/* --------------------------------------------------------- visitor filters */

.evt-search { flex-wrap: wrap; }
.evt-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px 12px;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
	flex: 1 1 100%;
	order: -1;
}
.evt-filter { display: flex; flex-direction: column; gap: 2px; margin: 0; min-width: 0; }
.evt-filter-label { font-size: 12px; font-weight: 600; color: #50575e; }
.evt-filter select,
.evt-filter input {
	box-sizing: border-box;
	max-width: 100%;
	padding: 6px 10px;
	font-size: 14px;
	color: #1d2327;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
}
.evt-filter select:focus,
.evt-filter input:focus { border-color: #2271b1; outline: 2px solid transparent; box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25); }
.evt-filter-clear { font-size: 14px; color: #2271b1; }
.evt-result-count { margin: 0 0 8px; font-size: 13px; color: #50575e; }
@media (max-width: 600px) {
	.evt-filter { flex: 1 1 100%; }
	.evt-filter select, .evt-filter input { width: 100%; }
}

/* ------------------------------------------------------------ phone layout */

/*
 * On a phone a table of five or six columns was wider than the screen, and the
 * whole page zoomed out to fit it. Each entry becomes a card with the column name
 * next to each value, and the column headers stay as a row of sort buttons.
 */
@media (max-width: 600px) {
	.evt-table,
	.evt-table > tbody {
		display: block;
		width: 100%;
	}

	.evt-table {
		border: 0;
		border-radius: 0;
		background: none;
		overflow: visible;
	}

	.evt-table > thead {
		display: block;
	}

	.evt-table > thead > tr {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
		margin: 0 0 10px;
	}

	.evt-table .evt-th {
		display: block;
		padding: 0;
		background: none;
		border: 0;
	}

	.evt-table .evt-th .evt-sort-link {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		min-height: 32px;
		box-sizing: border-box;
		padding: 5px 12px;
		border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
		border-radius: 999px;
	}

	.evt-table .evt-th.is-active .evt-sort-link {
		border-color: currentColor;
	}

	.evt-table .evt-row {
		display: block;
		margin: 0 0 10px;
		padding: 6px 0;
		background: #fff;
		border: 1px solid #e0e0e3;
		border-radius: 8px;
	}

	.evt-table .evt-row .evt-td {
		display: grid;
		grid-template-columns: minmax(0, 35%) minmax(0, 1fr);
		gap: 10px;
		align-items: baseline;
		padding: 5px 12px;
		border: 0;
		background: transparent;
		overflow-wrap: anywhere;
	}

	.evt-table .evt-row .evt-td::before {
		content: attr(data-label);
		font-size: 12px;
		font-weight: 600;
		color: #50575e;
	}

	.evt-table .evt-td-email {
		white-space: normal;
	}

	.evt-table .evt-stage-pill {
		justify-self: start;
	}

	.evt-table .evt-empty,
	.evt-table .evt-empty > td {
		display: block;
	}

	.evt-pagination {
		justify-content: center;
		flex-wrap: wrap;
	}

	.evt-page-prev,
	.evt-page-next {
		padding: 8px 14px;
	}
}
