/* ---------- BASE GENERAL ---------- */
body {
  font-family: "Arial", sans-serif;
  margin: 0;
  background-color: #f4f9f3;
  background-image: url("/images/fondo_avcr.webp");
  background-repeat: repeat;
  background-position: top left;
  background-attachment: fixed;
  color: #2e3d2f;
  line-height: 1.5;
  background-size: 300px;
}


/* ---------- 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;
  background-color: rgba(255, 255, 255, 0.85); /* blanco translúcido */
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}


/* ---------- 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; }
}

/* ---------- FONDO PARA WEBP EN MODAL ---------- */
.modal-foto img.fondo-blanco {
  background: #ffffff;
  padding: 8px;
  border-radius: 10px;
}

/* Fondo decorativo tipo transparencia */
.modal-foto img.fondo-decorativo {
  background: url("/images/fondo_avcr.webp") repeat center center;
  padding: 8px;
  border-radius: 10px;
  background-size: 300px;
}



/* ---------- 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;
}


.lista-aves {
  list-style: none;
  padding: 0;
}

.lista-aves li {
  margin-bottom: 8px;
  line-height: 1.5em;
}

.link-ave {
  color: #1c5f3e;
  text-decoration: none;
  font-weight: 500;
}

.link-ave:hover {
  text-decoration: underline;
  color: #238552;
}

.btn-eliminar {
  color: #c0392b;
  margin-left: 10px;
  text-decoration: none;
  font-size: 18px;
  vertical-align: middle;
}

.btn-eliminar:hover {
  color: #e74c3c;
}

/* ---------- LOGIN ---------- */
.contenedor-login {
  max-width: 380px;
  margin: 60px auto;
  background: #ffffff;
  padding: 30px 35px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  text-align: center;
  animation: aparecer 0.4s ease;
}

.contenedor-login h2 {
  margin-top: 0;
  color: #004d40;
  font-size: 1.6em;
  margin-bottom: 20px;
}

.contenedor-login label {
  display: block;
  text-align: left;
  color: #004d40;
  font-weight: bold;
  margin-bottom: 4px;
}

.contenedor-login input[type="email"],
.contenedor-login input[type="password"],
.contenedor-login input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #b2dfdb;
  border-radius: 8px;
  font-size: 1em;
  background: #f9fff9;
  box-sizing: border-box;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contenedor-login input[type="email"]:focus,
.contenedor-login input[type="password"]:focus,
.contenedor-login input[type="text"]:focus {
  outline: none;
  border-color: #009688;
  box-shadow: 0 0 5px rgba(0,150,136,0.3);
}


.contenedor-login button {
  background: #009688;
  color: #fff;
  font-size: 1.1em;
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.1s ease;
}

.contenedor-login button:hover {
  background: #00796b;
  transform: translateY(-2px);
}

.contenedor-login button:active {
  transform: translateY(1px);
}

/* ---------- SELECT (menú desplegable bonito) ---------- */
.contenedor-login select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #b2dfdb;
  border-radius: 8px;
  background-color: #f9fff9;
  font-size: 1em;
  color: #004d40;
  appearance: none; /* quita la flecha por defecto */
  background-image: linear-gradient(45deg, transparent 50%, #009688 50%),
                    linear-gradient(135deg, #009688 50%, transparent 50%),
                    linear-gradient(to right, #b2dfdb, #b2dfdb);
  background-position: calc(100% - 20px) calc(1em + 2px),
                       calc(100% - 15px) calc(1em + 2px),
                       calc(100% - 2.5em) 0.5em;
  background-size: 5px 5px, 5px 5px, 1px 1.5em;
  background-repeat: no-repeat;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contenedor-login select:hover {
  border-color: #009688;
}

.contenedor-login select:focus {
  outline: none;
  border-color: #009688;
  box-shadow: 0 0 5px rgba(0,150,136,0.3);
}

/* Opcional: estilos para las opciones */
.contenedor-login select option {
  padding: 8px;
  background-color: #ffffff;
  color: #004d40;
}


/* Mensajes de error */
.mensaje-error {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: #c62828;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 15px;
  font-weight: bold;
}

/* Animación suave */
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-recuperar {
  margin-top: 25px;
  border-top: 1px solid #b2dfdb;
  padding-top: 15px;
}

.form-recuperar input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #b2dfdb;
  border-radius: 8px;
  background: #f9fff9;
  margin-bottom: 10px;
}

.form-recuperar button {
  background: #80cbc4;
  color: #00332e;
  font-size: 0.95em;
  padding: 8px 18px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.form-recuperar button:hover {
  background: #4db6ac;
}

.texto-secundario {
  font-size: 0.9em;
  color: #004d40;
  margin-bottom: 8px;
}

/* mensajes */
.mensaje-exito {
  background: #e0f2f1;
  border: 1px solid #80cbc4;
  color: #00695c;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 15px;
  font-weight: bold;
}

.error {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: #c62828;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 15px;
  font-weight: bold;
}

/* ---------- TABLAS GENERALES ---------- */
.tabla-datos {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  font-size: 0.95em;
}

.tabla-datos th {
  background: linear-gradient(180deg, #80cbc4, #4db6ac);
  color: #00332e;
  padding: 10px 14px;
  text-align: left;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tabla-datos td {
  padding: 10px 14px;
  border-bottom: 1px solid #c8e6c9;
  vertical-align: top;
}

.tabla-datos tr:nth-child(even) {
  background: #f9fff9;
}

.tabla-datos tr:hover {
  background: #e0f7fa;
  transition: background 0.2s ease;
}

.tabla-datos td:last-child {
  text-align: center;
  font-weight: bold;
  color: #004d40;
}

/* 🔹 Contenedor con scroll para tablas anchas */
.tabla-scroll {
  overflow-x: auto;
  margin-bottom: 15px;
}

/* ---------- PAGINACIÓN COMPACTA ---------- */
.paginacion {
  text-align: center;
  margin: 25px 0;
  font-size: 0.95em;
}

.paginacion a,
.paginacion span.dots {
  display: inline-block;
  margin: 0 3px;
  padding: 6px 12px;
  border-radius: 6px;
  background: #a8e6cf;
  color: #004d40;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s ease;
}

.paginacion a:hover {
  background: #80cbc4;
}

.paginacion a.active {
  background: #009688;
  color: #fff;
}

.paginacion span.dots {
  background: transparent;
  color: #004d40;
  padding: 6px 4px;
}

/* ---------- GALERÍA DE FOTOS EN EDICIÓN ---------- */
.galeria-fotos-editar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
  border-top: 1px solid #b2dfdb;
  padding-top: 10px;
}

.foto-item {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.foto-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
}

.foto-item:hover {
  transform: scale(1.05);
}

.foto-item.seleccionada img {
  border-color: #ffc926;
  border-width: 3px;
  box-shadow: 0 0 20px rgba(255, 201, 38, 0.7);
  transform: scale(1.05);
}


  footer {
    background: #f3f8f1;
    text-align: center;
    padding: 20px 10px;
    font-size: 0.95em;
    color: #2e3d2f;
    border-top: 2px solid #d6e4d3;
  }

  footer .creditos-ia {
    max-width: 800px;
    margin: 10px auto;
    font-style: italic;
    font-size: 0.9em;
    line-height: 1.4;
    color: #4c5a4b;
  }

  footer a img {
    margin-top: 10px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
  }

  footer a img:hover {
    opacity: 1;
  }