
/* ===== GALLERY GRID SYSTEM (MINIMALIST) ===== */
.text-editor .gallery-grid,
.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px !important; /* Minimalistická mezera */
    margin-block: 20px;
    width: 100%;
    border-radius: 0 !important;
    overflow: hidden; 
    background-color: #171925; /* Modré pozadí pro efekt při hoveru */
}

/* 1 fotka: Přes celou šířku */
.gallery-grid[data-count="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
}
.gallery-grid[data-count="1"] img {
    height: auto !important;
    max-height: 500px;
}

/* 2 fotky: Vedle sebe */
.gallery-grid[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    align-items: center;
}
.gallery-grid[data-count="2"] img {
    height: auto !important;
    max-height: 600px;
    object-fit: contain !important;
    min-height: 0 !important;
}

/* 3 fotky: První velká */
.gallery-grid[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 300px 200px;
}
.gallery-grid[data-count="3"] > .gallery-item-wrapper:nth-child(1),
.gallery-grid[data-count="3"] > img:nth-child(1) {
    grid-column: 1 / -1;
    height: 100% !important;
}

/* 4 a 5+ fotek */
.gallery-grid[data-count="4"],
.gallery-grid[data-count="5"] {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 300px 150px;
}
.gallery-grid[data-count="4"] > .gallery-item-wrapper:nth-child(1),
.gallery-grid[data-count="4"] > img:nth-child(1),
.gallery-grid[data-count="5"] > .gallery-item-wrapper:nth-child(1),
.gallery-grid[data-count="5"] > img:nth-child(1) {
    grid-column: 1 / -1;
    height: 100% !important;
}

/* Common styles for images in grid */
.text-editor .gallery-grid img,
.gallery-grid img {
    width: 100% !important;
    height: 100% !important;
    min-height: 150px;
    object-fit: cover !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: opacity 0.3s ease;
    margin: 0 !important;
    display: block;
    opacity: 1;
}

.text-editor .gallery-grid img:hover,
.gallery-grid img:hover {
    opacity: 0.6; /* Zprůhlednění -> prosvítá tmavě modré pozadí */
    transform: none;
    box-shadow: none;
}

/* Container wrapper styles */
.text-editor .gallery-item-wrapper,
.gallery-item-wrapper {
    position: relative;
    overflow: hidden;
    height: 100% !important;
    border-radius: 0 !important;
    background-color: #171925;
}

.text-editor .gallery-item-wrapper img,
.gallery-item-wrapper img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
}

/* Overlay for "+X" images */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(23, 25, 37, 0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: background-color 0.3s ease;
    backdrop-filter: blur(2px);
}

.gallery-overlay:hover {
    background-color: rgba(241, 0, 141, 0.4);
}

/* ===== ENHANCED LIGHTBOX (MINIMALIST) ===== */
#lightbox {
    display: none;
    position: fixed;
    z-index: 2000000000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(23, 25, 37, 0.98); /* Tmavší pozadí v barvě webu */
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    user-select: none;
}

#lightbox.active {
    display: flex;
}

#lightbox-content {
    position: relative;
    width: 100%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 0; /* Ostré rohy */
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
    position: relative;
    transform: none;
    top: auto;
    right: auto;
}

/* Controls - Minimalist arrows */
.lightbox-btn {
    position: absolute;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    font-size: 3rem;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-btn:hover {
    background: transparent;
    color: #f1008d;
    transform: scale(1.1);
}

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

#lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    color: white;
    font-size: 3rem;
    padding: 10px;
    cursor: pointer;
    z-index: 2000000001;
    border: none;
    line-height: 1;
    font-weight: 100;
    opacity: 0.7;
    transition: all 0.2s ease;
}

#lightbox-close:hover {
    opacity: 1;
    color: #f1008d;
}

#lightbox-counter {
    position: absolute;
    top: 30px;
    left: 30px;
    color: white;
    font-size: 1.2rem;
    font-family: monospace;
    background: transparent;
    padding: 5px 10px;
    border-radius: 0;
    font-weight: 300;
    letter-spacing: 2px;
}

/* Thumbnails strip */
#lightbox-thumbnails {
    height: 15%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-thumb {
    height: 80%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 0;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.3s ease;
    border: none;
    border-bottom: 2px solid transparent;
}

.lightbox-thumb:hover {
    opacity: 0.8;
    transform: none;
}

.lightbox-thumb.active {
    opacity: 1;
    border-bottom: 2px solid #f1008d;
}

/* Hide navigation on single image */
#lightbox.single .lightbox-btn,
#lightbox.single #lightbox-thumbnails,
#lightbox.single #lightbox-counter {
    display: none;
}