/* Layout flexbox para a página /entities */
.entities-page {
  display: flex;
  justify-content: space-between;
}
.knowledgebase-container{
  display: flex;
  flex-direction: row;
}
div.filters{
  padding-top: 10px !important;
    display: flex;
    justify-content: space-between;
  }
.knowledgebase-container{
    display: flex;
    flex-direction: row;
}
.knowledgebase-container-notclickable {
  display: flex;
  flex-direction: row;
  background-color: white;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0));
  -webkit-mask-size: 100% 100%;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0));
  mask-size: 100% 100%;
  }
.knowledgebase-container-notclickable .main-content{
  background-color: white;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0));
  -webkit-mask-size: 100% 100%;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0));
  mask-size: 100% 100%;
}
.filters-popup{
  width: 30%;
}
div.filters{
  padding-top: 10px !important;
  width: 100%;
}
form.form_filters{
  width: 100%;
}
.form_filters select{
  background-color: transparent !important;
}
.form_filters select:focus,
.form_filters input:focus{
  border: 1px solid #006EAB;
  outline: none !important;
}
.filter-field input{
  border: 1px solid #B9CAD4;
  font-size: 14px;
  justify-items: start;
  height: 34px;
  padding-inline: 15px;
  border-radius: 5px;
  width: 100%;
}

#filter-mobile-btns{
  display: none;
}
.dropdown-filter {
  font-size: 14px;
  width: 90%;
  height: 34px;
  border: 1px solid #B9CAD4;
  border-radius: 6px;
  padding-left: 10px;
}

#confirmation-modal {
  display: none;
}

.confirmation-modal-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  left: 50%;
  top: 50%;
  width: 50%;
  max-width: 600px;
  height: auto;
  transform: translate(-50%, -50%);
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index:100000;
  border-radius: 8px;
}
.popup-title {
  border-color: #CCE2EE;
  border-bottom: 1px solid #CCE2EE;
  margin-top: 20px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: bold;
}
.popup-title.close-container{
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 0;
}
.popup-title.close-container h2{
  padding-top: 20px;
}

.popup-title h2 {
  padding-left: 20px;
  font-weight: 550;
  font-size: 18px;
  color: #000;
}
.popup-buttons.remove-fav-btns{
  flex-direction: row !important;
}
.popup-form {
  padding: 0 24px;
  margin-top: 4px;
  margin-bottom: 24px;
}

.popup-buttons {
  padding-right: 20px;
  padding-left: 20px;
  padding-top: 20px;
  border-color: #CCE2EE;
  border-top: 1px solid #CCE2EE;
  margin-top: 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}
#delete-popup h2,
#delete-popup p{
  color: black;
}
.popup-message{
  padding: 0 20px;
  font-size: 16px;
  font-weight: 450;
  color: #000;
}
.remove-fav{
  padding: 0 16px;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
  border-color: #006EAB !important;
  border: 2px solid #006EAB;
  border-radius: 5px !important;
  cursor: pointer;
  transition: 0.3s ease;
  background-color: #006EAB !important;
  color: #FFF;
  margin: 0 !important;
}

.cancel-remove-fav{
  padding: 0 16px;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
  border-color: #006EAB !important;
  border: 2px solid #006EAB;
  border-radius: 5px !important;
  cursor: pointer;
  transition: 0.3s ease;
  background-color: #fff !important;
  color: #006EAB;
  margin: 0 !important;
}

.success-message {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.custom-alert-msg {
  position: fixed;
  top: 140px !important;
  right: 20px;
  z-index: 9999;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
  color: #fff;
  animation: fadeInOut 7s ease-in-out;
}
.custom-alert-msg.success-popup {
  background-color: #4caf50;
  color: white;
  border: none;
}
.custom-alert-msg.error-popup {
  background-color: #f44336;
  color: white;
  border: none;
}

.remove-entity-button {
  padding: 0 2px;
  font-size: 16px;
  font-weight: 500;
  color: #D4404A;
  background-color: #FFF !important;
  border-color: transparent !important;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  gap: 8px;
  align-items: center;
}

#popupOverlayFilters{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
}
form.form_filters{
  width: 100%;
}
.form_filters select{
  background-color: transparent !important;
}
.form_filters select:focus,
.form_filters input:focus{
  border: 1px solid #006EAB;
  outline: none !important;
}

