.eamf-wrap {
  --eamf-border: #dcdfe5;
  --eamf-muted: #667085;
  --eamf-bg: #ffffff;
  --eamf-soft: #f7f8fb;
  --eamf-dark: #111827;
  --eamf-radius: 14px;
  position: relative;
  width: 100%;
}

.eamf-form {
  background: var(--eamf-bg);
  border: 1px solid var(--eamf-border);
  border-radius: var(--eamf-radius);
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
}

.eamf-top-row,
.eamf-filter-grid,
.eamf-date-box {
  display: grid;
  gap: 14px;
}

.eamf-top-row {
  grid-template-columns: 2fr 1fr 1fr;
  align-items: end;
  margin-bottom: 16px;
}

.eamf-filter-grid {
  grid-template-columns: repeat(var(--eamf-filter-columns, 2), minmax(0, 1fr));
  align-items: start;
}

.eamf-filter-columns-1 { --eamf-filter-columns: 1; }
.eamf-filter-columns-2 { --eamf-filter-columns: 2; }
.eamf-filter-columns-3 { --eamf-filter-columns: 3; }
.eamf-filter-columns-4 { --eamf-filter-columns: 4; }

.eamf-field span,
.eamf-taxonomy legend {
  display: block;
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 7px;
  font-weight: 700;
  color: var(--eamf-dark);
}

.eamf-field input,
.eamf-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--eamf-border);
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff;
  color: var(--eamf-dark);
}

.eamf-field select {
  cursor: pointer;
}

.eamf-taxonomy:not(.eamf-taxonomy-select) {
  border: 1px solid var(--eamf-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--eamf-soft);
  max-height: 250px;
  overflow: auto;
}

.eamf-taxonomy-select {
  border: 0;
  padding: 0;
  background: transparent;
  max-height: none;
  overflow: visible;
}

.eamf-group-select select,
.eamf-taxonomy-select select {
  min-height: 46px;
  background-color: #ffffff;
}

.eamf-term-list {
  display: grid;
  gap: 8px;
}

.eamf-term {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--eamf-dark);
  font-size: 14px;
}

.eamf-term input {
  flex: 0 0 auto;
}

.eamf-term small {
  margin-left: auto;
  color: var(--eamf-muted);
  background: #fff;
  border: 1px solid var(--eamf-border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}

.eamf-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.eamf-button,
.eamf-reset,
.eamf-pagination button {
  border: 1px solid var(--eamf-dark);
  border-radius: 10px;
  background: var(--eamf-dark);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: opacity .2s ease, transform .2s ease;
}

.eamf-reset,
.eamf-pagination button {
  background: #fff;
  color: var(--eamf-dark);
}

.eamf-button:hover,
.eamf-reset:hover,
.eamf-pagination button:hover {
  opacity: .86;
  transform: translateY(-1px);
}

.eamf-pagination button.is-active,
.eamf-pagination button:disabled {
  background: var(--eamf-dark);
  color: #fff;
  cursor: default;
  opacity: 1;
}

.eamf-status {
  min-height: 22px;
  color: var(--eamf-muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.eamf-wrap.is-loading .eamf-results-wrap {
  opacity: .45;
  pointer-events: none;
}

.eamf-count {
  margin: 0 0 14px;
  color: var(--eamf-muted);
  font-weight: 700;
}

.eamf-results {
  display: grid;
  gap: 20px;
}

.eamf-columns-1 { grid-template-columns: 1fr; }
.eamf-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.eamf-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.eamf-columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.eamf-card {
  border: 1px solid var(--eamf-border);
  border-radius: var(--eamf-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05);
}

.eamf-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--eamf-soft);
}

.eamf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eamf-card-body {
  padding: 16px;
}

.eamf-meta {
  color: var(--eamf-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.eamf-title {
  margin: 0 0 9px;
  font-size: 20px;
  line-height: 1.25;
}

.eamf-title a,
.eamf-readmore {
  color: var(--eamf-dark);
  text-decoration: none;
}

.eamf-excerpt {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.eamf-readmore {
  display: inline-flex;
  font-weight: 800;
  border-bottom: 2px solid currentColor;
}

.eamf-no-results,
.eamf-no-groups {
  border: 1px dashed var(--eamf-border);
  border-radius: var(--eamf-radius);
  padding: 24px;
  text-align: center;
  color: var(--eamf-muted);
  background: var(--eamf-soft);
}

.eamf-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

.eamf-pagination button {
  min-width: 42px;
  padding: 8px 12px;
}

.eamf-results-empty {
  display: none;
  margin-top: 0;
}

.eamf-initial-message {
  display: none;
}

@media (max-width: 1024px) {
  .eamf-top-row,
  .eamf-columns-3,
  .eamf-columns-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .eamf-filter-grid.eamf-filter-columns-3,
  .eamf-filter-grid.eamf-filter-columns-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .eamf-top-row,
  .eamf-filter-grid,
  .eamf-date-box,
  .eamf-columns-2,
  .eamf-columns-3,
  .eamf-columns-4 {
    grid-template-columns: 1fr;
  }

  .eamf-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Compact result card spacing while preserving the selected Columns setting. */
.eamf-results {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.eamf-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--eamf-border);
  border-radius: 0;
  box-shadow: none;
  padding: 10px 0;
  background: transparent;
}

.eamf-thumb {
  flex: 0 0 74px;
  width: 74px;
  height: 74px;
  aspect-ratio: auto;
  border-radius: 9px;
  overflow: hidden;
  background: var(--eamf-soft);
}

.eamf-thumb img {
  width: 74px;
  height: 74px;
  object-fit: cover;
}

.eamf-card-body {
  padding: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.eamf-meta {
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 3px;
}

.eamf-title {
  margin: 0 0 3px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.eamf-title a {
  color: var(--eamf-dark);
  text-decoration: none;
}

.eamf-excerpt {
  font-size: 13px;
  line-height: 1.35;
  margin: 3px 0 5px;
}

.eamf-readmore {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  border-bottom-width: 1px;
}

.eamf-count {
  font-size: 15px;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .eamf-results {
    max-width: 100%;
  }

  .eamf-card {
    gap: 10px;
  }

  .eamf-thumb,
  .eamf-thumb img {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .eamf-title {
    font-size: 15px;
  }
}
