/* Masonry grid for Pexels images */
.pexels-results {
  column-count: 1;
  column-gap: 1rem;
  /* Masonry grid using CSS columns */
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .pexels-results {
    column-count: 2;
  }
}
@media (min-width: 900px) {
  .pexels-results {
    column-count: 3;
  }
}
@media (min-width: 1200px) {
  .pexels-results {
    column-count: 4;
  }
}
@media (min-width: 1500px) {
  .pexels-results {
    column-count: 5;
  }
}
.pexels-image-item-masonry {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  background: #f3f4f6; /* light gray */
  border-radius: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  position: relative;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  -moz-column-break-inside: avoid;
  page-break-inside: avoid;
  aspect-ratio: 1/1.2;
}
.pexels-filter-color,
.pexels-filter-orientation,
.pexels-search-input {
  margin-top: 0px !important;
}
.pexels-image-wrapper {
  position: relative;
  width: 100%;
}
.pexels-img-thumb {
  width: 100%;
  height: 100%;
  max-height: 500px;
  display: block;
  margin: 0;
  cursor: pointer;
  object-fit: cover;
}
.pexels-button-wrapper {
  position: absolute;
  display: flex;
  width: 100%;
  bottom: 0px;
}
.pexels-image-caption-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  padding: 6px 10px;
  text-align: left;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  z-index: 2;
}
.pexels-image-caption-bottom {
  font-size: 13px;
  color: #374151;
  width: 100%;
  padding: 6px 10px 8px 10px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
  background: #f9fafb;
  border-top: 1px solid #f1f1f1;
}
.pexels-download-btn,
.pexels-external-btn {
  position: absolute;
  bottom: 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  width: 50%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 3;
  opacity: 0.92;
  transition:
    background 0.2s,
    opacity 0.2s;
  cursor: pointer;
  padding: 0;
}
.pexels-download-btn {
  left: 0;
  background: #2563eb;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.pexels-external-btn {
  right: 0;
  background: #10b981;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
}
.pexels-external-btn:hover {
  background: #059669;
  opacity: 1;
}
/* Pexels Tab Custom CSS (replaces Tailwind) */
.pexels-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  background: #f8f8f8;
}
.pexels-toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.pexels-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pexels-label {
  margin-right: 0.75rem;
  font-size: 14px;
}
.pexels-search-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  width: 220px;
}
.pexels-search-btn {
  padding: 6px 18px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.pexels-search-btn:hover {
  background: #1d4ed8;
}
.pexels-results {
  display: grid;
  grid-template-columns: repeat(1, minmax(200px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
  min-height: 200px;
}
@media (min-width: 640px) {
  .pexels-results {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}
@media (min-width: 768px) {
  .pexels-results {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
  }
}
@media (min-width: 1024px) {
  .pexels-results {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
  }
}
@media (min-width: 1280px) {
  .pexels-results {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
  }
}
.pexels-image-item {
  min-width: 200px;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pexels-img-thumb {
  width: 100%;
  height: auto;
  max-height: 500px;
  cursor: pointer;
  display: block;
}
.pexels-image-caption {
  font-size: 0.75rem;
  color: #374151;
  width: 100%;
  padding: 0.25rem 0.5rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
}
/* Pexels Image Grid (Tailwind-like) */
.pexels-results {
  display: grid;
  grid-template-columns: repeat(1, minmax(200px, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) {
  .pexels-results {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}
@media (min-width: 768px) {
  .pexels-results {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
  }
}
@media (min-width: 1024px) {
  .pexels-results {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
  }
}
@media (min-width: 1280px) {
  .pexels-results {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
  }
}
.pexels-results li {
  min-width: 200px;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.pexels-results img {
  min-width: 200px;
  max-width: 100%;
  object-fit: cover;
  cursor: pointer;
}
.pexels-results .text-xs {
  font-size: 0.75rem;
  color: #374151;
  width: 100%;
  padding: 0.25rem 0.5rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
/* Online Image Tab Styling */
.media-frame .media-router .media-menu-item.online-image-tab {
  position: relative;
  margin: 0;
  padding: 8px 10px 8px 15px;
  font-size: 14px;
  line-height: 1.4;
  color: #666;
  text-decoration: none;
  transition: none;
}

.media-frame .media-router .media-menu-item.online-image-tab:hover {
  color: #2e2e2e;
  background: #f5f5f5;
}

.media-frame .media-router .media-menu-item.online-image-tab.active {
  color: #1d2327;
  font-weight: 600;
  background: #f5f5f5;
}

/* Online Image Content Area */
.online-image-content {
  padding: 20px;
  background: #fff;
}

.online-image-content p {
  margin: 0 0 15px;
  font-size: 14px;
  color: #555;
}

.online-image-content .url-input {
  width: 100%;
  margin-bottom: 15px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.online-image-content .button {
  margin-right: 10px;
}
/* Pagination Styles */
.pexels-pagination-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}
.pexels-pagination-prev,
.pexels-pagination-next {
  padding: 6px 18px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.pexels-pagination-prev:hover,
.pexels-pagination-next:hover {
  background: #1d4ed8;
}
.pexels-pagination-info {
  font-size: 14px;
  color: #374151;
  margin: 0 8px;
}

.media-modal:not(.alphablock-image-selected) .media-menu-item[href*="alpha_search_image"],
.media-modal:not(.alphablock-image-selected) .media-frame-content[data-id="alpha_search_image"] {
  display: none;
}