/**
 * Shared card + filter design system for [webinars_new_filter] and [events_filter].
 *
 * Every rule is scoped under .webinars-new-cards (card grid),
 * .webinars-new-search-form (the filter form, identical on both pages) or
 * .webinars-new-filter (webinar page wrapper) so other site CSS is unaffected.
 *
 * @package Mhp_Utilities
 * @since   1.1.0
 */

/* -------------------------------------------------------------------------
 * Design tokens
 * ---------------------------------------------------------------------- */
.webinars-new-cards,
.webinars-new-filter,
.webinars-new-search-form {
  /* Brand green as rendered on the current event button. */
  --webinars-new-green: #337d6b;
  --webinars-new-green-dark: #28624f;
  --webinars-new-navy: #002e42;
  --webinars-new-text: #1a1a1a;
  --webinars-new-muted: #555b60;
  --webinars-new-subtle: #8a8f94;
  --webinars-new-border: #dcdcdc;
  /* Filter field outline: same gray family as the cards, stronger so it reads clearly. */
  --webinars-new-field-border: #c4c4c4;
  --webinars-new-radius: 16px;
  --webinars-new-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* -------------------------------------------------------------------------
 * Grid (equal-height cards)
 *
 * grid-auto-rows: 1fr makes every row as tall as the tallest card in the
 * whole grid, so cards match within a row AND across rows (including cards
 * added by "Load More").
 * ---------------------------------------------------------------------- */
div.webinars-new-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  grid-auto-rows: 1fr;
  gap: 32px;
  align-items: stretch;
  justify-content: initial;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Events "Load More" appends a whole list inside the grid; merge it into the parent grid. */
div.webinars-new-cards div.webinars-new-cards {
  display: contents;
}

/* -------------------------------------------------------------------------
 * Card
 * ---------------------------------------------------------------------- */
.webinars-new-cards .webinars-new-card {
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--webinars-new-border);
  border-radius: var(--webinars-new-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  font-family: var(--webinars-new-font);
  color: var(--webinars-new-text);
}

.webinars-new-cards .webinars-new-card *,
.webinars-new-cards .webinars-new-card *::before,
.webinars-new-cards .webinars-new-card *::after {
  box-sizing: border-box;
}

/* Header image */
.webinars-new-cards .webinars-new-card__media {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 14 / 5;
  overflow: hidden;
  background-color: var(--webinars-new-green);
}

.webinars-new-cards .webinars-new-card__image {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
}

/* Industry badge(s) */
.webinars-new-cards .webinars-new-card__badges {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.webinars-new-cards .webinars-new-card__badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--webinars-new-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Body */
.webinars-new-cards .webinars-new-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 10px;
  padding: 16px 18px 20px;
}

.webinars-new-cards .webinars-new-card__title {
  margin: 0;
  padding: 0;
  font-family: var(--webinars-new-font);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--webinars-new-text);
}

/* Meta rows */
.webinars-new-cards .webinars-new-card__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--webinars-new-muted);
}

.webinars-new-cards .webinars-new-card__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}

.webinars-new-cards .webinars-new-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.webinars-new-cards .webinars-new-card__icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--webinars-new-subtle);
}

.webinars-new-cards .webinars-new-card__meta-label {
  color: var(--webinars-new-subtle);
}

.webinars-new-cards .webinars-new-card__meta-value {
  color: var(--webinars-new-muted);
  font-weight: 500;
}

/* Product pills */
/* Thin divider above the products. The list is only output when a card has
   products, so cards without products get no line. */
.webinars-new-cards .webinars-new-card__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--webinars-new-border);
  list-style: none;
}

.webinars-new-cards .webinars-new-card__pill {
  margin: 0;
  padding: 3px 12px;
  border: 1px solid var(--webinars-new-green);
  border-radius: 999px;
  background: #fff;
  color: var(--webinars-new-green);
  font-size: 13px;
  line-height: 1.4;
  list-style: none;
}

.webinars-new-cards .webinars-new-card__pill::before {
  content: none;
}

/* Description (webinars) */
.webinars-new-cards .webinars-new-card__description {
  margin: 4px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--webinars-new-muted);
}

/* CTA: pinned to the bottom (margin-top: auto) so buttons line up, with a
   guaranteed gap above it even on the fullest card. */
.webinars-new-cards .webinars-new-card__cta {
  margin: auto 0 0;
  padding: 24px 0 0;
}

