.election-calendar-section {
  width: 100%;
  margin-bottom: 5px;
  container-type: inline-size;
}

.election-calendar-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d9dee5;
  border-radius: 3px;
  background: #fff;
}

.election-calendar-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}

.election-calendar-table th,
.election-calendar-table td {
  padding: 10px 5px;
  border-bottom: 1px solid #ccc;
  text-align: left;
  vertical-align: middle;
  white-space: normal !important;
  box-sizing: border-box;
  transition: box-shadow .18s ease, color .18s ease;
}

.election-calendar-table th {
  background: #eef1f4;
  color: #29323d;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.election-calendar-table tbody tr {
  cursor: pointer;
}

.election-calendar-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Cały wiersz otrzymuje kolor zgodny z rodzajem wydarzenia. */
.election-calendar-table tbody tr.event-type-parliamentary > td {
  background-color: #e7f1ff;
}

.election-calendar-table tbody tr.event-type-presidential > td {
  background-color: #ffe8e8;
}

.election-calendar-table tbody tr.event-type-general > td {
  background-color: #f0e9ff;
}

.election-calendar-table tbody tr.event-type-referendum > td {
  background-color: #fff3c4;
}

/* Każdy typ i status zachowuje swój kolor; hover tylko go lekko przyciemnia. */
.election-calendar-table tbody tr:hover > td {
  box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, .055);
}

.election-date {
  min-width: 95px;
  font-weight: 700;
  white-space: nowrap !important;
  line-height: 1.6rem;
	padding-left:10px !important;
}

.election-country {
  width: 220px;
}

.election-country-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  white-space: normal;
}

.election-flag {
  display: block;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 2px;
  box-sizing: border-box;
  flex: 0 0 24px;
}

.election-type {
  font-weight: 600;
  white-space: nowrap;
}

.event-type-parliamentary .election-type {
  color: #174d87;
}

.event-type-presidential .election-type {
  color: #8b2525;
}

.event-type-general .election-type {
  color: #59338a;
}

.event-type-referendum .election-type {
  color: #745700;
}

.election-results-heading,
.election-results-cell {
  width: 125px;
  min-width: 125px;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Druga kopia statusu jest używana wyłącznie w bardzo wąskim kontenerze. */
.election-results-inline {
  display: none;
}

.election-results-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  text-decoration: none !important;
  text-transform: uppercase;
  letter-spacing: .03em;
  box-sizing: border-box;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.election-results-button.is-finished {
  border-color: #16833a;
  background-color: #199447;
  color: #fff !important;
}

.election-results-button.is-finished:hover,
.election-results-button.is-finished:focus {
  border-color: #106c31;
  background-color: #137d3a;
  color: #fff !important;
}

.election-results-button.is-ongoing {
  border-color: #c79a00;
  background-color: #f2c94c;
  color: #332700 !important;
}

.election-results-button.is-ongoing:hover,
.election-results-button.is-ongoing:focus {
  border-color: #a77f00;
  background-color: #dfb62e;
  color: #261d00 !important;
}

.election-results-button.is-counting {
  border-color: #b52c35;
  background-color: #d93b46;
  color: #fff !important;
}

.election-results-button.is-counting:hover,
.election-results-button.is-counting:focus {
  border-color: #92212a;
  background-color: #bd2d37;
  color: #fff !important;
}

.election-results-button:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .election-calendar-table th,
  .election-calendar-table td {
    padding: 10px 12px;
  }

  .election-country {
    width: 190px;
  }

  .election-results-heading,
  .election-results-cell {
    width: 110px;
    min-width: 110px;
  }
}


/*
 * Reaguje na faktyczną szerokość kolumny/bloku, a nie szerokość okna.
 * Poniżej 430 px usuwamy czwartą kolumnę i pokazujemy status pod typem wyborów.
 */
@container (max-width: 429px) {
  .election-calendar-table-wrap {
    overflow-x: hidden;
  }

  .election-calendar-table {
    width: 100%;
    table-layout: fixed;
  }

  .election-calendar-table th,
  .election-calendar-table td {
    padding: 9px 7px;
    overflow-wrap: anywhere;
  }

  .election-calendar-table th:nth-child(1),
  .election-calendar-table td:nth-child(1) {
    width: 82px;
    min-width: 0;
  }

  .election-calendar-table th:nth-child(2),
  .election-calendar-table td:nth-child(2) {
    width: 39%;
  }

  .election-calendar-table th:nth-child(3),
  .election-calendar-table td:nth-child(3) {
    width: auto;
  }

  .election-results-heading,
  .election-results-cell {
    display: none;
  }

  .election-results-inline {
    display: block;
    margin-top: 7px;
  }

  .election-results-inline:empty {
    display: none;
  }

  .election-country {
    width: auto;
  }

  .election-country-inner {
    align-items: flex-start;
    gap: 7px;
  }

  .election-date {
    min-width: 0;
    padding-left: 7px !important;
    white-space: normal !important;
  }

  .election-results-button {
    min-width: 72px;
    min-height: 28px;
    padding: 5px 9px;
  }
}
