/* ==========================================================================
   Image Preview & Lightbox (Material 3 Module)
   ========================================================================== */

/* Контейнер-превью на карточке */
.img-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--md-outline-var, #C3C7CF);
  box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,.06));
  cursor: zoom-in;
  margin-top: 6px;
  max-width: 100%;
  width: fit-content;
  box-sizing: border-box;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.img-preview:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2, 0 2px 6px rgba(0,0,0,.08));
}

.img-preview img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  height: auto;
  pointer-events: none;
}

/* Полноэкранный оверлей */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s 0.2s;
}

.img-lightbox.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0s 0s;
}

.img-lightbox img {
  max-width: min(92vw, 800px);
  max-height: 85vh;
  object-fit: contain;
  background: #ffffff;
  padding: 14px;
  border-radius: 20px;
  box-shadow: var(--shadow-3, 0 4px 12px rgba(0,0,0,.15));
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: auto;
}

.img-lightbox.open img {
  transform: scale(1);
}