/* General styles for WeTravel Widgets plugin */

.wp-block-wetravel-trips-block {
  margin-bottom: 30px;
  position: relative;
  min-height: 200px;
}

a {
  text-decoration: none !important;
}

/* Trip item shared styles */
.trip-item {
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  padding: 16px;
  gap: 16px;
  border-radius: var(--border-radius, 6px);
  background-color: #fff;
  box-shadow: 0px 4px 4px 0px #aeaeae40;
  overflow: hidden;
  transition: transform 0.6s ease, box-shadow 0.6s ease;
  height: 100%;
}

.trip-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.trip-item h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 24px;
  color: #333;
  line-height: 1.3;
}

.trip-content {
  height: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-wrap: anywhere;
  gap: 16px;
}

.trip-description {
  color: #475569;
  max-height: 100px; /* Limit height */
  font-weight: 400;
  font-size: 16px;
  overflow: hidden;
  position: relative;
}

/* Add a new class for the fade effect that we'll apply conditionally */
.trip-description.needs-fade:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 30px; /* Height of fade effect */
  width: 100%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 1)
  ); /* Transparent to white fade */
  pointer-events: none; /* Makes sure the fade doesn't interfere with clicks */
}

.trip-loc-duration {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-weight: 500;
  font-size: 14px;
  line-height: 100%;
  letter-spacing: 0%;
  vertical-align: middle;
  flex-wrap: wrap;
}

.trip-loc-price {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.trip-tag {
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
}

.trip-price {
  font-size: 16px;
  color: #333;
}

.trip-price p {
  margin: 0;
  color: #64748b;
  line-height: 1;
}

.trip-price span {
  font-size: 20px;
  font-weight: 600;
  text-align: right;
  line-height: 1;
}

/* Button styling */
.trip-item .trip-button {
  background-color: var(--button-color);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--border-radius, 6px);
  border: 1px solid var(--button-color);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  width: auto;
  transition: background-color 0.3s ease;
  font-weight: 500;
  font-size: 18px;
  cursor: pointer;
}

.trip-item .trip-button:hover {
  opacity: 0.9;
}

.trip-image {
  min-width: 200px;
  align-self: normal;
  max-height: 200px;
  position: relative;
}

.trip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 200px;
}

.trip-button-container {
  margin-top: auto;
  width: 100%;
}

.trip-price-button {
  direction: rtl;
}

/* Placeholder for missing images */
.no-image-placeholder {
  height: 180px;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  border-radius: 12px;
  font-size: 14px;
}

.wetravel-trips-container {
  margin: 0px 20px;
}

/* Grid view styles */
.wetravel-trips-container.grid-view {
  display: grid !important;
  grid-template-columns: repeat(var(--items-per-row), 1fr);
  gap: 15px;
}

