/* ── PDF Drive Grid ────────────────────────────────────────────────── */

#pdf-drive-grid-root {
  width: 100%;
}

/* Loading / error messages */
.pdf-grid-message {
  padding: 2rem;
  text-align: center;
  color: #555;
  font-size: 1rem;
}
.pdf-grid-message.error {
  color: #c0392b;
}

/* ── Grid ───────────────────────────────────────────────────────────── */

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  margin: 0 0 2rem;
}

@media (max-width: 768px) {
  .pdf-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .pdf-grid {
    grid-template-columns: 2fr;
  }
}

/* ── Card ───────────────────────────────────────────────────────────── */

.pdf-card {
  position: relative;
  aspect-ratio: 8.5 / 11;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pdf-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.pdf-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hover overlay */
.pdf-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.pdf-card-overlay .view-label {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pdf-card-overlay .view-icon {
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

/* Card title below thumbnail */
.pdf-card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid #ddd;
}

/* No-thumbnail placeholder */
.pdf-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eaeaea;
  color: #999;
  font-size: 3rem;
}

/* ── Pagination ─────────────────────────────────────────────────────── */

.pdf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.pdf-pagination button {
  padding: 6px 14px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.pdf-pagination button:hover {
  background: #f0f0f0;
}

.pdf-pagination button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.pdf-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Modal ──────────────────────────────────────────────────────────── */

#pdf-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

#pdf-modal-backdrop.hidden {
  display: none;
}

#pdf-modal {
  position: relative;
  z-index: 99999;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  width: min(90vw, 900px);
  height: min(90vh, 1100px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
  flex-shrink: 0;
}

#pdf-modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 48px);
}

#pdf-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  color: #555;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s;
}

#pdf-modal-close:hover {
  background: #eee;
  color: #000;
}

#pdf-modal-iframe {
  flex: 1;
  width: 100%;
  border: none;
}
