/**
 * Shqip Gallery - Public CSS
 * Stilet për të gjitha layout-et, hover effects dhe lightbox.
 */

/* ============ Container ============ */
.shqip-gallery {
    --sg-gap: 10px;
    --sg-radius: 0;
    --sg-cols: 3;
    --sg-bg: transparent;
    --sg-text: inherit;
    --sg-overlay: rgba(0, 0, 0, 0.45);
    background: var(--sg-bg);
    color: var(--sg-text);
    margin: 1.5em 0;
    box-sizing: border-box;
}

.shqip-gallery *,
.shqip-gallery *::before,
.shqip-gallery *::after {
    box-sizing: border-box;
}

.shqip-gallery img {
    display: block;
    max-width: 100%;
    height: auto;
}

.shqip-gallery figure {
    margin: 0;
    padding: 0;
}

.shqip-gallery .shqip-gallery-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--sg-radius);
    text-decoration: none;
    line-height: 0;
}

.shqip-gallery .shqip-gallery-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.shqip-gallery .shqip-gallery-link img {
    width: 100%;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.shqip-gallery .shqip-gallery-caption {
    margin-top: 6px;
    font-size: 0.875em;
    line-height: 1.4;
    color: var(--sg-text);
    opacity: 0.85;
}

/* ============ Grid Layout ============ */
.shqip-gallery-grid > .shqip-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols), minmax(0, 1fr));
    gap: var(--sg-gap);
}

.shqip-gallery .shqip-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols), minmax(0, 1fr));
    gap: var(--sg-gap);
}

.shqip-gallery-grid .shqip-gallery-item {
    min-width: 0;
}

.shqip-gallery-grid .shqip-gallery-link {
    aspect-ratio: 1 / 1;
}

.shqip-gallery-grid .shqip-gallery-link img {
    height: 100%;
    object-fit: cover;
}

/* ============ Masonry Layout (CSS columns) ============ */
.shqip-gallery .shqip-gallery-masonry {
    column-count: var(--sg-cols);
    column-gap: var(--sg-gap);
}

.shqip-gallery-masonry .shqip-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--sg-gap);
    display: block;
}

/* ============ Slider Layout ============ */
.shqip-gallery .shqip-gallery-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--sg-radius);
}

.shqip-gallery-slider-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.shqip-gallery-slide {
    flex: 0 0 100%;
    min-width: 100%;
}

.shqip-gallery-slide img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
}

.shqip-gallery-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shqip-gallery-slider-arrow:hover,
.shqip-gallery-slider-arrow:focus {
    background: rgba(0, 0, 0, 0.85);
    outline: none;
}

.shqip-gallery-slider-prev { left: 12px; }
.shqip-gallery-slider-next { right: 12px; }

.shqip-gallery-slider-dots {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 2;
}

.shqip-gallery-slider-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 0;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.shqip-gallery-slider-dot.is-active {
    background: #fff;
    transform: scale(1.3);
}

.shqip-gallery-slider-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 2;
}

/* ============ Album Layout ============ */
.shqip-gallery .shqip-gallery-album {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sg-gap);
}

.shqip-gallery-album-header {
    margin-bottom: 10px;
}

.shqip-gallery-album-title {
    margin: 0 0 6px 0;
}

.shqip-gallery-album-main img {
    width: 100%;
    border-radius: var(--sg-radius);
}

.shqip-gallery-album-thumbs {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols), minmax(0, 1fr));
    gap: var(--sg-gap);
}

.shqip-gallery-album-thumb .shqip-gallery-link {
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.shqip-gallery-album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shqip-gallery-album-thumb.is-active .shqip-gallery-link {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

/* ============ Hover Effects ============ */
.shqip-gallery-hover-zoom .shqip-gallery-link:hover img {
    transform: scale(1.08);
}

.shqip-gallery-hover-fade .shqip-gallery-link:hover img {
    opacity: 0.75;
}

.shqip-gallery-hover-overlay .shqip-gallery-link:hover .shqip-gallery-overlay {
    background: var(--sg-overlay);
}

.shqip-gallery-hover-slide .shqip-gallery-link img {
    transition: transform 0.5s ease;
}

.shqip-gallery-hover-slide .shqip-gallery-link:hover img {
    transform: translateY(-8px) scale(1.03);
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .shqip-gallery-cols-6 .shqip-gallery-grid,
    .shqip-gallery-cols-7 .shqip-gallery-grid,
    .shqip-gallery-cols-8 .shqip-gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .shqip-gallery-cols-6 .shqip-gallery-masonry,
    .shqip-gallery-cols-7 .shqip-gallery-masonry,
    .shqip-gallery-cols-8 .shqip-gallery-masonry {
        column-count: 4;
    }
}

@media (max-width: 768px) {
    .shqip-gallery .shqip-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .shqip-gallery .shqip-gallery-masonry {
        column-count: 3;
    }
    .shqip-gallery-album-thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 540px) {
    .shqip-gallery .shqip-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .shqip-gallery .shqip-gallery-masonry {
        column-count: 2;
    }
    .shqip-gallery-album-thumbs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .shqip-gallery-slider-arrow {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

/* ============ Lightbox ============ */
.shqip-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.shqip-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.shqip-lightbox.theme-light {
    background: rgba(245, 245, 245, 0.96);
    color: #222;
}

.shqip-lightbox.theme-light .shqip-lightbox-caption,
.shqip-lightbox.theme-light .shqip-lightbox-counter,
.shqip-lightbox.theme-light .shqip-lightbox-title {
    color: #222;
}

.shqip-lightbox-stage {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.shqip-lightbox-image-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shqip-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-drag: none;
}

.shqip-lightbox-loader {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: shqip-spin 0.9s linear infinite;
    display: none;
}

.shqip-lightbox.is-loading .shqip-lightbox-loader {
    display: block;
}

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

.shqip-lightbox-meta {
    margin-top: 14px;
    text-align: center;
    color: #fff;
    max-width: 90vw;
}

.shqip-lightbox-title {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #fff;
}

.shqip-lightbox-caption {
    font-size: 0.95em;
    margin: 0 0 4px 0;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.shqip-lightbox-description {
    font-size: 0.85em;
    margin: 4px 0 0 0;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.shqip-lightbox-counter {
    margin-top: 8px;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.6);
}

.shqip-lightbox-close,
.shqip-lightbox-arrow {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shqip-lightbox.theme-light .shqip-lightbox-close,
.shqip-lightbox.theme-light .shqip-lightbox-arrow {
    background: rgba(0, 0, 0, 0.1);
    color: #222;
}

.shqip-lightbox-close:hover,
.shqip-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
}

.shqip-lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
}

.shqip-lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
}

.shqip-lightbox-prev { left: 20px; }
.shqip-lightbox-next { right: 20px; }

.shqip-lightbox-share {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
}

.shqip-lightbox-share button {
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.shqip-lightbox-share button:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 600px) {
    .shqip-lightbox-arrow {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .shqip-lightbox-prev { left: 8px; }
    .shqip-lightbox-next { right: 8px; }
    .shqip-lightbox-close {
        top: 8px;
        right: 8px;
        width: 38px;
        height: 38px;
    }
    .shqip-lightbox-share {
        top: 8px;
        left: 8px;
    }
}

/* ============ Lazy loading fade-in ============ */
.shqip-gallery-lazy img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease;
}
.shqip-gallery-lazy img[loading="lazy"].sg-loaded,
.shqip-gallery-lazy img[loading="lazy"][src] {
    opacity: 1;
}
