/* PDF Gallery Styles */
.pdf-gallery-section {
  --pdf-thumb-width: 200px;
  --pdf-thumb-height: 283px; /* A4 aspect ratio */
}

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pdf-thumb-width), 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.pdf-item {
  position: relative;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pdf-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.pdf-thumbnail {
  width: 100%;
  height: var(--pdf-thumb-height);
  background: #f5f5f5;
  position: relative;
  overflow: hidden;
}

.pdf-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pdf-item:hover .pdf-thumbnail img {
  transform: scale(1.05);
}

.pdf-info {
  padding: 1rem;
}

.pdf-title {
  font-size: 1rem;
  margin: 0;
  line-height: 1.4;
  min-height: 2.8em; /* Allow for 2 lines */
  word-wrap: break-word;
  word-break: break-all; /* Force break even without spaces */
  white-space: normal; /* Allow text to wrap */
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Remove meta section styles since we're not using dates */
.pdf-meta {
  display: none;
}

/* Loading States */
.pdf-thumbnail.loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* Gallery Controls */
.gallery-controls {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
}

.gallery-controls .form-control,
.gallery-controls .form-select {
  border-color: #dee2e6;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .pdf-gallery-section {
    --pdf-thumb-width: 160px;
    --pdf-thumb-height: 226px;
  }

  .gallery-controls .col-md-6:not(:first-child) {
    margin-top: 1rem;
  }
}
