/**
 * VeriDoc Interactive Tour Block Frontend Styles
 *
 * @package VeriDoc
 */

/* Interactive Tour Block Styles */
@keyframes pulse-hotspot {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Loading state styles for Interactive Tour */
.veridoc-interactive-tour-block.loading {
  cursor: wait !important;
}

.veridoc-interactive-tour-block.loading .animated-hotspot {
  cursor: wait !important;
  opacity: 0.7;
}

.veridoc-interactive-tour-block.loading .nav-button,
.veridoc-interactive-tour-block.loading .reload-button {
  pointer-events: none;
  opacity: 0.5;
}

/* Smooth image transitions */
#current-image {
  transition: opacity 0.3s ease-in-out;
}

#current-image.loading {
  opacity: 0.7;
}

.animated-hotspot {
  /* CLS Prevention: Use transform instead of left/top to prevent layout shifts */
  transition: transform 0.5s ease-in-out;
  position: absolute;
  width: 80px;
  height: 80px;
  z-index: 20;
  /* Fixed initial position to prevent any layout shifts */
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  /* Prevent content jumping and layout recalculations */
  /* contain: layout style paint; */
  will-change: transform;
  /* Ensure the element doesn't affect document flow */
  pointer-events: none;
}

/* Enable pointer events only when the hotspot is active */
.animated-hotspot:not([style*="display: none"]) {
  pointer-events: auto;
}

/* Custom Tooltip Styles */
.custom-tooltip {
  position: absolute;
  background: var(--tooltip-bg-color, #70ba4d);
  color: white;
  border-radius: 12px;
  font-size: clamp(12px, 3vw, 16px);
  font-weight: bold;
  line-height: 1.4;
  padding: 10px 16px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  max-width: max-content;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    left 0.5s ease-in-out,
    top 0.5s ease-in-out,
    opacity 0.3s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  /* CLS Prevention: Reserve space and prevent layout shifts */
  min-width: max-content;
  min-height: 50px;
  /* Fixed initial position to prevent any layout shifts */
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  /* Prevent content jumping and layout recalculations */
  /* contain: layout style paint; */
  will-change: transform, opacity, visibility;
}

/* Arrow pointing left (tooltip on right) */
.custom-tooltip.arrow-left::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid var(--tooltip-bg-color, #70ba4d);
  filter: drop-shadow(-2px 0 2px rgba(0, 0, 0, 0.1));
  z-index: 1;
}

/* Arrow pointing right (tooltip on left) */
.custom-tooltip.arrow-right::before {
  content: "";
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid var(--tooltip-bg-color, #70ba4d);
  filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1));
  z-index: 1;
}

/* CLS Prevention: Ensure modals don't cause layout shifts */
.tour-modal,
.completion-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  /* Prevent layout shifts when showing/hiding */
  contain: layout;
}


  /* CLS Prevention: Force stable layout for all dynamic content */
  .veridoc-interactive-tour-block {
    /* Prevent any layout shifts from dynamic content */
    contain: layout style paint;
    /* Ensure stable positioning */
    position: relative;
  }

/* CLS Prevention: Ensure step counter and envelope text are stable */
.step-counter,
.envelope-text {
  min-height: 1.5em;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  contain: layout;
}
/* Tour Modal Transitions */
.tour-modal {
  transition:
    opacity 0.3s ease-in-out,
    visibility 0.3s ease-in-out;
}

/* Tour Modal Transitions */
.tour-modal {
  transition:
    opacity 0.3s ease-in-out,
    visibility 0.3s ease-in-out;
}

/* Arrow pointing down (tooltip on top) */
.custom-tooltip.arrow-bottom::before {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--tooltip-bg-color, #70ba4d);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
  z-index: 1;
}

/* Arrow pointing up (tooltip on bottom) */
.custom-tooltip.arrow-top::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--tooltip-bg-color, #70ba4d);
  filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.1));
  z-index: 1;
}

/* Ensure tooltip text is properly centered */
.custom-tooltip span br {
  display: block;
}

/* Responsive tooltip styles */
@media screen and (max-width: 320px) {
  .custom-tooltip {
    font-size: 10px;
  }
}

@media screen and (max-width: 425px) {
  .custom-tooltip {
    font-size: 12px;
  }
}
