/* Skeleton loaders for dynamically loaded tour content.
 *
 * Used by assets/js/components/skeleton-loader.js for:
 *  - OVA BRW tour search results (grid + list) on the tour-list page
 *  - the [destinations-cat] widget cards
 *
 * All classes are uniquely prefixed (.travel-path-child-skeleton*) and no
 * global element selectors are used. Logical properties keep RTL correct.
 */

/* ---------------------------------------------------------------- base -- */

.travel-path-child-skeleton {
  display: block;
  position: relative;
  background-color: #e9ebee;
  background-image: linear-gradient(90deg, #e9ebee 25%, #f6f7f8 37%, #e9ebee 63%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: travel-path-skeleton-shimmer 1.4s ease infinite;
}

@keyframes travel-path-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .travel-path-child-skeleton {
    animation: none;
  }
}

/* Visually hidden live-region text for screen readers */
.travel-path-child-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Generic pieces */
.travel-path-child-skeleton-line {
  height: 12px;
}

.travel-path-child-skeleton-line--20 { width: 20%; }
.travel-path-child-skeleton-line--30 { width: 30%; }
.travel-path-child-skeleton-line--45 { width: 45%; }
.travel-path-child-skeleton-line--60 { width: 60%; }
.travel-path-child-skeleton-line--85 { width: 85%; }

.travel-path-child-skeleton-button {
  width: 110px;
  height: 42px;
  border-radius: 10px;
  flex: 0 0 auto;
}

.travel-path-child-skeleton-price {
  width: 84px;
  height: 18px;
}

/* ------------------------------------------- tour GRID card skeleton -- */
/* The skeleton grid is inserted inside a wrapper that reuses the REAL
   result classes (.ovabrw-products-result.ovabrw-products-result-grid
   .column4), so columns, gaps and breakpoints match the live grid 1:1. */

.travel-path-child-skeleton-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.travel-path-child-skeleton-card .travel-path-child-skeleton-media {
  position: relative;
}

.travel-path-child-skeleton-card .travel-path-child-skeleton-image {
  width: 100%;
  aspect-ratio: 278 / 226; /* same ratio as the real card thumbnail */
  border-radius: 0;
}

/* wishlist-circle placeholder over the image */
.travel-path-child-skeleton-card .travel-path-child-skeleton-circle {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  animation: none;
}

/* badge placeholder over the image (featured badge position) */
.travel-path-child-skeleton-card .travel-path-child-skeleton-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 72px;
  height: 24px;
  border-radius: 6px;
}

.travel-path-child-skeleton-card .travel-path-child-skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  padding: 16px 18px 18px;
}

.travel-path-child-skeleton-card .travel-path-child-skeleton-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #eef0f2;
}

/* ------------------------------------------- tour LIST row skeleton -- */

.travel-path-child-skeleton-row {
  display: grid;
  grid-template-columns: minmax(220px, 395px) 1fr;
  gap: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  margin-bottom: 24px;
}

.travel-path-child-skeleton-row .travel-path-child-skeleton-image {
  width: 100%;
  height: 100%;
  min-height: 230px;
  aspect-ratio: 395 / 230;
  border-radius: 0;
}

.travel-path-child-skeleton-row .travel-path-child-skeleton-row-body {
  display: flex;
  gap: 24px;
  padding-block: 20px;
  padding-inline-end: 20px;
}

