.sd-kanga-galerii {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    grid-gap: 10px;
}

/** fit the entire image inside the container */
.sd-kanga-galerii-item {
    width: auto;
    height: 150px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sd-kanga-galerii-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sd-kanga-galerii img:hover {
    opacity: 0.7;
}

/* The Modal (background) */
.sd-kanga-galerii-modal {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%; /* Changed from 100vw to 100% */
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85);
}

.sd-kanga-galerii-modal.is-active {
    display: flex; /* Only show when active */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
}

/* Modal Content (the white box) */
.sd-kanga-galerii-modal-content {
    margin: auto;
    display: block;
    animation-name: zoom;
    animation-duration: 0.6s;
}

@keyframes zoom {
    from {transform:scale(0)}
    to {transform:scale(1)}
}

/* Close Button */
.sd-kanga-galerii-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 100001;
}

.sd-kanga-galerii-modal-close:hover,
.sd-kanga-galerii-modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Default mobile-first styles */
.sd-kanga-galerii-square-container {
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.sd-kanga-galerii-main-image {
    width: 100%;
    height: auto;
}

.sd-kanga-galerii-modal-title {
    font-size: 1.2em;
    font-weight: bold;
    text-align: left;
    text-transform: uppercase !important
}

.sd-kanga-galerii-info-section {
    padding: 30px;
}

#sd-kanga-galerii-modal-caption {
    text-align: left;
}
#sd-kanga-galerii-modal-caption-content {
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
}
#sd-kanga-galerii-modal-caption-info {
    margin-top: 1em;
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
}

/* Prev & Next arrows - general styling */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 16px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  transition: 0.6s ease;
  user-select: none;
  text-decoration: none;
}

/* On mobile, arrows are outside the image */
.prev { left: 0; }
.next { right: 0; }
.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
}


/* Desktop-specific styles for the square layout */
@media screen and (min-width: 768px) {
    .sd-kanga-galerii-square-container {
        display: flex;
        width: 75vh;
        height: 75vh;
        background-color: #fff;
        position: relative;
        border: 1px solid #ffd04f;
        flex-direction: row;
    }

    .sd-kanga-galerii-image-section {
        flex: 1; /* Takes up 50% */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        position: relative; /* For arrow positioning */
        overflow: hidden;
    }

    .sd-kanga-galerii-main-image {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .sd-kanga-galerii-info-section {
        flex: 1; /* Takes up 50% */
        padding: 50px 30px;
        overflow-y: auto;
        background-color: white;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .sd-kanga-galerii-modal-title {
        font-size: 1em;
        font-weight: bold;
        text-transform: uppercase !important
    }

    #sd-kanga-galerii-modal-caption {
        text-align: left;
        color: #333;
        padding: 0;
        font-size: 16px;
        line-height: 1.6;
        font-weight: 600;
    }

    #sd-kanga-galerii-modal-caption-content {
        font-weight: normal;
    }
    #sd-kanga-galerii-modal-caption-info {
        font-weight: normal;
        margin-top: 1em;
    }

    #sd-kanga-galerii-modal-caption-content strong {
        display: inline-block;
        min-width: 80px;
    }

    /* Arrow styling for desktop */
    .sd-kanga-galerii-image-section .prev,
    .sd-kanga-galerii-image-section .next {
        top: 50%;
        transform: translateY(-50%);
        color: #fff;
        background-color: rgba(0,0,0,0.3);
        opacity: 0; /* Hidden by default */
        transition: opacity 0.3s;
    }

    .sd-kanga-galerii-image-section:hover .prev,
    .sd-kanga-galerii-image-section:hover .next {
        opacity: 1; /* Visible on hover of image section */
    }

    .sd-kanga-galerii-image-section .prev {
        left: 20px; /* Inside padding */
        border-radius: 3px 0 0 3px;
    }

    .sd-kanga-galerii-image-section .next {
        right: 20px; /* Inside padding */
        border-radius: 0 3px 3px 0;
    }
}

/* --- Filter Styles --- */
.sd-kanga-filter {
    margin: 5px 0;
}

.sd-kanga-filter-label-wrapper {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.sd-kanga-filter-label-wrapper:hover {
    background-color: #f0f0f0;
}

.sd-kanga-filter-checkbox {
    margin-right: 8px;
}