/* ---------- BASE GENERAL ---------- */
body {
  font-family: "Arial", sans-serif;
  margin: 0;
  background: #f4f9f3; /* verde pastel muy claro */
  color: #2e3d2f;      /* verde oscuro natural */
  line-height: 1.5;
}

/* ---------- HEADER ---------- */
header {
  background: linear-gradient(180deg, #a8e6cf, #dcedc1);
  padding-bottom: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header img {
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  max-width: 100%;
  height: auto;
}

/* ---------- MENÚ ---------- */
nav ul.menu {
  list-style: none;
  display: flex;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: #009688; /* verde turquesa tropical */
  border-top: 2px solid #00796b;
  border-bottom: 2px solid #80cbc4;
}

nav ul.menu li {
  margin: 0 6px;
}

nav ul.menu li a {
  color: #ffffff;
  font-weight: bold;
  text-decoration: none;
  padding: 10px 16px;
  display: block;
  border-radius: 20px;
  transition: all 0.3s ease;
}

nav ul.menu li a:hover {
  background: #4db6ac;
  color: #00332e;
}

/* ---------- CONTENIDO PRINCIPAL ---------- */
main {
  padding: 25px;
  max-width: 1024px;
  margin: auto;
}

/* ---------- FOOTER ---------- */
footer {
  text-align: center;
  padding: 15px;
  background: #80cbc4;
  color: #00251a;
  font-size: 0.9em;
  border-top: 2px solid #004d40;
}

/* ---------- GALERÍA DE ESPECIES ---------- */
.galeria-justificada {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 1024px;
  margin: 0 auto;
}

.galeria-justificada .item {
  flex: 1 1 200px; /* 🔹 autoajustable según ancho disponible */
  max-width: 220px;
  text-align: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.galeria-justificada .item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.galeria-justificada img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ---------- RESPONSIVE GALERÍA ---------- */
@media (max-width: 1024px) {
  .galeria-justificada .item {
    flex: 1 1 30%;
  }
}
@media (max-width: 768px) {
  .galeria-justificada .item {
    flex: 1 1 45%;
  }
}
@media (max-width: 480px) {
  .galeria-justificada .item {
    flex: 1 1 90%;
  }
}

/* ---------- LISTA FAMILIAS ---------- */
.lista-familias {
  list-style: none;
  padding: 0;
  background: #ffffffb3;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.lista-familias li {
  padding: 10px;
  border-bottom: 1px solid #b2dfdb;
}

.lista-familias li:hover {
  background: #e0f7fa;
}

.contador {
  color: #004d40;
  font-size: 0.9em;
}

/* ---------- FICHA DE AVE ---------- */
.tabla-ficha {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tabla-ficha td {
  padding: 10px;
  border-bottom: 1px solid #b2dfdb;
  vertical-align: top;
}

.tabla-ficha b {
  color: #00796b;
}


/* ---------- VIDEOS ---------- */
.video-item {
  display: inline-block;
  margin: 10px;
  text-align: center;
}

.video-item iframe {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border: 2px solid #a8e6cf;
}

.video-item small {
  color: #004d40;
}

/* ---------- COMPARACIÓN ---------- */
.comparacion {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.comparacion .col img {
  max-width: 300px;
  border-radius: 10px;
  border: 3px solid #80cbc4;
}

/* ---------- ESTADÍSTICAS ---------- */
.estadisticas ul {
  list-style: none;
  padding: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden;
}

.estadisticas li {
  padding: 10px 15px;
  border-bottom: 1px solid #b2dfdb;
}

.estadisticas li:last-child {
  border-bottom: none;
}

.estadisticas li b {
  color: #004d40;
}

.canto {
  background: #f9fff7;
  border: 2px solid #a8e6cf;
  border-radius: 10px;
  padding: 10px 15px;
  margin: 15px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.canto h3 {
  margin-top: 0;
  color: #004d40;
}

.sin-canto {
  color: #555;
  font-style: italic;
}

/* ---------- MODAL DE IMAGEN ---------- */
.modal-foto {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.85);
}

.modal-foto img {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  border-radius: 10px;
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
  animation: zoomIn 0.3s ease;
}

.modal-foto .cerrar {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
}

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- FAMILIAS GRID ---------- */
.familias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* hasta 3 columnas */
  gap: 12px;
  margin: 20px 0;
}

.familia-item {
  background: #ffffffb3;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.familia-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  background: #f0fff7;
}

.familia-item a {
  text-decoration: none;
  font-weight: bold;
  color: #004d40;
}

.familia-item a:hover {
  color: #00796b;
}

.familia-item .contador {
  font-size: 0.9em;
  color: #33691e;
}


/* ---------- 📱 RESPONSIVE GLOBAL ---------- */

/* 🔸 Ajustes para tablets (<=1024px) */
@media (max-width: 1024px) {
  main {
    padding: 15px;
  }

  nav ul.menu {
    flex-wrap: wrap;
  }

  nav ul.menu li a {
    padding: 8px 12px;
    font-size: 0.95em;
  }

  .galeria-justificada {
    gap: 10px;
  }

  .familias-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

/* 🔸 Ajustes para móviles medianos (<=768px) */
@media (max-width: 768px) {
  header img {
    max-width: 95%;
  }

  nav ul.menu {
    flex-direction: column;
    align-items: center;
  }

  nav ul.menu li {
    margin: 4px 0;
  }

  main {
    padding: 10px;
  }

  .galeria-justificada .item {
    flex: 1 1 45%;
    max-width: 45%;
  }

  .familias-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
  }

  .familia-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .familia-item a {
    font-size: 1em;
  }

  .familia-item .contador {
    margin-top: 4px;
  }

  footer {
    font-size: 0.85em;
    padding: 12px;
  }
}

/* 🔸 Ajustes para móviles pequeños (<=480px) */
@media (max-width: 480px) {
  body {
    font-size: 0.95em;
  }

  nav ul.menu li a {
    padding: 8px 10px;
    font-size: 0.9em;
  }

  .galeria-justificada .item {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .familias-grid {
    grid-template-columns: 1fr; /* 🔹 una sola columna */
  }

  .familia-item {
    font-size: 0.95em;
    padding: 10px 12px;
  }

  h2 {
    font-size: 1.2em;
    text-align: center;
  }

  footer {
    padding: 10px;
  }
}

/* ---------- MENSAJES DE RESULTADOS ---------- */
.msg-resultados, .msg-sinresultados {
  background: #ffffffcc;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0 20px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
}

.msg-resultados {
  color: #004d40;
  font-weight: bold;
}

.msg-sinresultados {
  color: #c62828;
  font-style: italic;
}

nav ul.menu li a:hover,
nav ul.menu li a.active {
  background: #4db6ac;
  color: #00332e;
}
