/* Before/After Gallery Slider Frontend Styles */

:root {
  --wt-ba-primary: #111827;
  --wt-ba-accent: #e00;
  --wt-ba-handle-color: #ffffff;
  --wt-ba-border-radius: 12px;
  --wt-ba-thumb-radius: 8px;
}

.wt-ba-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  max-height: 540px;
  margin: 0 auto;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
    Cantarell, "Helvetica Neue", sans-serif;
}

.wt-ba-container * {
  box-sizing: border-box;
}

/* Main Gallery Slider Frame */
.wt-ba-main-wrapper {
  width: 100%;
  height: 100%;
}

.wt-ba-slider-box {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--wt-ba-border-radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  user-select: none;
  -webkit-user-select: none;
  background: #f3f4f6;
}

.wt-ba-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  pointer-events: none;
  display: block !important;
}

/* Image container styling for crossfade transitions */
.wt-ba-image-after,
.wt-ba-image-before {
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  opacity: 1;
}

/* Temporary state during image swap to keep it smooth */
.wt-ba-slider-box.wt-ba-transitioning .wt-ba-image-after,
.wt-ba-slider-box.wt-ba-transitioning .wt-ba-image-before {
  opacity: 0.15;
}

.wt-ba-before-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  /* Modern clip-path using CSS custom property updated by JS */
  clip-path: inset(0 calc(100% - var(--clip-pos, 50%)) 0 0);
  will-change: clip-path;
}

/* Labels / Badges */
.wt-ba-badge {
  position: absolute;
  top: 20px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  border-radius: 99999px;
  color: #ffffff;
  z-index: 10;
  pointer-events: none;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  line-height: 1;
}

.wt-ba-badge-before {
  left: 20px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.wt-ba-badge-after {
  right: 20px;
  background: var(--wt-ba-accent);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Slider Handle styling */
.wt-ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--wt-ba-handle-color);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  z-index: 15;
  cursor: ew-resize;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  will-change: left;
}

.wt-ba-handle-line {
  flex-grow: 1;
  width: 2px;
  background: rgba(255, 255, 255, 0.8);
}

.wt-ba-handle-button {
  width: 46px;
  height: 46px;
  background: var(--wt-ba-handle-color);
  color: var(--wt-ba-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: grab;
  transition:
    transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.wt-ba-handle-button:active {
  cursor: grabbing;
}

.wt-ba-handle:hover .wt-ba-handle-button,
.wt-ba-slider-box:active .wt-ba-handle-button {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: var(--wt-ba-accent);
}

.wt-ba-arrows {
  display: block;
  pointer-events: none;
  width: 24px;
  height: 24px;
}

/* Thumbnails Gallery */
.wt-ba-thumbnails-container {
  display: flex;
  flex-direction: column;
  max-height: 548px;
  position: relative;
}

.wt-ba-thumbnails-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding: 4px 4px 4px 0;

  /* Hide scrollbar for standard browsers */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

/* Hide scrollbar for Webkit (Chrome, Safari, Edge) */
.wt-ba-thumbnails-list::-webkit-scrollbar {
  display: none;
}

.wt-ba-thumbnail-item {
  position: relative;
  height: 126px; /* Fits exactly 4 items within 540px height considering 12px gaps (540 - 36) / 4 */
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--wt-ba-thumb-radius);
  overflow: hidden;
  border: 3px solid transparent;
  background-clip: padding-box !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  transition:
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
  background: #111827;
}

.wt-ba-thumbnail-item img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  opacity: 0.7;
  transition:
    opacity 0.25s ease,
    transform 0.3s ease;
}

.wt-ba-thumbnail-item:hover img {
  opacity: 0.9;
  transform: scale(1.04);
}

.wt-ba-thumbnail-item.active {
  border-color: var(--wt-ba-primary);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.wt-ba-thumbnail-item.active img {
  opacity: 1;
}

/* Thumbnail title overlays */
.wt-ba-thumbnail-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(17, 24, 39, 0.9) 20%,
    rgba(17, 24, 39, 0)
  );
  padding: 15px 12px 10px;
  pointer-events: none;
}

.wt-ba-thumb-title {
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateY(2px);
  transition: transform 0.25s ease;
}

.wt-ba-thumbnail-item:hover .wt-ba-thumb-title,
.wt-ba-thumbnail-item.active .wt-ba-thumb-title {
  transform: translateY(0);
}

.wt-ba-no-projects {
  text-align: center;
  padding: 30px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--wt-ba-border-radius);
  color: #6b7280;
  font-size: 14px;
}

/* Responsive Overrides (max-width: 1024px) */
@media screen and (max-width: 1024px) {
  .wt-ba-container {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .wt-ba-thumbnails-container {
    order: 1;
    max-height: none;
    width: 100%;
  }

  .wt-ba-thumbnails-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    padding: 4px 0 0px;
    gap: 10px;
  }

  .wt-ba-thumbnail-item {
    /* Calculate exact sizing for exactly 4 thumbnails on mobile screen with gaps */
    width: calc((100% - 30px) / 4);
    height: 80px;
    min-width: 80px; /* Safety fallback for tiny displays */
  }

  .wt-ba-main-wrapper {
    order: 2;
    width: 100%;
  }

  .wt-ba-slider-box {
    height: 400px;
  }

  .wt-ba-badge {
    top: 15px;
    padding: 8px 16px;
    font-size: 10px;
  }

  .wt-ba-badge-before {
    left: 15px;
  }

  .wt-ba-badge-after {
    right: 15px;
  }
}

/* Extra small screens adjustments */
@media screen and (max-width: 600px) {
  .wt-ba-thumbnail-item.active {
    border-width: 2px;
  }
  .wt-ba-thumbnails-list {
    gap: 5px;
  }
  .wt-ba-slider-box {
    height: 210px;
  }

  .wt-ba-thumbnail-item {
    /* Allow scrolling instead of squishing on extremely small screens */
    width: calc((100% - 20px) / 4);
    min-width: 90px;
    height: auto;
  }

  .wt-ba-handle-button {
    width: 38px;
    height: 38px;
  }

  .wt-ba-arrows {
    width: 20px;
    height: 20px;
  }
}
