/* ===== VARIABLES GLOBALES ===== */
:root {
  --color-bg: #f5f7fa;
  --color-primary: #0e152d;
  --color-secondary: #f9a8d4;
  --color-text: #333;
  --color-card: #ffffff;
  --color-muted: #777;

  --radius: 15px;
  --shadow: 0 5px 15px rgba(0,0,0,0.1);
  --transition: 0.3s ease;
}

/* ===== RESET ===== */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ===== HEADER Y ESTADÍSTICAS ===== */
header {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
}

header h1 {
  margin: 0;
}

header p {
  opacity: 0.9;
  margin-bottom: 20px;
}

.stats-dashboard {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: var(--radius);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.3);
  min-width: 120px;
}

.stat-box span {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
}

.stat-box strong {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* ===== CONTROLES (Buscador y Filtros) ===== */
.control-bar {
  max-width: 1200px;
  margin: 20px auto 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.search-box {
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-family: inherit;
  outline: none;
  transition: border var(--transition);
  box-sizing: border-box;
}

.search-box input:focus {
  border-color: var(--color-primary);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.filter-btn {
  background: white;
  border: 1px solid #ddd;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  color: var(--color-muted);
  transition: all var(--transition);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Comportamiento en pantallas más grandes (Tablets y Escritorio) */
@media (min-width: 768px) {
  .control-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
  }

  .search-box {
    width: auto;
  }

  .search-box input {
    min-width: 320px; /* En PC sí le damos un tamaño mínimo para que no se vea enano */
  }

  .filter-buttons {
    justify-content: flex-end;
  }
}

/* ===== SECCIONES ===== */
section {
  padding: 20px 30px;
  max-width: 1200px;
  margin: 0 auto;
}

h2 {
  border-left: 5px solid var(--color-primary);
  padding-left: 10px;
  color: var(--color-text);
}

/* ===== GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

/* ===== CARD ===== */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeIn 0.4s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.card-img-container {
  position: relative;
  height: 200px;
}

.card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Etiquetas (Badges) */
.badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.badge.macho { background: rgba(107, 140, 255, 0.9); /* Usa tu --color-primary */ }
.badge.hembra { background: rgba(249, 168, 212, 0.9); /* Usa tu --color-secondary */ }

.card-content {
  padding: 15px;
}

.card-content h3 {
  margin: 0 0 5px 0;
}

.card-content .breed {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: bold;
  text-transform: uppercase;
  margin: 0 0 8px 0;
}

.card-content p {
  color: var(--color-muted);
  font-size: 0.9em;
  margin: 0;
}

/* ===== MEMORIAL ===== */
.memorial .card-img-container img {
  filter: grayscale(100%);
  opacity: 0.85;
}

.memorial h3::after {
  content: " 🕊️";
}

/* ===== GALERÍA DE MOMENTOS ===== */
.moments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.moments-grid img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.moments-grid img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

/* ===== MODAL DE IMÁGENES ===== */
.modal {
  display: none; 
  position: fixed; 
  z-index: 1000; 
  padding-top: 0; 
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.8); 
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: zoomIn 0.25s ease;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.modal-close:hover {
  color: #bbb;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 20px;
  color: var(--color-muted);
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
  from {opacity: 0; transform: scale(0.95);}
  to {opacity: 1; transform: scale(1);}
}