
.custom-gallery {
    display: grid;
    gap: 10px;
    margin: 20px 0;
    grid-auto-rows: 250px;
}

.gallery-columns-1 { grid-template-columns: repeat(1, 1fr); }
.gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }

.gallery-columns-4 .gallery-item {
    max-width: 100% !important;}	

.gallery-item {
    position: relative;
    overflow: hidden;
}

.gallery-link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
    pointer-events: auto;
}

.gallery-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.gallery-link:hover img {
    transform: scale(1.05);
}

.gallery-item-hidden {
    display: none;
}

.gallery-item-more {
    position: relative;
    overflow: hidden;
}

.gallery-more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    gap: 8px;
    transition: background 0.3s;
}

.gallery-item-more:hover .gallery-more-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.gallery-more-icon {
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
}

.gallery-more-text {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.gallery-more-text small {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
}

/* Modální okno */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s;
}

.gallery-modal.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-modal-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    gap: 20px;
}

.gallery-modal-content {
    position: relative;
    flex: 0 0 66.666%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
}

.gallery-modal-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 101;
}

.gallery-modal-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding-right: 20px;
}

.gallery-modal-counter {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

#gallery-modal-image {
    max-width: 100%;
    max-height: calc(100vh - 100px);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.gallery-modal-caption {
    color: #fff;
    padding: 15px;
    font-size: 16px;
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
}

.gallery-modal-description {
    color: #ccc;
    padding: 0 15px 15px;
    font-size: 14px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.gallery-modal-ad {
    flex: 0 0 33.333%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.gallery-modal-ad-content {
    padding: 30px;
    color: #fff;
    text-align: center;
    width: 100%;    
}

.gallery-modal-ad-content h3 {
    color: #fff;
    margin-bottom: 20px;
}

.gallery-modal-ad-content img {
    max-width: 100%;
    height: auto;
}

.ad-desktop {
    display: block;
}

.ad-mobile {
    display: none;
}

.gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.3s;
}

.gallery-modal-close:hover {
    color: #ccc;
}

.gallery-modal-prev,
.gallery-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 30px;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 100;
}

.gallery-modal-prev:hover,
.gallery-modal-next:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.gallery-modal-prev {
    left: 20px;
}

.gallery-modal-next {
    right: 20px;
}

@media (max-width: 768px) {
    .gallery-columns-3,
    .gallery-columns-4,
    .gallery-columns-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-modal-wrapper {
        flex-direction: column;
        padding: 0;
        height: 100%;
    }
    
    .gallery-modal-content {
        flex: 1;
        width: 100%;
        padding: 60px 10px 10px;
        display: flex;
        flex-direction: column;
    }
    
    .gallery-modal-ad {
        display: none;
        flex: 0;
        width: 100%;
        border: none;
    }
    
    /* Když se reklama zobrazí jako slide */
    .gallery-modal-ad.mobile-fullscreen {
        display: flex !important;
        flex: 1;
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 99;
        background-color: rgba(0, 0, 0, 0.95);
        align-items: center;
        justify-content: center;
    }
    
    .gallery-modal-ad-content {
        padding: 20px;
        max-width: 100%;
    }
    
    .ad-desktop {
        display: none;
    }
    
    .ad-mobile {
        display: block;
    }
    
    #gallery-modal-image {
        max-height: 70vh;
        flex: 1;
        object-fit: contain;
    }
    
    .gallery-modal-prev,
    .gallery-modal-next {
        padding: 10px 15px;
        font-size: 24px;
        z-index: 100;
    }
    
    .gallery-modal-next {
        right: 20px;
    }
    
    .gallery-modal-close {
        font-size: 30px;
        top: 10px;
        right: 15px;
        z-index: 101;
    }
    
    .gallery-modal-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 10px 20px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: rgba(0, 0, 0, 0.5);
        z-index: 100;
    }
    
    .gallery-modal-title {
        font-size: 14px;
        margin: 0;
    }
    
    .gallery-modal-counter {
        font-size: 14px;
    }
}