/* ic-atm-timetables — front-end styles. Accessible: visible focus, sufficient contrast. */

.ic-atm-tt {
	margin: 1rem 0;
	--ic-atm-red: #BF0001;
}

/* Filtered-out items must actually disappear: a class `display` would otherwise beat [hidden]. */
.ic-atm-tt [hidden] {
	display: none !important;
}

/* Filters */
.ic-atm-tt-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
	margin-bottom: 1rem;
}
.ic-atm-tt-field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1 1 220px;
}
.ic-atm-tt-field label {
	font-weight: 600;
}
.ic-atm-tt-filters input[type="search"],
.ic-atm-tt-filters select {
	width: 100%;
	padding: 0.5rem 0.6rem;
	border: 1px solid #999;
	border-radius: 4px;
	font-size: 1rem;
	line-height: 1.3;
}

/* Filters sit above the map so the Tom Select dropdown is not covered by the Leaflet panes. */
.ic-atm-tt-filters {
	position: relative;
	z-index: 3;
}
.ic-atm-tt .ts-dropdown {
	z-index: 1200;
}
/* Tom Select ships at 13px with a blue highlight; match the interface size and the list's red hover. */
.ic-atm-tt .ts-control,
.ic-atm-tt .ts-control input,
.ic-atm-tt .ts-dropdown {
	font-size: 1rem;
	line-height: 1.3;
}
.ic-atm-tt .ts-dropdown .active {
	background-color: rgba(191, 0, 1, 0.07);
	color: inherit;
}
/* Group headers ("Towns" / "Lines") should read as section titles, not selectable rows. */
.ic-atm-tt .ts-dropdown .optgroup-header {
	background: #f4f4f4;
	color: #6a6a6a;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border-bottom: 1px solid #e2e2e2;
	cursor: default;
}

/* Map */
.ic-atm-tt-map {
	position: relative;
	z-index: 1;
	height: 420px;
	width: 100%;
	margin-bottom: 1rem;
	border: 1px solid #ccc;
	border-radius: 4px;
}

