/* Gallery Grid */
.mack-gallery-container,
.mack-gallery-all-wrapper {
    margin-bottom: 20px;
    /* Reduced from 40px */
}

/* Main Layout: Arrow - Grid - Arrow */
.mack-gallery-main-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

/* Grid Wrapper (to contain grid) */
.mack-gallery-grid {
    flex: 1;
    display: grid;
    gap: 5px;
    /* Reduced from 10px */
    margin: 0 !important;
    padding: 0 !important;
}

/* Default columns for single gallery (can be overridden by inline styles) */
.mack-gallery-grid:not([style*="grid-template-columns"]) {
    grid-template-columns: repeat(3, 1fr);
}

/* All Albums Grid - Force 3 columns or responsive */
.mack-gallery-all-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.mack-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    aspect-ratio: 1 / 1;
    /* Square items */
    margin: 0 !important;
    padding: 0 !important;
    background: #000;
    /* Fallback background */
}

.mack-gallery-item:hover {
    transform: translateY(-5px);
}

/* Absolute positioning to guarantee fill */
.mack-gallery-item a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: inherit;
    border: none !important;
}

.mack-gallery-item img {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: bottom;
    /* Ensure no ghost space */
}

/* Filter Tabs */
.mack-gallery-filter-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.mack-gallery-tab {
    background: #333;
    /* Dark background */
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
}

.mack-gallery-tab:hover {
    background: #555;
    transform: translateY(-2px);
}

.mack-gallery-tab.active {
    background: #ff0000;
    /* Red active */
    color: #fff;
}

/* All Albums Wrapper - Dark Theme */
.mack-gallery-all-wrapper {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    overflow: visible !important;
}

/* Fix for wpautop adding extra spacing */
.mack-gallery-all-wrapper p,
.mack-gallery-all-wrapper br,
.mack-gallery-main-layout p,
.mack-gallery-main-layout br {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Pagination Arrows (Simple Text) */
.mack-gallery-page-prev,
.mack-gallery-page-next {
    position: static;
    transform: none;
    width: auto;
    /* Auto width */
    height: auto;
    /* Auto height */
    border-radius: 0;
    /* No radius */
    background: transparent;
    /* Transparent background */
    color: #fff;
    /* White text */
    border: none;
    /* No border */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 40px;
    /* Larger font size for visibility */
    line-height: 1;
    z-index: 9999;
    flex-shrink: 0;
    box-shadow: none;
    /* No shadow */
    padding: 0 10px;
    /* Add some padding for click area */
}

.mack-gallery-page-prev:hover,
.mack-gallery-page-next:hover {
    background: transparent;
    color: #ff0000;
    /* Red on hover */
    transform: scale(1.2);
    /* Slight scale */
}

.mack-gallery-page-prev:disabled,
.mack-gallery-page-next:disabled {
    background: transparent;
    color: #555;
    opacity: 0.5;
    cursor: default;
    border-color: transparent;
}

/* Pagination Dots */
.mack-gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.mack-gallery-page-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #444;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0;
    transition: background 0.3s ease, transform 0.2s ease;
}

.mack-gallery-page-dot.active,
.mack-gallery-page-dot:hover {
    background: #ff0000;
    transform: scale(1.1);
}

/* Lightbox */
.mack-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mack-gallery-lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.mack-gallery-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mack-gallery-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.mack-gallery-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 100000;
    line-height: 1;
    transition: transform 0.2s ease;
}

.mack-gallery-lightbox-close:hover {
    transform: scale(1.1);
    color: #ff0000;
}

.mack-gallery-lightbox-prev,
.mack-gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 60px;
    cursor: pointer;
    z-index: 100000;
    padding: 20px;
    user-select: none;
    transition: color 0.3s ease, transform 0.2s ease;
}

.mack-gallery-lightbox-prev:hover,
.mack-gallery-lightbox-next:hover {
    color: #ff0000;
    transform: translateY(-50%) scale(1.1);
}

.mack-gallery-lightbox-prev {
    left: 20px;
}

.mack-gallery-lightbox-next {
    right: 20px;
}