/* ================================================
   CECA Mapa Fundaciones - Estilos
   ================================================ */

/* --- Layout principal --- */
.ceca-mapa-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 16px 120px;
  box-sizing: border-box;
  position: relative;
}

.ceca-mapa-contenedor {
  display: flex;
  width: 100%;
  gap: 32px;
  align-items: flex-start;
}

/* --- Filtros --- */
.ceca-mapa-filtros {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ceca-filtro {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  user-select: none;
}

.ceca-filtro input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  cursor: pointer;
  border: 1px solid var(--ceca-primary, #002a4f);
  border-radius: 4px;
  background: var(--ceca-white, #fff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  flex-shrink: 0;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.ceca-filtro input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 7px;
  border-left: 2px solid var(--ceca-white, #fff);
  border-bottom: 2px solid var(--ceca-white, #fff);
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.ceca-filtro input[type="checkbox"]:checked {
  background: var(--ceca-primary, #002a4f);
  border-color: var(--ceca-primary, #002a4f);
}

.ceca-filtro input[type="checkbox"]:checked::after {
  opacity: 1;
}

.ceca-filtro input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(3, 78, 103, 0.35);
  outline-offset: 2px;
}

.ceca-filtro-icono {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  display: inline-block;
}

/* --- SVG Mapa --- */
.ceca-mapa-svg-wrapper {
  position: relative;
  flex: 1 1 55%;
  min-width: 0;
  line-height: 0;
  overflow: visible;
}

.ceca-mapa-svg-wrapper svg {
  width: 100%;
  height: auto;
  max-height: 600px;
  display: block;
}

/* Transición hover en regiones */
.ceca-mapa-svg-wrapper svg [id^="ES-"],
.ceca-mapa-svg-wrapper svg [id^="ES-"] path,
.ceca-mapa-svg-wrapper svg [id^="ES-"] polygon,
.ceca-mapa-svg-wrapper svg [id^="ES-"] rect,
.ceca-mapa-svg-wrapper svg [id^="ES-"] circle,
.ceca-mapa-svg-wrapper svg [id^="ES-"] ellipse {
  transition: fill 0.18s ease;
}

/* --- Tooltip --- */
#ceca-tooltip {
  position: absolute;
  display: none;
  width: 265px;
  background: rgba(249, 249, 249, 0.95);
  border-radius: 6px;
  border: 5px solid rgba(255, 255, 255, 0.5);
  padding: 16px 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  z-index: 100;
  box-sizing: border-box;
}

.ceca-tooltip-total {
  font-size: 40px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1;
  margin-bottom: 10px;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.ceca-tooltip-desglose {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ceca-tooltip-bancarias,
.ceca-tooltip-ordinarias {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  line-height: 1.4;
  white-space: nowrap;
}

.ceca-tooltip-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

#tooltip-bancarias,
#tooltip-ordinarias {
  min-width: 10px;
  font-weight: 700;
  color: #1a1a2e;
}

/* --- Panel lateral --- */
.ceca-panel-lateral {
  flex: 1 1 45%;
  min-width: 280px;
  max-width: 100%;
}

.ceca-panel-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e8e8;
}

.ceca-panel-titulo {
  font-size: 18px;
  font-weight: 700;
  color: var(--ceca-primary, #002a4f);
  margin: 0;
}

.ceca-panel-titulo em {
  font-style: italic;
  font-weight: 400;
  color: #888;
}

.ceca-panel-empty {
  color: #888;
  font-size: 14px;
  padding: 20px 0;
}

/* --- Lista de fundaciones --- */
#ceca-fundaciones-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ceca-fundacion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid #e0e0e0;
  background: transparent;
  transition: background 0.15s ease;
}

.ceca-fundacion-item:hover {
  background: rgba(136, 217, 235, 0.08);
}

.ceca-fundacion-logo {
  width: 80px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.ceca-fundacion-logo--placeholder {
  background: #f5f6f8;
  border: 1px dashed #d7deea;
  border-radius: 4px;
}

.ceca-fundacion-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.ceca-fundacion-marker {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ceca-fundacion-tipo-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.ceca-fundacion-tipo-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-block;
}

.ceca-fundacion-tipo-dot--bancaria {
  background: var(--ceca-cyan, #00b5dd);
}
.ceca-fundacion-tipo-dot--ordinaria {
  background: #f29a1a;
}

.ceca-fundacion-nombre-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ceca-text-dark, #313131);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ceca-fundacion-link {
  font-size: 16px;
  color: var(--ceca-cyan, #00b5dd);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  line-height: 1;
  margin-right: 20px;
}

.ceca-fundacion-link::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6C3 4.34315 4.34315 3 6 3H8.5C8.77614 3 9 3.22386 9 3.5C9 3.77614 8.77614 4 8.5 4H6ZM11 3.5C11 3.22386 11.2239 3 11.5 3H16.5C16.7761 3 17 3.22386 17 3.5V8.5C17 8.77614 16.7761 9 16.5 9C16.2239 9 16 8.77614 16 8.5V4.70711L11.8536 8.85355C11.6583 9.04882 11.3417 9.04882 11.1464 8.85355C10.9512 8.65829 10.9512 8.34171 11.1464 8.14645L15.2929 4H11.5C11.2239 4 11 3.77614 11 3.5Z' fill='%2300b5dd'/%3E%3C/svg%3E");
}

.ceca-fundacion-link:hover {
  color: var(--ceca-cyan, #00b5dd);
  text-decoration: underline;
}

.ceca-fundacion-link:focus {
  outline: none;
}

.ceca-fundacion-link:focus-visible {
  outline: 2px solid rgba(3, 78, 103, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

.ceca-fundacion-info {
  flex: 1;
  min-width: 0;
  display: block;
}

.ceca-tipo-bancaria {
  font-size: 11px;
  color: #0055a5;
  font-weight: 600;
}
.ceca-tipo-ordinaria {
  font-size: 11px;
  color: #c05a00;
  font-weight: 600;
}
.ceca-tipo-especial {
  font-size: 11px;
  color: #3a7a00;
  font-weight: 600;
}

.ceca-panel-nav {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ceca-nav-btn {
  width: 50px;
  height: 50px;
  padding: 10px;
  border: 1px solid #ccd4de;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.85);
  color: transparent;
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.ceca-nav-btn::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10H16' stroke='%23454B52' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M10 4L16 10L10 16' stroke='%23454B52' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#ceca-nav-prev::before {
  transform: rotate(180deg);
}

.ceca-nav-btn:hover:not(:disabled) {
  background: var(--ceca-white, #fff);
  border-color: #c2ccd8;
}

.ceca-nav-btn:focus {
  outline: none;
}

.ceca-nav-btn:focus-visible {
  outline: 2px solid rgba(3, 78, 103, 0.35);
  outline-offset: 2px;
}

.ceca-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Responsive --- */

/* ── Tablet (max 1024px) ── */
@media (max-width: 1024px) {
  .ceca-mapa-wrapper {
    padding: 16px 24px;
  }

  .ceca-mapa-contenedor {
    gap: 24px;
  }

  .ceca-mapa-svg-wrapper {
    flex: 1 1 50%;
  }

  .ceca-panel-lateral {
    flex: 1 1 50%;
    min-width: 220px;
  }

  .ceca-fundacion-item {
    gap: 12px;
    padding: 12px 0;
  }

  .ceca-fundacion-logo {
    width: 60px;
    height: 22px;
  }

  .ceca-fundacion-nombre-text {
    font-size: 13px;
  }

  .ceca-nav-btn {
    width: 44px;
    height: 44px;
  }
}

/* ── Mobile (max 768px) ── */
@media (max-width: 768px) {
  .ceca-mapa-wrapper {
    padding: 16px;
  }

  .ceca-mapa-contenedor {
    flex-direction: column;
    gap: 24px;
  }

  .ceca-mapa-svg-wrapper {
    flex: 0 0 auto;
    width: 100%;
  }

  .ceca-mapa-svg-wrapper svg {
    max-height: 350px;
    margin: 0 auto;
  }

  .ceca-panel-lateral {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .ceca-mapa-filtros {
    gap: 16px;
  }

  .ceca-filtro {
    font-size: 13px;
  }

  .ceca-fundacion-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ceca-fundacion-link {
    font-size: 14px;
    margin-right: 0;
  }

  .ceca-nav-btn {
    width: 40px;
    height: 40px;
  }

  #ceca-tooltip {
    display: none !important;
  }
}

/* ── Mobile pequeño (max 480px) ── */
@media (max-width: 480px) {
  .ceca-mapa-wrapper {
    padding: 12px;
  }

  .ceca-mapa-svg-wrapper svg {
    max-height: 280px;
  }

  .ceca-panel-titulo {
    font-size: 16px;
  }

  .ceca-fundacion-nombre-text {
    font-size: 13px;
    white-space: normal;
  }
}
