/* Warehouse photo thumbnails and the fullscreen viewer.
 *
 * Paired with order-photos.js. Extracted so pages that show order photos do not
 * each carry their own copy. `delivered.html` and `my-orders.html` still hold
 * an older inline copy of these rules; they can be migrated to this file
 * separately.
 *
 * Dark theme is matched on both `html.dark-theme` and `body.dark-theme`:
 * different pages in this project set the class on different elements.
 */

.order-photos {
  width: 100%;
  margin: 0;
}

.order-photos-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  margin-bottom: 8px;
}

.order-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.04);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html.dark-theme .order-photo-thumb,
body.dark-theme .order-photo-thumb {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.order-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Только брендовая рамка — свечения и градиенты не используем */
.order-photo-thumb:hover { border-color: var(--brand); box-shadow: none; }

.order-photo-more {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  pointer-events: none;
}

html.dark-theme .order-photo-more,
body.dark-theme .order-photo-more { background: rgba(0, 0, 0, 0.65); }

/* ── Полноэкранный просмотр ── */

.order-photo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  /* Выше мобильного листа посылки (.pp-sheet, 99999), ниже тостов страниц */
  z-index: 100010;
  background: rgba(17, 24, 39, 0.95);
  flex-direction: column;
}

html.dark-theme .order-photo-lightbox,
body.dark-theme .order-photo-lightbox { background: rgba(2, 8, 16, 0.96); }

.order-photo-lightbox.active { display: flex; }

.opl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  color: #fff;
  flex-shrink: 0;
}

.opl-title {
  font-size: 17px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  max-width: 80%;
}

.opl-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  padding: 0 10px;
  transition: color 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.opl-close:hover { color: #94a3b8; }

.opl-body {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0 50px;
  min-height: 0;
  touch-action: pan-y;
}

.opl-image-container {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.opl-image-container img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  object-fit: contain;
  transition: opacity 0.15s;
}

.opl-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.opl-nav:hover { color: var(--brand); }
.opl-prev { left: 20px; }
.opl-next { right: 20px; }

.opl-counter {
  color: #cbd5e1;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  flex-shrink: 0;
}

.opl-thumbs-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 20px 20px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.opl-thumbs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #475569 rgba(255, 255, 255, 0.1);
}

.opl-thumbs::-webkit-scrollbar { height: 6px; }
.opl-thumbs::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.opl-thumbs::-webkit-scrollbar-thumb { background: #64748b; border-radius: 10px; }

.opl-thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  object-fit: cover;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
  background: rgba(255, 255, 255, 0.06);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.opl-thumb:hover { opacity: 0.8; }
.opl-thumb.active { border-color: var(--brand); opacity: 1; }

@media (max-width: 768px) {
  /* Лента вместо переноса: в узкой карточке ряд миниатюр не должен расти вниз */
  .order-photos-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .order-photos-grid::-webkit-scrollbar { display: none; }

  .order-photo-thumb { width: 80px; height: 80px; border-radius: 10px; }

  .opl-header { padding: 10px 15px; }
  .opl-title {
    font-size: 15px;
    max-width: 85%;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .opl-body { padding: 0; }
  .opl-nav {
    font-size: 30px;
    background: rgba(0, 0, 0, 0.35);
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
  .opl-prev { left: 10px; }
  .opl-next { right: 10px; }
  .opl-thumbs-container { padding: 0 10px 15px 10px; }
  .opl-thumb { width: 50px; height: 50px; }
}
