/* ============================================
   ImageGallery Component Styles
   ============================================ */

.image-gallery {
  display: flex;
  gap: var(--main-sidebar-gap, 16px);
  align-items: flex-start;
  justify-content: center;
}

.gallery__main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white, #ffffff);
  border-radius: var(--radius-sm, 0px);
  overflow: hidden;
  width: var(--main-width, 600px);
  height: var(--main-height, 600px);
  flex-shrink: 0;
  margin-top: calc((var(--sidebar-height) - var(--main-height)) / 2);
}

.gallery__main-placeholder {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery__main-placeholder::after {
  content: '';
  width: 50px;
  height: 50px;
  border: 3px solid var(--color-primary, #003366);
  border-top-color: transparent;
  border-radius: 50%;
  animation: gallery-spin 1s linear infinite;
}

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

.gallery__main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.gallery__main-img.loaded {
  opacity: 1;
}

.gallery__sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 1.5rem);
  /* Width fixed, height matches main image */
  width: var(--sidebar-width, 300px);
  flex-shrink: 0;
}

.gallery__thumbnails-wrapper {
  overflow: hidden;
  height: var(--sidebar-height, 600px);
  flex-shrink: 0;
  width: 100%;
}

.gallery__thumbnails {
  display: flex;
  gap: var(--gap-size, 0px);
  transition: transform 0.4s ease-out;
  height: 100%;
  width: 100%;
}

.gallery__column {
  display: flex;
  flex-direction: column;
  gap: var(--gap-size, 0px);
  flex-shrink: 0;
  width: var(--column-width, 50%);
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.gallery__thumb {
  /* Square thumbnails - width and height constrained by available space */
  width: 100%;
  height: var(--thumbnail-height, 100px);
  object-fit: cover;
  cursor: pointer;
  border-radius: var(--radius-sm, 0px);
  /*border: 3px solid transparent;*/
  transition: all var(--transition-base, 300ms ease-in-out);
  opacity: 0.7;
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.gallery__thumb:not([src]) {
  opacity: 0.3;
}

.gallery__thumb.active {
  border-color: var(--color-primary, #003366);
  opacity: 1;
}

.gallery__thumb.loaded {
  opacity: 0.7;
}

.gallery__thumb.loaded.active {
  opacity: 1;
}

.gallery__controls {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md, 1.5rem);
  /* Controls positioned below thumbnails */
}

.gallery__btn {
  width: 50px;
  height: 50px;
  background-color: var(--color-primary, #003366);
  color: var(--color-white, #ffffff);
  border: none;
  border-radius: 50%;
  font-size: var(--font-size-xl, 1.5rem);
  cursor: pointer;
  transition: all var(--transition-base, 300ms ease-in-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery__btn:hover {
  background-color: var(--color-secondary, #1a4d7a);
  transform: scale(1.1);
}

.gallery__btn:active {
  transform: scale(0.95);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .image-gallery {
    flex-direction: column;
    gap: var(--main-sidebar-gap, 16px);
    padding: var(--spacing-md, 1.5rem);
    width: 100%;
  }

  .gallery__main {
    width: 100%;
    height: auto;
    aspect-ratio: var(--aspect-ratio, 1);
    min-height: unset;
    margin-top: 0;
  }

  .gallery__sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md, 1.5rem);
    width: 100%;
    height: auto;
  }

  .gallery__thumbnails-wrapper {
    width: 100%;
    height: auto;
    overflow-x: auto;
    scroll-padding-left: 0;
    scroll-snap-type: x mandatory;
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  .gallery__thumbnails-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .gallery__thumbnails {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--spacing-xs, 0.5rem);
  }

  .gallery__column {
    display: contents;
  }

  .gallery__thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .gallery__controls {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: var(--spacing-sm, 1rem);
  }

  .gallery__btn {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-lg, 1.125rem);
  }
}
