/* ASB TEC Find Events plugin — layout-only CSS
 *
 * This file intentionally contains only minimal layout rules so the active
 * theme can provide all visual styling (colors, borders, spacing, etc).
 * It ensures the button and inputs align horizontally on larger viewports
 * (wider than 680px) and stack on small screens.
 */

/* Desktop / larger views: horizontal alignment */
@media (min-width: 681px) {
  .asb-find-events-search {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  /* Make the form a horizontal flex container so its children (input-group + button) sit inline */
  .asb-find-events-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .asb-find-events-input-group {
    display: flex;
    gap: 12px;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
  }

  /* Ensure the autocomplete host expands to use available space */
  .asb-place-autocomplete-wrapper {
    flex: 1 1 0;
    min-width: 0;
  }

  .asb-place-autocomplete-host {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Ensure the Place Autocomplete web-component fills the host */
  .asb-place-autocomplete-host gmp-place-autocomplete,
  .asb-place-autocomplete-host gmp-place-autocomplete * {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  /* Keep only positioning for the button — visual styles come from the theme. */
  .asb-find-events-button {
    flex: 0 0 auto;
    align-self: center;
    margin-left: 8px;
    white-space: nowrap;
  }
}

/* Mobile / small screens: stack vertically */
@media (max-width: 680px) {
  .asb-find-events-search {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .asb-find-events-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .asb-find-events-button {
    width: 100%;
  }
}

/* Ensure consistent box-sizing for layout calculations */
.asb-find-events-search,
.asb-find-events-form,
.asb-find-events-input-group,
.asb-find-events-input-control,
.asb-find-events-input,
.asb-find-events-button,
.asb-place-autocomplete-host {
  box-sizing: border-box;
}

/* ==========================================================================
   ASB TEC Search Bar ([asb_tec_search_bar])
   ========================================================================== */

.asb-search-bar {
	padding: 1rem 0;
	margin-bottom: 1.5rem;
}

.asb-search-bar__form {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 0.75rem;
}

.asb-search-bar__inputs {
	display: flex;
	flex: 1 1 auto;
	gap: 0.75rem;
	min-width: 0;
}

.asb-search-bar__field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1 1 0;
	min-width: 0;
}

.asb-search-bar__field--text {
	flex: 1 1 0;
}

.asb-search-bar__field--location {
	flex: 1 1 0;
}

.asb-search-bar__label {
	font-size: 0.875rem;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.asb-search-bar__input {
	width: 100%;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	border: 2px solid #ddd;
	border-radius: 0.375rem;
	background: #ffffff;
	min-height: 2.75rem;
}

.asb-search-bar__input:focus {
	outline: none;
	border-color: #299A44;
	box-shadow: 0 0 0 3px rgba(41, 154, 68, 0.2);
}

.asb-search-bar .asb-search-bar__button {
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	color: #ffffff;
	background: #2F8E42;
	border: none;
	border-radius: 0.5rem;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
	min-height: 2.75rem;
}

.asb-search-bar .asb-search-bar__button:hover,
.asb-search-bar .asb-search-bar__button:focus {
	background: #8CC63E;
}

/* ── 3-way pill toggle (List / Map / Table) ── */
.asb-view-toggle {
	margin-left: auto;
	font-family: 'Inter', system-ui, sans-serif;
	padding: 0.5em 0 !important;
}

.asb-view-toggle__btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	font-size: 1rem;
	font-weight: 500;
	color: #444;
	text-decoration: none !important;
	background: #ffffff;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.12s ease;
	line-height: 1;
}

.asb-view-toggle__btn i {
	font-size: 1rem;
	line-height: 1;
}

.asb-view-toggle__btn:hover {
	background: #f0f0f0;
	color: #444;
	text-decoration: none !important;
}

/* Active state persists on hover — it's a selection indicator, not just a hover effect */
.asb-view-toggle__btn--active,
.asb-view-toggle__btn--active:hover {
	background: #D8EAE1;
	font-weight: 600;
	color: #444;
}

/* Reduce TEC's default container padding so the grey panel + search bar
   sit closer to the page edges without being constrained by the theme grid. */
section.tribe-common-l-container.tribe-events-l-container {
	padding-top: 2em !important;
	padding-bottom: 2em !important;
	padding-left: 16px !important;
	padding-right: 16px !important;
}

@media (max-width: 767px) {
	section.tribe-common-l-container.tribe-events-l-container {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
}

/* Very small screens: icon-only toggle to save space */
@media (max-width: 400px) {
	.asb-view-toggle__btn span {
		display: none;
	}

	.asb-view-toggle__btn i {
		font-size: 16px;
	}

	.asb-view-toggle__btn {
		padding: 10px 0;
	}
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
	.asb-search-bar__form {
		flex-wrap: wrap;
		flex-direction: column;
		align-items: stretch;
	}

	.asb-search-bar__inputs {
		flex-direction: column;
		max-width: none;
	}

	.asb-search-bar__field {
		max-width: none;
	}

	.asb-search-bar__button {
		width: 100%;
	}

	.asb-view-toggle {
		margin-left: 0;
		width: 101%;
		padding: 2em;
	}

	.asb-view-toggle__btn {
		flex: 1;
		justify-content: center;
		padding: 8px 10px;
	}
}