#filter-mobile-btns{
  display: none;
}
.dropdown-filter {
  font-size: 14px;
  width: 100%;
  height: 34px;
  border: 1px solid #B9CAD4;
  border-radius: 6px;
  padding-left: 10px;
}
#popupOverlayFilters{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); 
z-index: 998; 
display: none;
}
.remove-entity-popup{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); 
  z-index: 998; 
  display: none;
  }
.ph-magnifying-glass{
  margin-top: 15px;
  font-size: 18px;
  margin-left: 15px;
  position: absolute;
}
.left-content {
  width: 30%;
}

.right-content {
  width: 70%;
}
/*Estilo da seta do select */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-select-wrapper label {
  display: inline;      
  white-space: nowrap;  
  width: fit-content;
  margin: 0;           
  padding: 0;           
}

#arrow-down-1 {
  position: absolute;
  top: 210px;
  left: 20%;              
  pointer-events: none;     
  font-size: 15px;          
  color: #999;          
}

#area-label {
  pointer-events: none;
}


/* Estilizando o filtro */
.left-content select {
  width: 100%;
  padding: 5px;
  font-size: 16px;
}

.search-item{
  display: flex;
  margin-bottom: 20px;
}
.search-bar{
  color: #000000;
  padding-left: 40px !important;
  outline: none;
}
.search-bar:focus{
  border: 1px solid #006EAB;
}
.item-logo {
  width: 10%;
  margin-top: 10px;
}

.item-content {
  width: 90%;
}

.item-content p a{
  color: #006EAB !important;
}