.wetravel-trips-container.grid-view .trip-item {
  display: flex;
  flex-direction: column;
  gap: 24px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wetravel-trips-container.grid-view .trip-item:hover,
.wetravel-trips-container.carousel-view .trip-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.wetravel-trips-container.grid-view .trip-item img {
  max-height: 200px;
}

.wetravel-trips-container.grid-view .wetravel-trips-loading {
  grid-column: 1 / -1; /* Span across all columns */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}

.wetravel-trips-container.grid-view .trip-button,
.wetravel-trips-container.carousel-view .trip-button {
  width: 100%;
  background-color: unset;
  color: var(--button-color);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  cursor: pointer;
}

.wetravel-trips-container.grid-view .trip-price-button {
  direction: ltr;
  display: flex;
  flex-direction: row;
  gap: 30px;
  justify-content: space-between;
  align-items: end;
}

/* Vertical view styles */
.wetravel-trips-container.vertical-view .trip-item {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 3fr 6fr 2fr;
  align-items: start;
  box-sizing: content-box;
}

.wetravel-trips-container.vertical-view .trip-button {
  min-width: 100px;
  align-self: flex-start;
}

.wetravel-trips-container.vertical-view .trip-price span {
  font-size: 24px;
}

.wetravel-trips-container.vertical-view .trip-price-button {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.wetravel-trips-container.vertical-view h3 {
  font-size: 24px;
  margin-top: 0;
  margin-bottom: 10px;
}

/* Style for swiper carousel */
.wetravel-trips-container.carousel-view {
  margin: 0;
}

/* Carousel view styles */
.wetravel-trips-container.carousel-view .swiper-container-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.wetravel-trips-container.carousel-view .swiper {
  flex: 1;
  width: 100%;
  padding: 0px 15px 30px;
}

.wetravel-trips-container.carousel-view .swiper-wrapper {
  align-items: stretch;
}

.wetravel-trips-container.carousel-view .swiper-slide {
  height: auto;
}

.wetravel-trips-container.carousel-view .swiper-button-next,
.wetravel-trips-container.carousel-view .swiper-button-prev {
  position: static;
  margin: 0;
  width: 40px;
  height: 40px;
  background-color: var(--button-color);
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.wetravel-trips-container.carousel-view .swiper-button-next:hover,
.wetravel-trips-container.carousel-view .swiper-button-prev:hover {
  background-color: var(--button-color);
  opacity: 0.8;
  transform: scale(1.1);
}

/* Style the arrow icons */
.wetravel-trips-container.carousel-view .swiper-button-next::after,
.wetravel-trips-container.carousel-view .swiper-button-prev::after {
  font-size: 18px;
  font-weight: 600;
}

/* Style pagination dots */
.wetravel-trips-container.carousel-view .swiper-pagination {
  position: relative;
  margin-top: 20px;
}

.wetravel-trips-container.carousel-view .swiper-pagination-bullet {
  width: 12px;
  height: 12px;
  margin: 0 5px;
}

.wetravel-trips-container.carousel-view .swiper-pagination-bullet-active {
  background-color: var(--button-color);
}

/* Style for trip cards */
.wetravel-trips-container.carousel-view .trip-item {
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 24px;
  cursor: pointer;
  margin: 10px 0; /* Add margin to create space for hover effect */
}

.wetravel-trips-container.carousel-view .trip-item *,
.wetravel-trips-container.grid-view .trip-item * {
  pointer-events: none;
}

.wetravel-trips-container.carousel-view .trip-item,
.wetravel-trips-container.grid-view .trip-item {
  pointer-events: auto;
}

.wetravel-trips-container.grid-view .trip-item a {
  pointer-events: auto;
}

/* Pagination Styles */
.wetravel-trips-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  flex-wrap: wrap;
}

.wetravel-trips-pagination .page-item {
  margin: 0 3px;
}

.wetravel-trips-pagination .page-link {
  display: inline-block;
  padding: 8px 12px;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.wetravel-trips-pagination .page-link:hover {
  background-color: #f5f5f5;
}

.wetravel-trips-pagination .page-item.active .page-link {
  background-color: var(--button-color);
  color: #fff;
  border-color: var(--button-color);
}

.wetravel-trips-pagination .page-item.disabled .page-link {
  color: #999;
  pointer-events: none;
  cursor: default;
}

/* Visibility Classes for Pagination */
.visible-item {
  display: block;
}

.hidden-item {
  display: none;
}

/* No trips message */
.no-trips {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 16px;
  font-style: italic;
  grid-column: 1 / -1; /* Make it span all columns in grid view */
  background-color: #fff;
  border-radius: 8px;
  margin: 20px 0;
}

/* Handle responsive layout */

@media screen and (max-width: 960px) {
  .wetravel-trips-container.grid-view {
    grid-template-columns: repeat(2, 1fr);
  }

  .wetravel-trips-container.carousel-view .swiper-container-wrapper {
    gap: 15px;
  }

  .wetravel-trips-container.carousel-view .swiper-button-next,
  .wetravel-trips-container.carousel-view .swiper-button-prev {
    width: 45px;
    height: 45px;
  }
}

@media screen and (max-width: 640px) {
  .wetravel-trips-container.vertical-view .trip-item {
    grid-template-columns: 1fr;
  }

  .wetravel-trips-container.vertical-view .trip-price {
    margin-bottom: 0;
  }

  .wetravel-trips-pagination .page-link {
    padding: 6px 10px;
    font-size: 14px;
  }

  .wetravel-trips-container.grid-view {
    grid-template-columns: 1fr;
  }

  .trip-image {
    min-width: 100px;
    height: auto;
  }

  .trip-item img {
    max-height: 100px;
  }

  .wetravel-trips-container.carousel-view .swiper-container-wrapper {
    gap: 10px;
  }

  .wetravel-trips-container.carousel-view .swiper-button-next,
  .wetravel-trips-container.carousel-view .swiper-button-prev {
    width: 40px;
    height: 40px;
  }

  .wetravel-trips-container.carousel-view .swiper-button-next::after,
  .wetravel-trips-container.carousel-view .swiper-button-prev::after {
    font-size: 16px;
  }

  /* Hide carousel navigation buttons on mobile */
  .wetravel-trips-container.carousel-view .swiper-button-next,
  .wetravel-trips-container.carousel-view .swiper-button-prev {
    display: none !important;
  }

  /* Responsive date overlay for mobile */
  .trip-date-overlay {
    bottom: 6px;
    left: 6px;
    padding: 3px 6px;
    font-size: 12px;
  }
}

@media screen and (max-width: 480px) {
  .wetravel-trips-container.vertical-view .trip-price-button {
    flex-direction: row;
  }
}

/* Add this to your CSS file */
.wetravel-trips-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #33ae3f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Enhanced Search Filter Styles */
.wetravel-trips-search-filter {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.search-filter-container {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

/* Search input wrapper for positioning clear button */
.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 14px 18px;
  padding-right: 40px; /* Make room for clear button */
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--button-color);
  box-shadow: 0 0 0 3px rgba(var(--button-color-rgb), 0.1);
}

/* Clear button styles */
.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.search-clear-btn:hover {
  background-color: #f0f0f0;
  color: #666;
}

.search-clear-btn:focus {
  outline: none;
  background-color: #f0f0f0;
  color: #666;
}

/* Clear All Filters button styles */
.clear-all-filters {
  padding: 14px 20px;
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  white-space: nowrap;
}

.clear-all-filters:hover {
  background: #e9ecef;
  color: #495057;
  border-color: #adb5bd;
}

.clear-all-filters:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.1);
}

/* Custom Location Dropdown */
.location-dropdown {
  min-width: 300px;
  position: relative;
}

.location-button {
  padding: 15px 20px;
  background: var(--button-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity 0.3s ease;
  outline: none;
  position: relative;
}

.location-button:hover {
  opacity: 0.9;
}

.location-button:focus {
  box-shadow: 0 0 0 3px rgba(var(--button-color-rgb), 0.3);
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
  margin-left: 10px;
}

.dropdown-arrow.open {
  transform: rotate(180deg);
}

.selected-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 14px;
  margin-left: 10px;
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  margin-top: 5px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  max-height: 400px;
  overflow: hidden;
}

.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Location Search within Dropdown */
.location-search {
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.location-search input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
  border-radius: 50px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.location-search input:focus {
  border-color: var(--button-color);
  box-shadow: 0 0 0 2px rgba(var(--button-color-rgb), 0.1);
}

/* Location List */
.location-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 5px 0;
}

.location-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.location-item:hover {
  background-color: rgba(var(--button-color-rgb), 0.05);
}

.location-item.selected {
  background-color: rgba(var(--button-color-rgb), 0.1);
  color: var(--button-color);
}

/* Checkmark */
.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--button-color);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  background: transparent;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.checkmark.checked {
  background: var(--button-color);
}

