/* Masonry Gallery Styles */
.masonry-container {
    column-count: 3;
    column-gap: 1rem;
    margin: 0 auto;
    max-width: 100%;
}

@media (max-width: 768px) {
    .masonry-container {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .masonry-container {
        column-count: 1;
    }
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    display: inline-block;
    width: 100%;
}

.gallery-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content-image {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.nav-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s ease;
    pointer-events: all;
    transform: translateY(-50%);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev-btn {
    margin-left: -60px;
}

.next-btn {
    margin-right: -60px;
}

@media (max-width: 768px) {
    .prev-btn {
        margin-left: -50px;
    }

    .next-btn {
        margin-right: -50px;
    }

    .nav-btn {
        font-size: 1.5rem;
        padding: 8px 12px;
    }
}

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

/* Ensure equal height cards */
.grid.md\\:grid-cols-3 > * {
    display: flex;
    flex-direction: column;
}

.grid.md\\:grid-cols-3 > * > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid.md\\:grid-cols-3 .flex-grow {
    flex: 1;
}
/* Masonry layout for ons-aanbod categories */
.masonry-container.aanbod-masonry {
    column-count: 2;
    column-gap: 1.5rem;
}

@media (min-width: 1280px) {
    .masonry-container.aanbod-masonry {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .masonry-container.aanbod-masonry {
        column-count: 1;
        column-gap: 1rem;
    }
}

/* Ensure proper spacing for aanbod items */
.masonry-container.aanbod-masonry .masonry-item {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
    break-inside: avoid;
}

@media (max-width: 768px) {
    .masonry-container.aanbod-masonry .masonry-item {
        margin-bottom: 1rem;
    }
}

/* Prevent content overflow and ensure proper text wrapping */
.masonry-container.aanbod-masonry .masonry-item > div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Fix table/list content in masonry items */
.masonry-container.aanbod-masonry .prose table {
    width: 100%;
    table-layout: fixed;
    word-break: break-word;
}

.masonry-container.aanbod-masonry .prose td,
.masonry-container.aanbod-masonry .prose th {
    word-wrap: break-word;
    overflow-wrap: break-word;
}