:root {
  --iv-primary: #084e22;
  --iv-radius-lg: 1rem;
  --iv-radius-md: 0.75rem;
  --iv-bg-subtle: #f8f9fa;
  --iv-border-color: #ebedef;
}

[data-bs-theme="dark"] {
  --iv-bg-subtle: #1e232a;
  --iv-border-color: #2b3036;
}

/* ==========================================
    IMAGE VIEWER PLUGIN STYLES (PURE CSS)
    ========================================== */
.iv-container {
  width: 100%;
  position: relative;
  box-sizing: border-box;
  user-select: none;
}

.iv-gallery-wrapper {
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
}

@media (min-width: 768px) {
  .iv-gallery-wrapper {
    flex-direction: row;
  }
}

/* Thumbnail Container */
.iv-thumbnails-column {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

@media (min-width: 768px) {
  .iv-thumbnails-column {
    flex-direction: column;
    height: 480px;
    background-color: var(--pure-white);
    border-radius: var(--iv-radius-lg);
    border: 1px solid var(--iv-border-color);
    padding-left: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
}

/* CRITICAL REQUIREMENT: HIDE THUMBNAIL SCROLLBARS ACCROSS ALL BROWSERS */
.iv-thumbnails-wrapper {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding: 0.25rem 2px;
  /* Scrollbar hiding rules */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.iv-thumbnails-wrapper::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
  width: 0;
  height: 0;
}

@media (min-width: 768px) {
  .iv-thumbnails-wrapper {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 400px;
    width: 84px;
    flex-shrink: 0;
    row-gap: 30px;
  }
}

.iv-thumb-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border: 1px solid var(--iv-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
}
.iv-thumb-btn.btn-up{
  position: absolute;
  top: 10px;
}
.iv-thumb-btn.btn-down{
  position: absolute;
  bottom: 10px;
}
.iv-thumb-btn:hover {
  background-color: var(--iv-primary);
  color: #ffffff;
  border-color: var(--iv-primary);
}

.iv-thumb-item {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: var(--iv-radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background-color: var(--pure-white);
}

.iv-thumb-item.iv-active,
.iv-thumb-item:hover {
  border-color: var(--iv-primary);
  transform: scale(1.04);
}

.iv-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Main Viewport */
.iv-viewport {
  position: relative;
  width: 100%;
  height: 380px;
  background-color: var(--pure-white);
  border-radius: var(--iv-radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  border: 1px solid var(--iv-border-color);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .iv-viewport {
    height: 480px;
  }
}

.iv-main-image {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
  display: block;
  border-radius: var(--iv-radius-lg);
}

.iv-zoom-lens {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 2px solid var(--iv-primary);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 0 10px rgba(255,255,255,0.4);
  background-repeat: no-repeat;
  background-color: #ffffff;
  z-index: 20;
  transition: opacity 0.15s ease-out, visibility 0.15s ease-out;
  backdrop-filter: blur(2px);
}

.iv-zoom-lens.iv-visible {
  opacity: 1;
  visibility: visible;
}

/* On-Page Custom Action Overlay Buttons */
.iv-custom-buttons-group {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.iv-custom-buttons-group > * {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.iv-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 24;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--iv-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
  opacity: 0.85;
}

.iv-nav-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  background-color: var(--iv-primary);
  color: #fff;
}

.iv-nav-prev { left: 0.75rem; }
.iv-nav-next { right: 0.75rem; }

.iv-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.iv-modal-backdrop.iv-show {
  opacity: 1;
  visibility: visible;
}

.iv-modal-dialog {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: #111418;
  color: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #2b3036;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.iv-modal-backdrop.iv-show .iv-modal-dialog {
  transform: scale(1);
}

.iv-modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #2b3036;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.iv-modal-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;

}

.iv-modal-close-btn {
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}

.iv-modal-close-btn:hover {
  color: #ffffff;
  background-color: rgba(255,255,255,0.1);
}

/* Fixed Modal Scrollable Body */
.iv-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  /* Scrollbar styling for modal body */
  scrollbar-width: thin;
  scrollbar-color: #3d444e transparent;
}

.iv-modal-stage {
  position: relative;
  width: 100%;
  min-height: 320px;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iv-modal-stage img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 0.75rem;
}

.iv-modal-thumbs-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.iv-modal-thumbs-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  flex-grow: 1;
  padding: 0.25rem 0;
  /* Hidden scrollbars for lightbox thumbs too */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.iv-modal-thumbs-scroll::-webkit-scrollbar {
  display: none;
}

.iv-modal-thumb {
  width: 60px;
  height: 60px;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.iv-modal-thumb.iv-active,
.iv-modal-thumb:hover {
  opacity: 1;
  border-color: var(--iv-primary);
}