/* Gallery Container */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Media Card */
.media-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.04);
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.media-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px -12px rgba(74, 108, 247, 0.15);
}

/* Preview Section */
.media-preview {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio Square */
  overflow: hidden;
  background-color: #f8f9fa;
}

.media-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.media-card:hover .media-preview img {
  transform: scale(1.08); /* Slight zoom on hover */
}

/* Overlay */
.media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-card:hover .media-overlay {
  opacity: 1;
}

.preview-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  transform: scale(0.8);
}

.preview-btn:hover {
  background: white;
  color: var(--primary-color, #4a6cf7);
  transform: scale(1);
}

/* Info Section */
.media-info {
  padding: 20px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex-grow: 1;
  justify-content: space-between;
}

.media-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 0.85rem;
  color: #6c757d;
  background-color: #f8f9fa;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Download Button */
.download-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background-color: var(--primary-color, #4a6cf7);
  color: white;
  text-decoration: none;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(74, 108, 247, 0.25);
}

.download-action-btn:hover {
  background-color: #3b5bdb; /* Slightly darker indigo */
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 108, 247, 0.35);
}

.download-action-btn:active {
  transform: translateY(1px);
}

.download-action-btn i {
  font-size: 1.1rem;
}

/* Single result adjustment for desktop */
@media (min-width: 768px) {
  .media-card:only-child {
    max-width: 550px;
  }
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: 1fr;
    padding: 20px;
  }
}
