/* Previous Job Fairs — year picker, search and the table that becomes cards on mobile */

#previous-fairs-panel,
#previous-fairs-panel * {
  box-sizing: border-box;
}

/* ── Year picker ─────────────────────────────────────────────────────────── */

/*
    The native dropdown arrow sits hard against the right edge and can't be positioned, so it's
    replaced with a Lucide chevron drawn as a background image, inset to match the text padding.
*/
.jf-year-select {
  display: block;
  width: 100%;
  max-width: 260px;
  padding: 13px 44px 13px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23626366' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px 18px;
  color: var(--grey-dark);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.jf-year-select::-ms-expand {
  display: none;
}

.jf-year-select:focus {
  border-color: var(--green);
  outline: none;
}

/* ── Search + count row ──────────────────────────────────────────────────── */

.jf-fairs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 14px;
}

.jf-fairs-search {
  width: 100%;
  max-width: 320px;
  padding: 11px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

.jf-fairs-search:focus {
  border-color: var(--green);
}

.jf-fairs-status {
  margin: 0;
  color: var(--grey);
  font-size: 15px;
}

/* ── Loading / empty / error ─────────────────────────────────────────────── */

.jf-fairs-message {
  margin: 32px 0;
  color: var(--grey);
  text-align: center;
}

.jf-fairs-retry {
  margin-left: 8px;
  padding: 8px 18px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: #ffffff;
  color: var(--green);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Table → cards ───────────────────────────────────────────────────────── */

#previousEventsTable,
#previousEvents {
  width: 100%;
}

/* The desktop table has column headings, so the icons are only needed on the mobile cards */
.jf-cell-icon {
  display: none;
}

@media (max-width: 767px) {
  .jf-year-select {
    max-width: none;
  }

  /* Search first, then the count, so the number sits directly above the list it describes */
  .jf-fairs-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    margin: 14px 0 16px;
  }

  .jf-fairs-search {
    order: 1;
    max-width: none;
  }

  .jf-fairs-status {
    order: 2;
  }

  /* Bootstrap draws a border and margin round .table-responsive below 768px, which boxes in the cards */
  #previousEventsTable {
    margin-bottom: 0;
    border: 0;
    overflow: visible;
  }

  #previousEvents,
  #previousEvents tbody,
  #previousEvents tr,
  #previousEvents td {
    display: block;
    width: 100%;
  }

  #previousEvents thead {
    display: none;
  }

  #previousEvents {
    margin-bottom: 0;
    border: 0;
  }

  #previousEvents tr {
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
  }

  #previousEvents tr:last-child {
    margin-bottom: 0;
  }

  #previousEvents td {
    padding: 0;
    border: 0;
    line-height: 1.45;
  }

  #previousEvents td[data-label="Location"] {
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 700;
  }

  #previousEvents td[data-label="Date"],
  #previousEvents td[data-label="Venue"],
  #previousEvents td[data-label="Time"] {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--grey);
    font-size: 14px;
  }

  /* Spacing between the detail lines, without adding any after the last one */
  #previousEvents td[data-label="Venue"],
  #previousEvents td[data-label="Time"] {
    margin-top: 7px;
  }

  .jf-cell-icon {
    display: inline-flex;
    align-items: center;
  }
}
