/* Grid */
.ytpf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.ytpf-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}
.ytpf-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.ytpf-title {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: #222;
}
.ytpf-loadmore {
  margin: 14px auto 0;
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.ytpf-status {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
}

/* Fullscreen modal */
.ytpf-no-scroll {
  overflow: hidden;
}

.ytpf-modal[hidden] { display: none; }

.ytpf-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.ytpf-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.ytpf-modal__dialog {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ytpf-player-wrap {
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.ytpf-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.ytpf-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 28px;
  line-height: 40px;
  cursor: pointer;
}
.ytpf-modal__close:hover {
  background: rgba(0,0,0,0.8);
}

/* Thumbnail wrapper */
.ytpf-thumb {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

/* Image */
.ytpf-thumb img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ytpf-item:hover .ytpf-thumb img {
  transform: scale(1.05);
}

/* Overlay gradient and title */
.ytpf-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5em 1em 1em;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.0));
  text-align: center;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 40%;
  border-radius: 0 0 8px 8px;
}

.ytpf-title {
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.4em 0.8em;
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.2;
  max-width: 90%;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
