/* Custom styles for PHP version */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 2s linear infinite;
}

.generator-button {
  background-color: #1A1F2C;
  color: #FFFFFF;
  font-weight: bold;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.generator-button:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.generator-button:focus {
  outline: none;
  ring: 2px;
  ring-color: #A78BFA;
  ring-opacity: 0.5;
}

/* Prevent layout shifts */
img {
  height: auto;
  max-width: 100%;
  display: block;
}

/* Ensure images maintain aspect ratio */
img[width][height] {
  aspect-ratio: attr(width) / attr(height);
}

/* Reserve space for dynamic content */
#animals-container {
  min-height: 224px;
  contain: layout style paint;
}

/* Prevent shifts from dynamic content */
.dynamic-content {
  min-height: 50px;
  contain: layout;
}

/* Reserve space for animal cards */
[data-animal-card] {
  min-height: 500px;
  contain: layout style paint;
}

.loading-container {
  contain: layout style paint;
}

.dynamic-content {
  min-height: 50px;
  contain: layout;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, transparent 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Dropdown Menu Styles */
.dropdown-menu {
  position: relative;
}

.dropdown-content {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
  z-index: 1000;
  pointer-events: none;
  /* Add padding to bridge gap between button and dropdown */
  padding-top: 0.5rem;
}

/* Show dropdown on hover - works when hovering over button or dropdown */
.dropdown-menu:hover .dropdown-content,
.dropdown-menu:focus-within .dropdown-content,
.dropdown-content:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Invisible bridge area to make it easier to move mouse to dropdown */
.dropdown-content::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: -1rem;
  right: -1rem;
  height: 0.5rem;
  background: transparent;
}

/* Smooth transitions for dropdown items */
.dropdown-content a {
  display: block;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.dropdown-content a:hover {
  background-color: #f3f4f6;
  color: #2DD4BF;
}

/* Ensure dropdown container is clickable */
.dropdown-content>div {
  pointer-events: auto;
  cursor: default;
}

/* Image Zoom Modal Styles */
.image-zoom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-zoom-modal.active {
  display: flex;
  opacity: 1;
}

.image-zoom-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.image-zoom-modal img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.image-zoom-modal-title {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  margin-top: 1rem;
  text-align: center;
  padding: 0 1rem;
}

.image-zoom-modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
  z-index: 10000;
}

.image-zoom-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.image-zoom-modal-close:active {
  background: rgba(255, 255, 255, 0.3);
}

/* Make images clickable */
.image-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.image-clickable:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Prevent text selection on clickable images */
.image-clickable {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}