/* components/pdf-card.css */
pdf-card {
  display: inline-block;
  width: 100%;
  margin-bottom: 16px;
  break-inside: avoid;
  position: relative;
  z-index: 1;
}

pdf-card.expanded {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: auto;
  max-width: calc(90vw - 20px);
  max-height: 90vh;
  z-index: 1000 !important;
  margin: 0;
  animation: expandIn 0.3s ease-out;
}

@keyframes expandIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Backdrop for expanded state */
pdf-card.expanded::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: -1;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  pdf-card {
    margin-bottom: 36px;
  }
}

pdf-card .card {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  width: 100%;
}

pdf-card .card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
}

pdf-card.expanded .card {
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  height: auto;
  max-height: 90vh;
  width: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}

pdf-card .pdf-container {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  aspect-ratio: 210 / 297; /* A4 aspect ratio */
}

pdf-card .pdf-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

pdf-card .pdf-icon {
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

pdf-card .pdf-icon svg {
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

pdf-card .page-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

pdf-card .info {
  padding: 12px 16px;
  flex: 0 0 auto;
  transition: padding 0.3s;
  background: var(--card-bg);
}

pdf-card.expanded .info {
  padding: 16px 20px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  width: 100%;
  box-sizing: border-box;
}

pdf-card .type-badge {
  display: inline-block;
  background: rgba(230, 126, 34, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
}

pdf-card .title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: font-size 0.3s;
}

pdf-card.expanded .title {
  font-size: 16px;
  white-space: normal;
}

pdf-card .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: font-size 0.3s;
}

pdf-card.expanded .subtitle {
  font-size: 14px;
  white-space: normal;
  line-height: 1.5;
  max-height: none;
}

/* Drag and drop styles */
pdf-card.drag-over .card {
  border: 3px solid var(--accent-color);
  box-shadow: 0 0 20px rgba(52, 152, 219, 0.4);
  transform: translateY(-4px) scale(1.02);
}

pdf-card.link-created .card {
  animation: linkCreated 1s ease-out;
}

@keyframes linkCreated {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(46, 204, 113, 0.4);
    border-color: #2ecc71;
  }
  100% {
    box-shadow: var(--shadow-md);
  }
}

pdf-card.dragging {
  opacity: 0.7;
  pointer-events: none;
}
