/* === ESPECIALIDADES PREMIUM === */
.especialidades {
  padding: 4rem 1rem;
  text-align: center;
}

.section-title {
  font-size: 2.2rem;
  color: #005b99;
  margin-bottom: 2rem;
  font-weight: 700;
  position: relative;
}

/* Forçar texto do banner à esquerda sem alterar o resto */
.banner-content .banner-text {
  left: 0 !important;
  right: auto !important;
  text-align: left !important;
  transform: translateY(-50%) !important;
}

.section-title::after {
  content: "";
  display: block;
  width: 70px;
  height: 4px;
  background: #3399ff;
  margin: 0.5rem auto 0;
  border-radius: 4px;
}

/* GRID */
.especialidades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

/* CARD PREMIUM */
.especialidade-card {
  position: relative;
  background: #ffffff;
  padding: 2.5rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(0, 91, 153, 0.15);
  text-align: center;
  transition: all 0.35s ease;
  cursor: pointer;
  overflow: hidden;
}

/* BG IMAGEM SUAVE */
.especialidade-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 80%;
  background-position: center bottom;
  background-repeat: no-repeat;
  opacity: 0.06; /* bem suave */
  transition: opacity 0.4s ease;
  z-index: 1;
}

.especialidade-card:hover::after {
  opacity: 0.15; /* destaca um pouco no hover */
}

/* GRADIENTE HOVER */
.especialidade-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,91,153,0.08), rgba(0,91,153,0.18));
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
  z-index: 2;
}

.especialidade-card:hover::before {
  opacity: 1;
}

.especialidade-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 91, 153, 0.3);
}

/* CONTEÚDO */
.especialidade-card i,
.especialidade-card h3 {
  position: relative;
  z-index: 3; /* fica acima do fundo */
}

/* ÍCONES */
.especialidade-card i {
  font-size: 2.2rem;
  color: #005b99;
  margin-bottom: 0.8rem;
  background: rgba(0, 91, 153, 0.08);
  padding: 1rem;
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.3s ease;
}

.especialidade-card:hover i {
  transform: scale(1.15);
  background: #005b99;
  color: #fff;
  animation: pulseIcon 0.6s ease;
}

/* TÍTULO */
.especialidade-card h3 {
  font-size: 1rem;
  color: #222;
  font-weight: 600;
  margin-top: 0.5rem;
  line-height: 1.4;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* === MODAL ESPECIALIDADE === */
.modal-especialidade {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

.modal-especialidade.open {
  opacity: 1;
  pointer-events: all;
}

.modal-especialidade-content {
  background: #fff;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-especialidade-body {
  display: flex;
  flex: 1;
  height: 100%;
}

/* === IMAGEM DO MODAL === */
.modal-especialidade-img {
  flex: 1;
  height: 100%;
}

.modal-especialidade-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* === TEXTO DO MODAL === */
.modal-especialidade-text {
  flex: 1;
  padding: 1.5rem 2rem;
  text-align: justify;
  white-space: pre-line;
}

.modal-especialidade-text h2 {
  color: #005b99;
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
}

.modal-especialidade-text p {
  color: #444;
  line-height: 1.8;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #333;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: #005b99;
}

.modal-logo-top {
  text-align: center;
  margin-bottom: 1rem;
}

.modal-logo-top img {
  height: 80px;
  width: auto;
  border: none;
  outline: none;
  box-shadow: none;
  border-radius: 0;
}

/* === AJUSTES RESPONSIVOS === */

/* Tablets (até 992px) */
@media (max-width: 992px) {
  .especialidades {
    padding: 3rem 1rem;
  }

  .section-title {
    font-size: 1.7rem;
  }

  .especialidade-card {
    padding: 1.5rem 1rem;
  }

  .especialidade-card i {
    font-size: 2rem;
  }

  .especialidade-card h3 {
    font-size: 0.95rem;
  }

  .modal-especialidade-content {
    max-width: 750px;
  }

  .modal-especialidade-text h2 {
    font-size: 1.3rem;
  }

  .modal-especialidade-text p {
    font-size: 0.95rem;
    line-height: 1.6;
  }
}

/* === Ajustes para telas médias (até 768px) === */
@media (max-width: 768px) {
  .modal-especialidade-body {
    flex-direction: column; /* imagem em cima, texto embaixo */
    height: auto;
  }

  .modal-especialidade-img {
    flex: none;          /* impede de dividir espaço com o texto */
    height: 200px;       /* altura fixa moderada */
  }

  .modal-especialidade-text {
    flex: none;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

/* === Ajustes para telas pequenas (até 480px) === */
@media (max-width: 480px) {
  .modal-especialidade-content {
    width: 95%;
    max-width: 360px;
  }

  .modal-especialidade-img {
    height: 150px;   /* reduz bem a imagem */
  }

  .modal-especialidade-text h2 {
    font-size: 1rem;
  }

  .modal-especialidade-text p {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  /* força especialidades em 2 colunas */
  .especialidades-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* === Ajustes para telas muito pequenas (até 360px) === */
@media (max-width: 360px) {
  .modal-especialidade-img {
    height: 120px;   /* quase um banner pequeno */
  }

  .modal-especialidade-text {
    padding: 0.6rem;
  }

  .modal-especialidade-text h2 {
    font-size: 0.9rem;
  }

  .modal-especialidade-text p {
    font-size: 0.75rem;
    line-height: 1.3;
  }

  /* mantém 2 colunas mesmo nos mini smartphones */
  .especialidades-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
}