.travel-path-child-skeleton-row .travel-path-child-skeleton-row-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.travel-path-child-skeleton-row .travel-path-child-skeleton-row-side {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.travel-path-child-skeleton-row .travel-path-child-skeleton-row-side .travel-path-child-skeleton-button {
  margin-top: auto;
}

@media (max-width: 991px) {
  .travel-path-child-skeleton-row {
    grid-template-columns: 1fr;
  }

  .travel-path-child-skeleton-row .travel-path-child-skeleton-image {
    min-height: 0;
  }

  .travel-path-child-skeleton-row .travel-path-child-skeleton-row-body {
    padding-inline-start: 20px;
    flex-direction: column;
  }

  .travel-path-child-skeleton-row .travel-path-child-skeleton-row-side {
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .travel-path-child-skeleton-row .travel-path-child-skeleton-row-side .travel-path-child-skeleton-button {
    margin-top: 0;
  }
}

/* ------------------------------------- destination card skeleton -- */
/* Reuses the real .destination-card class for exact size/breakpoints;
   these pieces recreate the image, overlay and top pill placeholders. */

.travel-path-child-skeleton-dest .travel-path-child-skeleton-image {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: 20px;
}

.travel-path-child-skeleton-dest .travel-path-child-skeleton-overlay {
  position: absolute;
  bottom: 22px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: 85%;
  min-height: 58px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.83);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
}

[dir="rtl"] .travel-path-child-skeleton-dest .travel-path-child-skeleton-overlay {
  transform: translateX(50%);
}

.travel-path-child-skeleton-dest .travel-path-child-skeleton-pill {
  position: absolute;
  top: 20px;
  inset-inline-end: 20px;
  width: 96px;
  height: 38px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.85);
  animation: none;
}

/* ------------------------------------------ blog card skeleton -- */
/* Reuses the real .blog-post class (column card, widget-specific width);
   these pieces mirror the image, title and date/views meta row. */

.travel-path-child-skeleton-blog {
  gap: 12px;
}

.travel-path-child-skeleton-blog .travel-path-child-skeleton-image {
  width: 100%;
  height: 300px; /* same as the real .blog-post img */
  border-radius: 12px;
}

.travel-path-child-skeleton-blog .travel-path-child-skeleton-blog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #e6e8ec;
  padding-block: 12px;
  margin-top: 18px;
}

.travel-path-child-skeleton-blog .travel-path-child-skeleton-blog-meta .travel-path-child-skeleton-line {
  flex: 0 0 auto;
  width: 80px;
}

/* category chips row placeholder */
.travel-path-child-skeleton-chip {
  display: inline-block;
  width: 120px;
  height: 34px;
  border-radius: 45px;
  margin-block-end: 6px;
}

/* ------------------------------------------------------ error state -- */

.travel-path-child-skeleton-error {
  width: 100%;
  text-align: center;
  background: #fff;
  border: 1px solid #eef0f2;
  border-radius: 16px;
  padding: 40px 20px;
}

.travel-path-child-skeleton-error p {
  margin: 0 0 16px;
  color: #23262f;
  font-size: 15px;
}

.travel-path-child-skeleton-error .travel-path-child-skeleton-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 24px;
  border: none;
  border-radius: 10px;
  background: var(--color-primary, #c94a30);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.travel-path-child-skeleton-error .travel-path-child-skeleton-retry:hover {
  background: var(--color-primary-hover, #b84329);
}

.travel-path-child-skeleton-error .travel-path-child-skeleton-retry:focus-visible {
  outline: 2px solid var(--color-secondary, #007fad);
  outline-offset: 2px;
}

/* ------------------------------------------------- plugin integration -- */

/* Hide OVA BRW's circular loader inside the search-ajax widget: the
   skeleton fully replaces it there. !important is required because the
   plugin JS shows it with an inline style (.show() => display:block),
   which no selector specificity can override. */
.ovabrw-search-ajax .wrap-search-ajax .wrap-load-more {
  display: none !important;
}

/* While a search request is running, lock the controls that would fire
   duplicate requests (sort, pagination, layout switch). The filter form
   itself stays usable. */
.wrap-search-ajax.travel-path-child-loading .filter-layout,
.wrap-search-ajax.travel-path-child-loading .input_select_list,
.wrap-search-ajax.travel-path-child-loading .ovabrw-pagination-ajax {
  pointer-events: none;
  opacity: 0.55;
}
