.mca-wrapper {
  width: 100%;
}

.mca-map {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 36px;
}

.mca-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.mca-map .mca-concejo {
  cursor: pointer;
  transition: opacity .15s ease, filter .15s ease;
  outline: none;
}

.mca-map .mca-concejo:hover,
.mca-map .mca-concejo:focus {
  opacity: .72;
  filter: brightness(1.08);
}

.mca-map .mca-concejo.is-active {
  filter: brightness(1.18) saturate(1.15);
  opacity: .78;
}

.mca-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 4px;
  background: rgba(20, 20, 20, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}

.mca-tooltip.mca-tooltip-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mca-table-panel {
  width: 100%;
}

.mca-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.mca-active-filter {
  font-size: 16px;
  line-height: 1.4;
}

.mca-active-filter-label {
  margin-right: 6px;
}

.mca-clear-filters {
  appearance: none;
  border: 0;
  border-radius: 4px;
  padding: 9px 15px;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}

.mca-clear-filters[hidden] {
  display: none;
}

.mca-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.mca-search-label {
  flex: 0 0 auto;
  font-weight: 600;
}

.mca-search {
  width: 100%;
  max-width: 420px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  font: inherit;
  box-sizing: border-box;
}

.mca-table-status {
  min-height: 20px;
  margin-bottom: 8px;
  font-size: 14px;
}

.mca-table-wrap {
  position: relative;
}

.mca-wrapper.mca-is-loading .mca-table-wrap {
  opacity: .5;
  pointer-events: none;
}

.mca-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 15px;
}

.mca-table th,
.mca-table td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #ddd;
}

.mca-table th {
  font-weight: 700;
}

/* Proporciones de la nueva tabla: Concejo | Alcalde | Legislaturas / partido */
.mca-table th:nth-child(1),
.mca-table td:nth-child(1) {
  width: 25%;
}

.mca-table th:nth-child(2),
.mca-table td:nth-child(2) {
  width: 33%;
}

.mca-table th:nth-child(3),
.mca-table td:nth-child(3) {
  width: 42%;
}

.mca-legislatura-item {
  display: block;
  margin-bottom: 4px;
  line-height: 1.35;
}

.mca-legislatura-item:last-child {
  margin-bottom: 0;
}

.mca-legislatura-year {
  font-weight: 600;
}

.mca-legislatura-party {
  white-space: normal;
}

.mca-empty-value {
  opacity: .65;
}

/* Enlace a la ficha asociada: ahora el propio nombre del alcalde es clicable */
.mca-associated-link {
  color: #004AAD;
  text-decoration: none;
  font-weight: 600;
}

.mca-associated-link:hover,
.mca-associated-link:focus {
  color: #A0BD50;
  text-decoration: none;
}

.mca-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.mca-page {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.mca-page.is-active {
  font-weight: 700;
}

.mca-no-results {
  padding: 22px 0;
}

.mca-result-meta {
  display: none;
}

.mca-error-admin {
  padding: 16px;
  border: 1px solid #c00;
  background: #fff5f5;
}

@media (max-width: 800px) {
  .mca-table-panel {
    overflow: hidden;
  }

  .mca-table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .mca-search-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .mca-search {
    max-width: none;
  }

  .mca-table {
    table-layout: auto;
  }

  .mca-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .mca-table,
  .mca-table tbody,
  .mca-table tr,
  .mca-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .mca-table tr {
    margin-bottom: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
  }

  .mca-table td {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
  }

  .mca-table td:last-child {
    border-bottom: 0;
  }

  .mca-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    font-weight: 600;
    text-align: left;
  }

  .mca-table td > * {
    max-width: 58%;
  }

  .mca-legislaturas-cell {
    display: grid !important;
    grid-template-columns: 42% 58%;
    gap: 20px;
  }

  .mca-legislaturas-cell::before {
    grid-column: 1;
  }

  .mca-legislaturas-cell .mca-legislatura-item,
  .mca-legislaturas-cell .mca-empty-value {
    grid-column: 2;
    text-align: right;
    max-width: none;
  }
}