.webinars-new-cards a.webinars-new-card__button {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background-color: var(--webinars-new-green);
  color: #fff;
  font-family: var(--webinars-new-font);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.webinars-new-cards a.webinars-new-card__button:hover,
.webinars-new-cards a.webinars-new-card__button:focus {
  background-color: var(--webinars-new-green-dark);
  color: #fff;
}

.webinars-new-cards a.webinars-new-card__button:focus-visible {
  outline: 2px solid var(--webinars-new-green);
  outline-offset: 3px;
}

/* Remove the old event-card arrow icon if a theme rule adds it */
.webinars-new-cards a.webinars-new-card__button::after {
  content: none;
}

/* -------------------------------------------------------------------------
 * Filter form — shared by Events (#events-filter-form) and Webinars
 * (#webinars-new-search-form). One set of rules so both look identical.
 * Field outline matches the card outline (--webinars-new-border).
 * ---------------------------------------------------------------------- */
/* Layout: a grid with three fixed arrangements instead of free wrapping.
   Desktop (>= 960px): one row  — Industry | Product | Date | Search
   Tablet  (554–959px): 2 x 2   — Industry | Product / Date | Search
   Mobile  (<= 553px): one column, everything full width. */
form.webinars-new-search-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px)) auto;
  justify-content: center;
  align-items: end;
  gap: 16px 24px;
  max-width: 1000px;
  margin: 0 auto 50px;
  padding: 0;
  font-family: var(--webinars-new-font);
}

.webinars-new-search-form .webinars-new-search-form__field {
  min-width: 0;
  margin: 0;
}

@media (max-width: 959px) {
  form.webinars-new-search-form {
    grid-template-columns: repeat(2, minmax(0, 280px));
  }

  /* Search button fills its cell so it lines up with the Date field beside it. */
  .webinars-new-search-form .webinars-new-search-form__submit {
    width: 100%;
  }
}

.webinars-new-search-form .webinars-new-search-form__label {
  display: block;
  margin: 0 0 10px;
  padding: 0 0 0 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--webinars-new-navy);
}

.webinars-new-search-form .webinars-new-search-form__select {
  position: relative;
}

.webinars-new-search-form .webinars-new-search-form__select::before {
  content: "\25bc";
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--webinars-new-navy);
  pointer-events: none;
}

/* Outline, radius, shadow and background are !important on purpose: theme /
   plugin styles on the live site (Divi + WP Rocket) were overriding them and
   removing the stroke. Scoped to these filter dropdowns only. */
form.webinars-new-search-form .webinars-new-search-form__select select {
  box-sizing: border-box;
  height: 50px !important;
  width: 100%; /* Column widths come from the form grid. */
  min-width: 0;
  max-width: none;
  margin: 0 !important;
  padding: 0 40px 0 20px;
  border: 2px solid var(--webinars-new-field-border) !important;
  border-radius: 30px !important;
  background-color: #fff !important;
  box-shadow: none !important;
  outline: none;
  color: var(--webinars-new-navy);
  font-family: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form.webinars-new-search-form .webinars-new-search-form__select select:hover {
  border-color: #a8a8a8 !important;
}

form.webinars-new-search-form .webinars-new-search-form__select select:focus {
  outline: none;
  border-color: var(--webinars-new-green) !important;
  box-shadow: 0 0 0 0.2rem rgba(51, 125, 107, 0.2) !important;
}

.webinars-new-search-form .webinars-new-search-form__submit,
.webinars-new-filter .webinars-new-load-more__button {
  border: 0;
  border-radius: 50px;
  background-color: var(--webinars-new-green);
  color: #fff;
  font-family: var(--webinars-new-font);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.webinars-new-search-form .webinars-new-search-form__submit {
  height: 50px;
  margin: 0;
  padding: 0 28px;
  font-size: 14px;
}

.webinars-new-search-form .webinars-new-search-form__submit:hover,
.webinars-new-search-form .webinars-new-search-form__submit:focus,
.webinars-new-filter .webinars-new-load-more__button:hover {
  background-color: var(--webinars-new-green-dark);
  color: #fff;
}

.webinars-new-search-form .webinars-new-search-form__submit:focus-visible {
  outline: 2px solid var(--webinars-new-green);
  outline-offset: 3px;
}

/* Events results: drop the old 100px gap so spacing below the filter
   matches the Webinars page. */
#event-results {
  margin-top: 0;
}

#event-results > p {
  margin-top: 0;
  text-align: center;
}

/* -------------------------------------------------------------------------
 * Webinars load more / empty state
 * ---------------------------------------------------------------------- */
.webinars-new-filter .webinars-new-load-more__button {
  display: block;
  margin: 50px auto 0;
  padding: 16px 24px;
  font-size: 16px;
}

.webinars-new-filter .webinars-new-load-more__button:disabled {
  opacity: 0.7;
  cursor: default;
}

.webinars-new-filter .webinars-new-load-more[hidden] {
  display: none;
}

.webinars-new-results__empty {
  text-align: center;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */
@media (max-width: 553px) {
  div.webinars-new-cards {
    gap: 20px;
    padding: 0;
  }

  .webinars-new-cards .webinars-new-card__title {
    font-size: 20px;
  }

  form.webinars-new-search-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 40px;
  }

  .webinars-new-search-form .webinars-new-search-form__field--submit {
    padding-top: 4px;
  }
}
