/* ===== SEÇÃO CURSOS ===== */
.cursos {
  padding: 50px 20px;
  text-align: center;
  background: #f9f9f9;
}

.cursos h2 {
  margin-bottom: 15px;
  font-size: 2rem;
  color: #222;
}

.cursos p {
  max-width: 700px;
  margin: 0 auto 30px auto;
  color: #555;
  font-size: 1.1rem;
}

/* ===== GRADE DE CURSOS ===== */
.grade-cursos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 25px;
  justify-items: center;
  margin-top: 30px;
}

/* ===== CARTÃO DE CURSO ===== */
.curso {
  background: #fff !important;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.curso:hover {
  transform: translateY(-5px);
}

/* Imagem do curso — totalmente ajustável e proporcional */
.curso img {
  width: 100%;
  aspect-ratio: 16 / 9; /* mantém proporção fixa */
  object-fit: cover; /* preenche sem deformar */
  background-color: #fff;
  display: block;
}

/* Texto do cartão */
.curso h3 {
  margin: 15px 0 5px;
  font-size: 1.2rem;
  color: #222;
}

.curso p {
  padding: 0 12px;
  font-size: 0.95rem;
  color: #555;
}

/* Botão */
.curso button {
  background: #2a6df4;
  color: white;
  border: none;
  margin: 15px auto 20px auto;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  font-weight: bold;
}

.curso button:hover {
  background: #184bd1;
  transform: scale(1.05);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  padding: 15px;
}

/* Conteúdo do modal */
.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  width: 100%;
  max-width: 600px;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  animation: scaleIn 0.3s ease;
  overflow-y: auto;
  max-height: 90vh;
}

/* Botão fechar */
.fechar {
  position: absolute;
  top: 10px; 
  right: 15px;
  font-size: 26px;
  cursor: pointer;
  color: #444;
  transition: color 0.3s;
}

.fechar:hover {
  color: #d00;
}

/* Detalhes do curso no modal */
.curso-detalhe {
  text-align: center;
}

.curso-detalhe img {
  width: 100%;
  max-width: 400px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto 20px auto;
  display: block;
}

.curso-detalhe h2 {
  margin-bottom: 10px;
  color: #222;
  font-size: 1.6rem;
}

.curso-detalhe p {
  color: #555;
  line-height: 1.6;
}

.curso-detalhe h4 {
  margin-top: 20px;
  color: #333;
  font-size: 1.1rem;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
  .cursos {
    padding: 40px 15px;
  }

  .curso {
    max-width: 90%;
  }

  .curso img {
    aspect-ratio: 16 / 10;
  }

  .modal-content {
    max-width: 90%;
    padding: 20px;
  }

  .curso-detalhe img {
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .cursos h2 {
    font-size: 1.6rem;
  }

  .curso h3 {
    font-size: 1rem;
  }

  .curso img {
    aspect-ratio: 4 / 3; /* melhor visual em celulares estreitos */
  }

  .modal-content {
    padding: 15px;
  }

  .curso-detalhe img {
    max-width: 250px;
  }
}
