/* [tm_afisha_events] — календарь событий Труймясто. */

.tm-afisha-events {
	margin: 1.5rem 0;
	font-family: var(--wp--preset--font-family--sans, system-ui, -apple-system, sans-serif);
	--wp--style--block-gap: 0;
}

.tm-afisha-events :where(h1, h2, h3, h4, h5, h6, p) {
	margin: 0;
	padding: 0;
}

.tm-afisha-events a {
	text-decoration: none;
}

.tm-afisha-events__toolbar {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
	background: #f8f8f8;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
}

.tm-afisha-events__views {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.tm-afisha-events__view {
	appearance: none;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 999px;
	padding: 0.35rem 0.85rem;
	font-size: 0.92em;
	cursor: pointer;
	line-height: 1.3;
}

.tm-afisha-events__view.is-active {
	background: #1a1a1a;
	border-color: #1a1a1a;
	color: #fff;
}

.tm-afisha-events__filters {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.tm-afisha-events__filter-group--search {
	width: 100%;
}

.tm-afisha-events__filter--search {
	flex: 1 1 100%;
	min-width: 0;
	max-width: none;
}

.tm-afisha-events__query {
	font: inherit;
	padding: 0.45rem 0.65rem;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	min-height: 2.1rem;
	width: 100%;
	box-sizing: border-box;
}

.tm-afisha-events__query::-webkit-search-cancel-button {
	cursor: pointer;
}

.tm-afisha-events__filter-group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	align-items: flex-end;
}

.tm-afisha-events__filter-group--main .tm-afisha-events__filter {
	flex: 1 1 9.5rem;
	min-width: 9.5rem;
	max-width: 14rem;
}

.tm-afisha-events__filter-group--secondary {
	align-items: center;
}

.tm-afisha-events__filter-group--dates {
	display: inline-flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 0.35rem 0.5rem;
	padding: 0.35rem 0.55rem;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
}

.tm-afisha-events__filter-group-label {
	font-size: 0.88em;
	color: #666;
	padding-bottom: 0.45rem;
	white-space: nowrap;
}

.tm-afisha-events__filter--date {
	flex-direction: row;
	align-items: center;
	gap: 0.35rem;
}

.tm-afisha-events__filter--date .tm-afisha-events__filter-label {
	padding-bottom: 0;
	white-space: nowrap;
}

.tm-afisha-events__filter {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.88em;
}

.tm-afisha-events__filter-label {
	color: #666;
}

.tm-afisha-events__city,
.tm-afisha-events__venue,
.tm-afisha-events__category,
.tm-afisha-events__date-from,
.tm-afisha-events__date-to {
	font: inherit;
	padding: 0.35rem 0.5rem;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	min-height: 2.1rem;
	width: 100%;
	box-sizing: border-box;
}

.tm-afisha-events__filter-group--dates .tm-afisha-events__date-from,
.tm-afisha-events__filter-group--dates .tm-afisha-events__date-to {
	border: none;
	padding: 0.2rem 0;
	min-height: 1.75rem;
	width: auto;
	background: transparent;
}

.tm-afisha-events__reset {
	appearance: none;
	border: none;
	background: transparent;
	color: #2b5ea8;
	font-size: 0.88em;
	cursor: pointer;
	text-decoration: underline;
	padding: 0.35rem 0;
	white-space: nowrap;
}

.tm-afisha-events__count {
	margin: 0;
	font-size: 0.88em;
	color: #555;
}

.tm-afisha-events__list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.tm-afisha-events__pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	margin: 0.75rem 0 0;
	padding: 0.65rem 0.75rem;
	background: #f8f8f8;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
}

.tm-afisha-events__page-size {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.88em;
	min-width: 5.5rem;
}

.tm-afisha-events__per-page {
	font: inherit;
	padding: 0.35rem 0.5rem;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	min-height: 2.1rem;
}

.tm-afisha-events__page-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin-left: auto;
}

.tm-afisha-events__page-prev,
.tm-afisha-events__page-next {
	appearance: none;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 6px;
	padding: 0.4rem 0.85rem;
	font-size: 0.88em;
	cursor: pointer;
	line-height: 1.3;
}

.tm-afisha-events__page-prev:hover:not(:disabled),
.tm-afisha-events__page-next:hover:not(:disabled) {
	border-color: #999;
}

.tm-afisha-events__page-prev:disabled,
.tm-afisha-events__page-next:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.tm-afisha-events__page-info {
	font-size: 0.88em;
	color: #555;
	white-space: nowrap;
}

.tm-afisha-events__card {
	position: relative;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	transition: box-shadow 0.15s ease;
}

.tm-afisha-events__card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* Общая сетка: миниатюра слева, контент справа */
.tm-afisha-events__card-inner {
	display: grid !important;
	grid-template-columns: 64px minmax(0, 1fr);
	column-gap: 0.75rem;
	align-items: start;
	padding: 0.65rem 0.75rem;
	width: 100%;
	box-sizing: border-box;
}

.tm-afisha-events__card:not(.tm-afisha-events__card--grouped) {
	cursor: pointer;
}

.tm-afisha-events__card-hit {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}

.tm-afisha-events__map-link,
.tm-afisha-events__title-link,
.tm-afisha-events__links a {
	position: relative;
	z-index: 2;
}

.tm-afisha-events__card-media {
	grid-column: 1;
	grid-row: 1 / -1;
	width: 64px;
	flex: none;
}

