/**
 * Residências Médicas - Custom Styles
 * Arquivo separado do CSS que estava inline no HTML
 */

/* Additional CSS for Inicio tab functionality */
.tab-content-1, .tab-content-2, .tab-content-3, .tab-content-4, .tab-content-5 {
  transition: opacity 0.3s ease-in-out;
}

.tab-button-1, .tab-button-2, .tab-button-3, .tab-button-4, .tab-button-5 {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  letter-spacing: 0.025em;
  border: 1px solid transparent;
}

.tab-button-1:hover, .tab-button-2:hover, .tab-button-3:hover, .tab-button-4:hover, .tab-button-5:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

.tab-button-1.bg-green-600, .tab-button-2.bg-green-600, .tab-button-3.bg-green-600, .tab-button-4.bg-green-600, .tab-button-5.bg-green-600 {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #059669;
}

.tab-button-1.bg-gray-100, .tab-button-2.bg-gray-100, .tab-button-3.bg-gray-100, .tab-button-4.bg-gray-100, .tab-button-5.bg-gray-100 {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.tab-button-1.bg-gray-100:hover, .tab-button-2.bg-gray-100:hover, .tab-button-3.bg-gray-100:hover, .tab-button-4.bg-gray-100:hover, .tab-button-5.bg-gray-100:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

/* Melhorias nas abas principais */
#tab-inicio, #tab-overview, #tab-Mapa {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  letter-spacing: 0.025em;
}

#tab-inicio:hover, #tab-overview:hover, #tab-Mapa:hover {
  color: #059669;
  transform: translateY(-1px);
}

#tab-inicio.border-b-2.border-green-600,
#tab-overview.border-b-2.border-green-600,
#tab-Mapa.border-b-2.border-green-600 {
  color: #059669;
  font-weight: 600;
}

/* Gradiente sutil no header das abas */
.bg-white:has(#tab-inicio) {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
}

/* Ensure proper canvas sizing and responsiveness */
canvas {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}

/* Chart containers responsiveness */
.chart-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Specific chart heights for different screen sizes - reduced for compact layout */
.chart-height {
  height: 400px;
}

@media (min-width: 2560px) {
  .chart-height {
    height: 520px;
  }
}

@media (min-width: 1920px) {
  .chart-height {
    height: 480px;
  }
}

@media (max-width: 1536px) {
  .chart-height {
    height: 380px;
  }
}

@media (max-width: 1280px) {
  .chart-height {
    height: 350px;
  }
}

@media (max-width: 1024px) {
  .chart-height {
    height: 320px;
  }
}

@media (max-width: 768px) {
  .chart-height {
    height: 280px;
  }
}

@media (max-width: 640px) {
  .chart-height {
    height: 250px;
  }
}

/* Tab buttons responsive adjustments */
.tab-buttons-container {
  flex-wrap: wrap;
  gap: 0.25rem;
}

@media (max-width: 640px) {
  .tab-buttons-container button {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
  }
}

/* Card hover effects e visual profissional */
.stat-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px 0 rgba(16,185,129,0.08);
  padding: 0.875rem 1rem;
  min-height: 70px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  box-shadow: 0 8px 25px 0 rgba(16,185,129,0.15);
  transform: translateY(-3px);
  border-color: #d1fae5;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
  transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(16,185,129,0.4);
}

.stat-icon .material-icons {
  font-size: 1.2rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  width: 100%;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #047857;
  margin-bottom: 0.025rem;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: #137338;
  line-height: 1;
  font-family: 'Kanit', 'Poppins', 'Roboto', sans-serif;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 4px rgba(19,115,56,0.1);
}

