/* Lite Light - Lightweight Lightbox Utility Styles */

.lite-light {
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  height: 100%;
  justify-content: center;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transition: opacity 0.25s ease, visibility 0.25s;
  visibility: hidden;
  width: 100%;
  z-index: 1000;

  &.lite-light-active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  /* Loading spinner - visible behind the image during transitions */
  &::after {
    animation: lite-light-spin 0.8s linear infinite;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top-color: rgba(255, 255, 255, 0.8);
    content: '';
    height: 36px;
    position: absolute;
    width: 36px;
  }

  .lite-light-prev {
    left: 10px;
    position: absolute;
  }

  .lite-light-next {
    position: absolute;
    right: 10px;
  }

  img {
    background-color: #fff;
    max-height: 90%;
    max-width: 90%;
    padding: 7px;
    position: relative;
    transform-origin: center center;
    will-change: transform;
    z-index: 1;
  }
}

/* Navigation Button Touch Targets */
.lite-light-button {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;

  &:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
  }
}

/* Navigation Arrows */
.lite-light-arrow {
  border: solid #fff;
  border-width: 0 1px 1px 0;
  display: inline-block;
  padding: 10px;
  transform: scale(1.0);
  transition: transform 0.3s ease;

  &:hover {
    cursor: pointer;
    transform: scale(1.1);
  }

  &.lite-light-right {
    margin-right: 10px;
    transform: scale(1.00) rotate(-45deg);

    &:hover {
      transform: scale(1.05) rotate(-45deg);
    }
  }

  &.lite-light-left {
    margin-left: 10px;
    transform: scale(1.00) rotate(135deg);

    &:hover {
      transform: scale(1.05) rotate(135deg);
    }
  }
}

/* Close Button */
.lite-light-close {
  &.lite-light-button {
    align-items: flex-start;
    background: none;
    border: none;
    box-sizing: content-box;
    color: white;
    cursor: pointer;
    flex-direction: column;
    height: 21.5px;
    justify-content: space-between;
    min-height: auto;
    min-width: auto;
    padding: 11px;
    position: absolute;
    right: 4px;
    top: 4px;
    transform: scale(1.0);
    transition: transform 0.3s ease;
    width: 22px;

    &:hover {
      transform: scale(1.1);
    }
  }

  .lite-light-bar {
    background-color: #fff;
    display: block;
    height: 1px;
    width: 100%;

    &:nth-of-type(1) {
      transform: rotate(45deg);
      transform-origin: top left;
      width: 30px;
    }

    &:nth-of-type(2) {
      transform: rotate(-45deg);
      transform-origin: bottom left;
      width: 30px;
    }
  }
}

/* Animation keyframes for fading */
@keyframes lite-light-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lite-light-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes lite-light-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Animation classes */
.lite-light-fade-in {
  animation: lite-light-fade-in 0.15s ease-in-out forwards;
}

.lite-light-fade-out {
  animation: lite-light-fade-out 0.15s ease-in-out forwards;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .lite-light {
    .lite-light-prev,
    .lite-light-next {
      display: none;
    }

    img {
      max-height: 80vh;
      max-width: 90%;
      padding: 5px;
    }

    .lite-light-close {
      right: 14px;
      top: 14px;
    }
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  .lite-light {
    transition: none;
  }

  .lite-light-fade-in,
  .lite-light-fade-out {
    animation-duration: 0.01s;
  }

  .lite-light::after {
    animation: none;
  }
}

/* Mobile Safari Fixes */
@supports (-webkit-touch-callout: none) {
  .lite-light img {
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    transform: translateZ(0);
  }
}