.tm-afisha-events__thumb,
.tm-afisha-events__thumb--empty {
	display: block;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 6px;
	background: #eee;
}

.tm-afisha-events__thumb--empty {
	background: linear-gradient(135deg, #ececec, #f8f8f8);
}

.tm-afisha-events__card-body {
	grid-column: 2;
	grid-row: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

/* Строка 1: категория/источник | дата */
.tm-afisha-events__card-row--head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: baseline;
	column-gap: 0.5rem;
}

.tm-afisha-events__card-labels {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.15rem 0.45rem;
	min-width: 0;
	line-height: 1.25;
}

.tm-afisha-events__cat,
.tm-afisha-events__src {
	display: inline;
	font-size: 0.68em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #777;
	line-height: 1.25;
}

.tm-afisha-events__src {
	color: #999;
	text-transform: none;
	letter-spacing: 0;
}

.tm-afisha-events__src::before {
	content: "·";
	margin-right: 0.45rem;
	color: #ccc;
}

.tm-afisha-events__meta {
	font-size: 0.78em;
	color: #666;
	line-height: 1.25;
	white-space: nowrap;
	text-align: right;
}

/* Строка 2: заголовок | цена */
.tm-afisha-events__card-row--title {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: start;
	column-gap: 0.5rem;
}

.tm-afisha-events__title {
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: normal;
	color: #1a1a1a;
	min-width: 0;
}

.tm-afisha-events__title-link {
	color: inherit;
	text-decoration: none;
}

.tm-afisha-events__title-link:hover {
	text-decoration: underline;
}

.tm-afisha-events__card-price {
	text-align: right;
	white-space: nowrap;
	line-height: 1.35;
}

.tm-afisha-events__free {
	color: #1f7a3a;
	font-size: 0.875em;
	font-weight: 500;
}

.tm-afisha-events__price {
	font-size: 0.875em;
	color: #444;
}

/* Строка 3: локация — иконка | адрес | город */
.tm-afisha-events__location {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: start;
	column-gap: 0.35rem;
	margin: 0;
	padding: 0;
	font-size: 0.8125rem;
	color: #555;
	line-height: 1.35;
}

.tm-afisha-events__location-icon {
	font-size: 0.9em;
	line-height: 1;
	opacity: 0.85;
}

.tm-afisha-events__location-primary {
	min-width: 0;
	white-space: normal;
	overflow-wrap: anywhere;
}

.tm-afisha-events__venue-name {
	font-weight: 600;
	color: #333;
}

.tm-afisha-events__loc-sep {
	color: #bbb;
	user-select: none;
}

.tm-afisha-events__location-city {
	font-weight: 500;
	color: #666;
	white-space: nowrap;
	text-align: right;
}

.tm-afisha-events__map-link {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px dotted #aaa;
}

.tm-afisha-events__map-link:hover {
	color: #2b5ea8;
	border-bottom-color: #2b5ea8;
}

.tm-afisha-events__address {
	font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 0.92em;
	color: #555;
	letter-spacing: -0.01em;
}

.tm-afisha-events__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.65rem;
	margin-top: 0.35rem;
}

.tm-afisha-events__links a {
	font-size: 0.82em;
	color: #2b5ea8;
	text-decoration: none;
}

.tm-afisha-events__links a:hover {
	text-decoration: underline;
}

.tm-afisha-events__links a::before {
	content: "→ ";
}

.tm-afisha-events__filter--check {
	flex-direction: row;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}

.tm-afisha-events__filter--check input {
	margin: 0;
	width: 1rem;
	height: 1rem;
}

.tm-afisha-events__loading,
.tm-afisha-events__empty {
	color: #666;
	font-size: 0.95em;
	padding: 1rem 0;
}

.tm-afisha-events__source {
	margin-top: 1rem;
	font-size: 0.82em;
	color: #888;
}

.tm-afisha-events--error {
	padding: 1rem;
	background: #fff3f3;
	border: 1px solid #f0c0c0;
	border-radius: 8px;
	color: #a33;
}

@media (max-width: 520px) {
	.tm-afisha-events__filter-group--main .tm-afisha-events__filter {
		flex: 1 1 100%;
		max-width: none;
	}

	.tm-afisha-events__filter-group--dates {
		flex-wrap: wrap;
		width: 100%;
	}

	.tm-afisha-events__card-inner {
		grid-template-columns: 56px minmax(0, 1fr);
		column-gap: 0.6rem;
		padding: 0.55rem 0.65rem;
	}

	.tm-afisha-events__card-media {
		width: 56px;
	}

	.tm-afisha-events__thumb,
	.tm-afisha-events__thumb--empty {
		width: 56px;
		height: 56px;
	}

	.tm-afisha-events__card-row--head {
		grid-template-columns: 1fr;
		row-gap: 0.15rem;
	}

	.tm-afisha-events__meta {
		text-align: left;
		white-space: normal;
	}

	.tm-afisha-events__location {
		grid-template-columns: auto minmax(0, 1fr);
	}

	.tm-afisha-events__location-city {
		grid-column: 2;
		text-align: left;
		margin-top: 0.1rem;
	}

	.tm-afisha-events__pagination {
		flex-direction: column;
		align-items: stretch;
	}

	.tm-afisha-events__page-nav {
		margin-left: 0;
		justify-content: space-between;
	}

	.tm-afisha-events__page-info {
		order: -1;
		width: 100%;
		text-align: center;
		white-space: normal;
	}
}