/* Results line: prominent removable filter chip + a muted count. */
.ic-atm-tt-count {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin: 1.5rem 0;
	min-height: 2.2rem;
}
/* The active filter is the highlight: a pill with the term and a one-click clear. */
.ic-atm-tt-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	max-width: 100%;
	padding: 0.3rem 0.35rem 0.3rem 0.9rem;
	background: rgba(191, 0, 1, 0.07);
	border: 1px solid rgba(191, 0, 1, 0.25);
	border-radius: 999px;
	color: #1a1a1a;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.25;
	cursor: pointer;
}
.ic-atm-tt-chip-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* Clear affordance: a subtle grey circle that turns corporate red on interaction. */
.ic-atm-tt-chip-x {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	background: #fff;
	color: #767676;
	font-size: 1.05rem;
	font-weight: 400;
	line-height: 1;
}
.ic-atm-tt-chip:hover,
.ic-atm-tt-chip:focus-visible {
	background: rgba(191, 0, 1, 0.12);
}
.ic-atm-tt-chip:hover .ic-atm-tt-chip-x,
.ic-atm-tt-chip:focus-visible .ic-atm-tt-chip-x {
	background: var(--ic-atm-red, #BF0001);
	color: #fff;
}
/* Secondary information, visually quieter than the filter term. */
.ic-atm-tt-count-num {
	color: #555;
	font-size: 0.95rem;
}

/* List */
.ic-atm-tt-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.ic-atm-tt-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1rem;
	padding: 0.6rem 0.6rem;
	border-bottom: 1px solid #e5e5e5;
	border-radius: 4px;
	transition: background-color 0.12s ease;
}
.ic-atm-tt-line_has-pdf {
	cursor: pointer;
}
.ic-atm-tt-line_has-pdf:hover,
.ic-atm-tt-line_has-pdf:focus-within {
	background-color: rgba(191, 0, 1, 0.07);
}
.ic-atm-tt-code {
	font-weight: 700;
	min-width: 3.5rem;
}
.ic-atm-tt-name {
	flex: 1 1 auto;
}
.ic-atm-tt-type {
	font-size: 0.85rem;
	color: #555;
}
/* Action buttons: corporate red, white text, rounded square (matches the site: #BF0001, 4px). */
.ic-atm-tt-btn,
.ic-atm-tt-popup-btn {
	display: inline-block;
	margin-left: auto;
	padding: 0.35rem 0.9rem;
	background: var(--ic-atm-red, #BF0001);
	color: #fff !important; /* beat theme link colours */
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	white-space: nowrap;
}
.ic-atm-tt-btn:hover,
.ic-atm-tt-btn:focus,
.ic-atm-tt-popup-btn:hover,
.ic-atm-tt-popup-btn:focus {
	background: #9c0001;
	color: #fff !important;
	text-decoration: none;
}
.ic-atm-tt-popup-btn {
	margin: 0.5rem 0 0;
}

/* Per-row "view timetable": secondary outline button (matches the Clear button), inverting to
   solid red on hover/focus. This is an <a>; the theme sets !important background/padding on links,
   so we must too. */
.ic-atm-tt-open {
	margin-left: auto;
	padding: 0.45rem 1.1rem !important;
	background: #fff !important;
	color: var(--ic-atm-red, #BF0001) !important;
	font-weight: 600;
	line-height: 1.3;
	border: 1px solid var(--ic-atm-red, #BF0001);
	border-radius: 4px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}
/* Fills red only on direct hover/focus of the button itself (not the row rollover). */
.ic-atm-tt-open:hover,
.ic-atm-tt-open:focus {
	background: var(--ic-atm-red, #BF0001) !important;
	color: #fff !important;
	text-decoration: none;
}

/* Clear-filters button: secondary variant of the corporate button (red outline). */
.ic-atm-tt-reset {
	align-self: flex-end;
	padding: 0.5rem 1rem;
	background: #fff;
	color: var(--ic-atm-red, #BF0001) !important;
	font-weight: 600;
	line-height: 1.3;
	border: 1px solid var(--ic-atm-red, #BF0001);
	border-radius: 4px;
	cursor: pointer;
}
.ic-atm-tt-reset:hover,
.ic-atm-tt-reset:focus {
	background: var(--ic-atm-red, #BF0001);
	color: #fff !important;
}

/* Bus-stop markers (divIcon): drop Leaflet's default white box. */
.ic-atm-tt-marker,
.leaflet-marker-icon.ic-atm-tt-marker {
	background: transparent;
	border: 0;
}

/* Map popup */
.ic-atm-tt-popup strong {
	font-size: 1.05em;
}
.ic-atm-tt-popup-desc {
	display: block;
	margin: 0.15rem 0 0.4rem;
	color: #555;
	font-size: 0.9rem;
	line-height: 1.35;
}

/* Service-type groups: two columns on desktop — daytime on the left; nighttime then on-demand on the right. */
.ic-atm-tt-groups {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2.5rem;
	align-items: start; /* both columns aligned at the top */
}
.ic-atm-tt-col {
	min-width: 0;
}
@media (max-width: 782px) {
	.ic-atm-tt-groups {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}
.ic-atm-tt-group {
	margin-bottom: 1.5rem;
}
.ic-atm-tt-group:last-child {
	margin-bottom: 0;
}
.ic-atm-tt-group-title {
	margin: 0 0 0.4rem;
	padding-bottom: 0.3rem;
	border-bottom: 2px solid var(--ic-atm-red);
}

/* Cluster bubbles: single ATM corporate colour; JS sets the size by count. */
.ic-atm-tt-cluster {
	background: var(--ic-atm-red, #BF0001);
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 4px rgba(191, 0, 1, 0.30);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
}
.ic-atm-tt-cluster span {
	line-height: 1;
	font-size: 0.85rem;
}

/* Visible focus everywhere (never remove the outline). */
.ic-atm-tt :focus-visible,
.ic-atm-tt-popup-btn:focus-visible {
	outline: 2px solid var(--ic-atm-red);
	outline-offset: 2px;
}

/* Screen-reader-only helper (mirrors WP core). */
.ic-atm-tt .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

@media (max-width: 600px) {
	.ic-atm-tt-map {
		height: 300px;
	}
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
	.ic-atm-tt * {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
