/*
 * PhotoSwipe integration — custom thumbnail strip (tylko desktop)
 * Mobile (< 768px) — thumbnails ukryte, swipe lewo/prawo wystarcza.
 */

/* Bezpiecznik proporcji — gdy PhotoSwipe ma zle wymiary w itemData (brak w HTML),
   i tak obraz zachowa proporcje zamiast sie rozciagac */
.pswp__img {
    object-fit: contain !important;
}

/* Ukryj rozmazany placeholder (thumbnail skalowany do fullscreen) — woleli spinner */
.pswp__img--placeholder,
.pswp__img--placeholder--blank {
    display: none !important;
}

/* Modale (share, flag) muszą być NAD PhotoSwipe — PhotoSwipe ma z-index: 100000 */
.share-modal,
#flagModal,
#flagModal.active {
    z-index: 100001 !important;
}

/* === PASEK AKCJI (Ocena, Ulubione, Kopiuj, Udostepnij, Zglos) === */
/* Wycentrowane w toolbarze — absolute positioning zeby nie kolidowalo z zoom/close po prawej */
.pswp__top-bar {
    position: relative !important;
}
.pswp__actions {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    color: #fff;
    /* zeby nie zasłonił klikania na zoom/close zbyt szeroki */
    max-width: calc(100% - 160px);
}
.pswp__action-stars {
    display: inline-flex;
    gap: 2px;
    cursor: pointer;
    user-select: none;
}
.pswp__star {
    font-size: 20px;
    line-height: 1;
    color: rgba(255,255,255,0.55);
    transition: color 0.15s, transform 0.1s;
    cursor: pointer;
    padding: 0 1px;
}
.pswp__star:hover { color: #fbbf24; transform: scale(1.15); }
.pswp__star--filled { color: #fbbf24; }

.pswp__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.pswp__action-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.pswp__action-btn--active {
    color: #ef4444 !important;
}

/* Na mobile: zmniejsz (zeby nie zasłonić close button) */
@media (max-width: 640px) {
    .pswp__actions { gap: 4px; padding: 0 4px; }
    .pswp__star { font-size: 16px; }
    .pswp__action-btn { width: 30px; height: 30px; font-size: 16px; }
}

/* Thumbnail strip pod glowny obrazkiem */
.pswp__thumbs {
    position: absolute;
    left: 0; right: 0;
    bottom: 0;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1600;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.pswp__thumbs::-webkit-scrollbar { height: 8px; }
.pswp__thumbs::-webkit-scrollbar-track { background: transparent; }
.pswp__thumbs::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.pswp__thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, transform 0.15s, outline 0.15s;
    background: #111;
    outline: 2px solid transparent;
}
.pswp__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pswp__thumb:hover { opacity: 0.85; transform: scale(1.04); }
.pswp__thumb.pswp__thumb--active {
    opacity: 1;
    outline-color: #fff;
}

/* Wiecej miejsca u dolu dla obrazka glowny gdy thumbnails widoczne */
.pswp--has-thumbs .pswp__item img.pswp__img {
    margin-bottom: 90px;
}

/* MOBILE: ukryj thumbnails strip */
@media (max-width: 767px) {
    .pswp__thumbs { display: none !important; }
    .pswp--has-thumbs .pswp__item img.pswp__img { margin-bottom: 0; }
}