.location-name {
  flex: 1;
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .wetravel-trips-search-filter {
    flex-direction: column;
    gap: 15px;
  }

  .search-filter-container {
    flex-direction: column;
    gap: 15px;
  }

  .location-dropdown {
    min-width: auto;
    width: 100%;
  }

  .location-button {
    width: 100%;
    box-sizing: border-box;
  }

  .search-input-wrapper {
    width: 100%;
  }

  .clear-all-filters {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
}

/* Filter States */
.trip-item.filtered {
  display: none !important;
}

/* Override theme Swiper button styles with unique class */
.wetravel-carousel-wrapper .swiper-button-next,
.wetravel-carousel-wrapper .swiper-button-prev {
  display: flex !important;
  background-color: var(--button-color);
  border: none !important;
  color: #fff !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.wetravel-carousel-wrapper .swiper-button-next::after,
.wetravel-carousel-wrapper .swiper-button-prev::after {
  font-size: 18px !important;
  background: none !important;
  color: #fff !important;
  padding: 0 !important;
  margin: 0 !important;
  font-weight: 600 !important;
  border-radius: 50% !important;
}

/* Date overlay styles for carousel and grid views */
.trip-date-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background-color: #fff;
  color: #64748b;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 100%;
  letter-spacing: 0%;
  vertical-align: middle;
  z-index: 2;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@supports not (font-variation-settings: normal) {
  .trip-description {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
      "Segoe UI Symbol";
  }
}