.stat-card:nth-child(2) .stat-icon { background: #137338; }
.stat-card:nth-child(2) .stat-value { color: #137338; }
.stat-card:nth-child(3) .stat-icon { background: #137338; }
.stat-card:nth-child(3) .stat-value { color: #137338; }
.stat-card:nth-child(4) .stat-icon { background: #137338; }
.stat-card:nth-child(4) .stat-value { color: #137338; }

/* Responsive adjustments for stat cards */
@media (max-width: 1024px) {
  .stat-card { padding: 0.7rem 0.8rem; }
  .stat-value { font-size: 2rem; }
  .stat-label { font-size: 0.8rem; }
  .stat-icon { width: 1.5rem; height: 1.5rem; font-size: 1rem; }
}

@media (max-width: 768px) {
  .stat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.7rem;
  }
  .stat-value {
    font-size: 1.5rem;
  }
  .stat-label {
    font-size: 0.7rem;
  }
  .stat-icon {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.8rem;
  }
}

/* Melhorias na responsividade dos cards estatísticos */
@media (max-width: 640px) {
  .stat-card {
    min-height: 85px;
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
  }
  
  .stat-label {
    font-size: 0.75rem;
    line-height: 1.2;
  }
}

/* Enhanced padding for larger chart cards */
.chart-card-large {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(16,185,129,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-card-large:hover {
  box-shadow: 0 8px 30px rgba(16,185,129,0.12);
  transform: translateY(-2px);
  border-color: #d1fae5;
}

@media (min-width: 1920px) {
  .chart-card-large {
    padding: 1.5rem 2rem;
  }
}

@media (min-width: 2560px) {
  .chart-card-large {
    padding: 2rem 2.5rem;
  }
}

/* Map loading styles - apenas para centralização do loading */
.map-container {
  position: relative !important;
  min-height: 280px;
  height: 95%;
  width: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #e0f7fa;
  transition: all 0.3s ease;
}

.map-container:hover {
  border-color: #b2dfdb;
  box-shadow: inset 0 2px 8px rgba(16,185,129,0.1);
}

#map-mini {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 280px !important;
}

.map-loading {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  text-align: center !important;
  z-index: 10 !important;
  width: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.map-loading-spinner {
  width: 40px !important;
  height: 40px !important;
  border: 3px solid #e5e7eb !important;
  border-top: 3px solid #137338 !important;
  border-radius: 50% !important;
  animation: mapSpin 1s linear infinite !important;
  margin: 0 auto 12px !important;
}

@keyframes mapSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Solução específica para dropdowns dos selects */
select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

select:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.15);
  outline: none;
  border-color: #10b981 !important;
}

select:hover {
  border-color: #94a3b8;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

/* Apenas para os selects específicos dos filtros */
#filter-ano, #filter-instituicao, #filter-programa, #filter-cidade {
  position: relative;
  z-index: 999;
}

/* Scrollbar customizada para selects */
select::-webkit-scrollbar {
  width: 8px;
}

select::-webkit-scrollbar-track {
  background: #f1f1f1;
}

select::-webkit-scrollbar-thumb {
  background: #10b981;
  border-radius: 4px;
}

select::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* Melhorias nos filtros e inputs - regras consolidadas acima */

/* Label improvements */
label {
  color: #374151;
  font-weight: 600;
  letter-spacing: 0.025em;
}

/* Filter container improvements */
.filter-container {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  position: relative;
}

.filter-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669, #047857);
  border-radius: 0.75rem 0.75rem 0 0;
}

.filter-container:hover {
  box-shadow: 0 6px 25px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

/* Filter container compact - versão simplificada */
.filter-container-compact {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  position: relative;
  z-index: 10;
}

.filter-container-compact:hover {
  box-shadow: 0 6px 25px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

/* Melhoria global em transições */
* {
  scroll-behavior: smooth;
}

/* Melhorias no loading do mapa */
.map-loading-spinner {
  border: 3px solid #e5e7eb;
  border-top: 3px solid #10b981;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.map-loading-text {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  font-weight: 500;
}

/* Melhorias nos títulos dos gráficos */
h3.text-xs.lg\\:text-sm.font-semibold.text-green-700 {
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #047857;
}

/* Efeito de foco melhorado para acessibilidade */
button:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

select:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

/* Animações suaves para elementos interativos */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card, .chart-card-large, .filter-container {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Estilos específicos para gráficos da Visão Geral */
#content-overview .tab-content-3,
#content-overview .tab-content-4,
#content-overview .tab-content-5 {
  transition: opacity 0.3s ease-in-out;
}

/* Controle específico dos containers de gráficos para evitar overflow */
.tab-content-3, .tab-content-4, .tab-content-5 {
  width: 100% !important;
  height: 256px !important; /* Altura fixa de 64 * 4 = 256px (h-64 em Tailwind) */
  max-width: 100% !important;
  max-height: 256px !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Canvas específicos dos gráficos da Visão Geral */
.tab-content-3 canvas,
.tab-content-4 canvas,
.tab-content-5 canvas {
  max-width: 100% !important;
  max-height: 256px !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Containers dos cards de gráficos da Visão Geral */
#content-overview .bg-white.p-2.rounded-md.shadow-md {
  overflow: hidden !important;
  max-height: 320px !important; /* Altura máxima do card incluindo padding e botões */
}

/* Container específico para o gráfico de gênero */
#graf_genero {
  max-width: 100% !important;
  max-height: 256px !important;
  width: 100% !important;
  height: 100% !important;
}

/* Estilos para botões de abas da Visão Geral */
.tab-button-3, .tab-button-4, .tab-button-5 {
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}


.residency-stats {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
    background-color: #fff;
  }

  .collection-item {
    padding: 1.2rem !important;
    transition: background-color 0.3s ease;
  }

  .hover-effect:hover {
    background-color: #f5f5f5;
  }

  .material-icons.circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 24px;
    border-radius: 50%;
  }

  .white-text {
    color: #fff !important;
  }

  .title {
    font-size: 1.2rem;
    color: #333;
    display: block;
    margin-bottom: 0.3rem;
  }

  .description {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
  }

  @media (max-width: 600px) {
    .material-icons.circle {
      width: 36px;
      height: 36px;
      font-size: 20px;
    }

    .title {
      font-size: 1.1rem;
    }

    .description {
      font-size: 0.9rem;
    }
  }

  /*********INICIO************/

  /* Previne expansão infinita dos gráficos */
    .chart-container {
      position: relative;
      width: 100%;
      height: 90%;
      overflow: hidden;
      display: block;
    }

    .tab-content-2 {
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;
    }

    /* Limita dimensões dos canvas para prevenir expansão infinita */
    #chart-bar-instituicao,
    #chart-bar-programa,
    #chart-bar-cidade {
      max-width: 100% !important;
      max-height: 100% !important;
      width: 100% !important;
      height: 100% !important;
      display: block !important;
      box-sizing: border-box !important;
    }

    /* Garante que containers pais não expandam */
    .chart-height {
      position: relative;
      overflow: hidden;
      contain: layout style size;
    }



/* configuracoes da caixa do mapa*/


  path:hover, circle:hover {
    stroke: #5b5c5e !important;
    stroke-width:2px;
    stroke-linejoin: round;
    fill: #DF6910 !important;
    cursor: pointer;
  }
  #path67 {
    fill: none !important;
    stroke: #DF6910 !important;
    cursor: default;
  }
  #info-box-mapa {
    display: none;
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 1;
    background-color: #DF6910;
    border: 2px solid #000;
    border-radius: 5px;
    padding: 5px;
    font-family: 'Kanit', sans-serif;
    color:#ffffff;
  }
.login_img_resmed{
    align-items: center;
}
#mapa{
padding: 20px;
width: 89%;
}