.item-logo img {
  width: 53px;
  height: 53px;
  border-radius: 50%; /* Faz com que a imagem fique redonda */
  object-fit: cover; /* Mantém a proporção da imagem centralizando-a dentro do círculo */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.description-text {
  display: -webkit-box; /* Define um contêiner flexível para suportar o truncamento */
  -webkit-box-orient: vertical; /* Define a orientação vertical do contêiner */
  overflow: hidden; /* Oculta o excesso de texto */
  text-overflow: ellipsis; /* Exibe '...' no final se o texto for truncado */
  -webkit-line-clamp: 3; /* Limita o texto a no máximo 3 linhas */
  max-height: 4.5em; /* Aproximadamente três linhas de altura (ajuste conforme o tamanho da fonte) */
}


/* Detalhes da entidade */

.entity-detail {
  margin-top: 90px;
}

.entity-info {
  display: flex;
  padding: 40px;
  border-radius: 8px;
  border: 1px solid #B9CAD4;
  margin-bottom: 32px;
}

.entity-info h1 {
  color: black;
  font-size: 24px;
  font-weight: 550;
}
.title-entity-name{
color: #000000;
}
.title-entity-name a:hover{
color: #006EAB !important;
text-decoration: underline;
}

.description-text{
color: black !important;
}
h3 a{
color: black;
}
.entity-info p {
  color: black;
  font-size: 16px;
  font-weight: 450;
}

.entity-info a {
  color: #006EAB;
  font-size: 16px;
  font-weight: 450;
  text-decoration: underline;
}
.entity-info a:hover{
text-decoration: underline;
}

.item-logo-2 {
  width: 15%;
  margin-top: 10px;
}

.item-logo-2 img {
  width: 100px;
  height: 100px;
  border-radius: 50%; /* Faz com que a imagem fique redonda */
  object-fit: cover; /* Mantém a proporção da imagem centralizando-a dentro do círculo */
}

.entity-overview {
  padding: 40px;
  border-radius: 8px;
  border: 1px solid #B9CAD4;
  margin-bottom: 32px;
}

.entity-overview h2 {
  color: black;
  font-size: 24px;
  font-weight: 500;
  margin: 0px 0px 32px 0px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.title-topic {
  font-size: 16px;
  font-weight: 500;
  color: black;
}

.text-topic {
  font-size: 16px;
  font-weight: 300;
  color: black;
}

.text-topic-cae {
  margin: 0;
}

.entity-analytics {
  padding: 40px;
  border-radius: 8px;
  border: 1px solid #B9CAD4;
  margin-bottom: 32px;
}

.entity-analytics h2 {
  color: black;
  font-size: 24px;
  font-weight: 500;
  margin: 0px 0px 32px 0px;
}

.entity-analytics p {
  color: black;
  font-size: 16px;
  font-weight: 300;
}
.close-filters{
display: none;
}
.mobile-ent-filters{
display: none;
}
.slider-wrapper{
  width: 85%;
}
.slider-container{
  display: flex;
  justify-content: center;
}
.main-content .entity-section-content{
  border-bottom: none;
}
.mobile-ent-filters{
  display: none;
}
.filter-wrap-wrapper{
  width: 100%;
}

/* === ANALYTICS GLOBAL === */
.entity-analytics {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.entity-analytics h2 {
  text-align: left;
  color: #000;
  margin-bottom: 30px;
  font-size: 24px;
  font-weight: 500;
}

/* === GRID DE CONTADORES === */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.counter-card {
  background: white;
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.counter-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.counter-card h3 {
  margin: 0 0 8px 0;
  font-size: 1.4rem;
  color: #555;
  font-weight: 500;
}

.counter-value {
  font-size: 1.8rem !important;
  font-weight: 600 !important;
  color: #2c3e50 !important;
  margin: 0 !important;
}

/* === GRÁFICO TEMPORAL === */
.chart-container {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container h3,
.chart-container h4 {
  margin: 0 0 15px 0;
  color: #2c3e50;
  font-weight: 600;
  text-align: center;
}

.chart-container h4 {
  font-size: 1rem;
  color: #666;
}

/* === GRÁFICOS POR CATEGORIA === */
.category-charts {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin: 30px 0;
}

.category-chart-group {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.category-chart-group h3 {
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #3498db;
  color: #2c3e50;
  font-size: 1.3rem;
  font-weight: 600;
}

.pie-charts {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.chart-container.half {
  flex: 1;
  min-width: 280px;
  max-width: 400px;
}

/* === RESPONSIVO === */
@media (max-width: 768px) {
  .pie-charts {
    flex-direction: column;
    align-items: center;
  }
  
  .chart-container.half {
    min-width: 100%;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .entity-analytics {
    padding: 15px;
  }
}

/* === BOTÃO VER MAIS === */
.analytics-toggle {
  text-align: center;
  margin: 20px 0;
}

.btn-toggle-analytics {
  background: #3498db;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1,5rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.btn-toggle-analytics:hover {
  background: #2980b9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-toggle-analytics i {
  transition: transform 0.3s ease;
}

.btn-toggle-analytics.expanded i {
  transform: rotate(180deg);
}

.btn-toggle-analytics .btn-text {
  transition: all 0.3s ease;
}

/* === EXPANDIR === */
.analytics-expanded {
  overflow: hidden;
  transition: all 0.4s ease;
  padding: 0 20px;
}

.analytics-expanded.show {
  display: block !important;
}
.analytics-toggle-bottom {
  text-align: center;
  margin: 30px 0 10px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.analytics-toggle-bottom .btn-toggle-analytics {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.analytics-toggle .btn-toggle-analytics.expanded {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.analytics-toggle-bottom .btn-toggle-analytics i {
  transform: rotate(0deg);
}

/* Altura dos gráficos de barras – só força em mobile quando necessário */
#adsSubtypeChart,
#adsCategoryChart {
  height: 380px !important;           /* desktop & tablet: altura bonita e equilibrada */
  min-height: 320px;
}

/* Tablet e mobile grande */
@media (max-width: 992px) {
  #adsSubtypeChart,
  #adsCategoryChart {
    height: 420px !important;
  }
}

/* Mobile médio */
@media (max-width: 768px) {
  #adsSubtypeChart,
  #adsCategoryChart {
    height: 480px !important;
  }
}

/* Mobile pequeno – aqui sim, damos mais espaço */
@media (max-width: 480px) {
  #adsSubtypeChart,
  #adsCategoryChart {
    height: 560px !important;
  }
}

/* Tooltip nunca sai do ecrã (só em mobile) */
@media (max-width: 768px) {
  .chartjs-tooltip {
    max-height: 180px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    font-size: 13px !important;
  }
}
@media (max-width: 1024px) {
  #filter-mobile-btns{
    display: none;
  }
  .filters{
    padding-top: 0 !important;
    display: none;
    padding: 20px !important;
  }
  .filters.visible{
    margin-right: 0 !important;
    gap: 20px;
  }
  .filters.visible,
  #popupOverlayFilters.visible,
  #filter-popup.visible{
    display: flex !important;
  }
  #filter-popup {
    display: none;
    position: fixed; /* Ensures it's relative to the viewport */
    top: 50%;        /* Centers vertically */
    left: 50%;       /* Centers horizontally */
    transform: translate(-50%, -50%); /* Adjusts for the element's own size */
    background-color: white;
    width: 80%;
    max-width: 600px; /* Optional: Prevents it from being too wide */
    z-index: 1000;    /* Ensures it appears above other content */
  }
  #filter-mobile-btns{
    display: flex;
    flex-direction: row;
    gap: 10px;
  }
  #filter-mobile-btns input,
  #filter-mobile-btns a,
  #filter-mobile-btns a button{
    width: 100%;
  }
  .filter-wrap-wrapper{
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 20px;
  }
  .filters.visible{
    display: flex;
    flex-direction: column;
    gap: 0 !important;
  }
  .close-filters{
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: end;
  }
  .close-filters{
    cursor: pointer;
  }
  .close-filters i:hover{
    color: black;
  }
  .filter-wrap{
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .filter-field{
    width: 100% !important;
  }
  #arrow-down-1 {
    top: 36px;
    left:73%;
  }
  .item-content{
    margin-left: 20px

  }
  .mobile-ent-filters{
  display: flex;
  flex-direction: row;
  justify-content: end;
  }
  .mobile-ent-filters button{
  width: fit-content !important;
  }
}

@media (max-width: 992px) {
  .filter-field{
    width: 100% !important;
  }
  #arrow-down-1 {
    top: 36px;
    left:70%;
  }

  .item-logo-2{
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 768px) {
  .main-content{
    margin-top: 0 !important;
  }

  .item-content{
    margin-top: 20px;

  }
  .entity-info{
    flex-direction: column;
  }
  .item-content{
    margin-left: 0px
  }
  .overview-grid{
  display: flex;
  flex-direction: column;
  }


}
@media (max-width: 600px) {
  .item-logo {
    width: 53px;
  }
  #arrow-down-1 {
    left:71%;
  }
  #filter-popup{
    width: 90%;
  }
  .filters.visible{
    gap: 12px !important;
  }
  .main-content{
    margin-top: 0 !important;
  }
}
@media (max-width: 480px) {
  .filter-wrap-wrapper{
    flex-direction: column;
    gap: 0;
  }
  .filter-wrap-wrapper label{
    margin-top: 10px !important;
  }
  .filter-wrap-wrapper .filter-wrap{
    margin-bottom: 0;
  }
  .filter-wrap-wrapper label{
    margin-top: 10px !important;
  }
  .filter-wrap-wrapper .filter-wrap{
    margin-bottom: 0;
  }
  #arrow-down-1 {
    left:67%;
  }
  .main-content{
    margin-top: 0 !important;
  }
}

