.image-viewer {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;

  &__container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    user-select: none;

    // Smooth cursor transitions
    cursor: default;
    transition: cursor 0.2s ease;

    &.draggable {
      cursor: grab;
    }

    &.dragging {
      cursor: grabbing;
    }
  }

  &__image-wrapper {
    position: relative;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
  }

  &__image {
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    max-width: none;
    max-height: none;
    box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
  }

  &__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--c--contextuals--content--semantic--neutral--secondary);
    font-size: 14px;
  }

  &__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--c--contextuals--border--surface--primary);
    border-top: 3px solid
      var(--c--contextuals--content--semantic--brand--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
}

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

// Responsive design
@media (max-width: 768px) {
  .image-viewer {
    &__controls {
      padding: 12px;
      gap: 8px;
    }

    &__control-btn {
      width: 36px;
      height: 36px;
    }

    &__zoom-level {
      min-width: 50px;
      font-size: 13px;
    }
  }
}

// High contrast mode support
@media (prefers-contrast: high) {
  .image-viewer {
    border: 2px solid #000000;

    &__controls {
      border-bottom-width: 2px;
    }

    &__control-btn {
      border-width: 2px;
    }
  }
}

// Reduced motion support
@media (prefers-reduced-motion: reduce) {
  .image-viewer {
    &__image-wrapper {
      transition: none;
    }

    &__control-btn {
      transition: none;

      svg {
        transition: none;
      }
    }

    &__container {
      transition: none;
    }

    &__spinner {
      animation: none;
    }
  }
}

.zoom-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--c--globals--spacings--3xs);
  border-radius: var(--c--globals--spacings--3xs);
  padding: var(--c--globals--spacings--3xs);
  border: 1px solid var(--c--contextuals--border--surface--primary);
  background: var(--c--contextuals--background--surface--primary);
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);

  button {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &__value {
    text-align: center;
    min-width: 35px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c--contextuals--content--semantic--neutral--secondary);
    cursor: pointer;
    padding: 4px 0;
  }
}
