.hgs-gallery-container {
    margin: 0 auto;
    max-width: 100%;
    width: var(--hgs-container-width, 100%);
    padding: 0 15px;
    box-sizing: border-box;
}



.hgs-masonry-wrapper {
    column-count: var(--hgs-columns, 3);
    column-gap: var(--hgs-gap, 20px);
}

/* === Justified Grid Layout === */
.hgs-justified-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: var(--hgs-gap, 20px) !important;
}

.hgs-justified-wrapper::after {
    display: none !important;
}

.hgs-justified-wrapper .hgs-item {
    margin-bottom: 0 !important;
}

.hgs-justified-wrapper .hgs-image-link {
    display: block !important;
    height: 100% !important;
    width: 100% !important;
}

.hgs-justified-wrapper .hgs-item img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
}

.hgs-item {
    break-inside: avoid;
    margin-bottom: var(--hgs-gap, 20px);
    position: relative;
    overflow: hidden !important;
    border: var(--hgs-image-border-width, 0px) var(--hgs-image-border-style, solid) var(--hgs-image-border-color, #cccccc) !important;
    border-radius: var(--hgs-image-radius, 0px) !important;
    box-sizing: border-box !important;
}

.hgs-image-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.hgs-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

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

/* === Overlay Container (holds background & title) === */
.hgs-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    padding: 15px;
    box-sizing: border-box;
    pointer-events: none;
}

/* === Background Overlay Layer (opacity set by admin) === */
.hgs-color-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--hgs-hover-color, rgba(0,0,0,0.5));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.hgs-image-link:hover .hgs-color-layer {
    opacity: var(--hgs-hover-opacity, 0.6);
}

/* === Title Layer (opacity controlled independently) === */
.hgs-title {
    position: relative;
    z-index: 2;
    color: var(--hgs-title-color, #fff);
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.3em;
    max-width: 100%;
    word-break: break-word;
    background: transparent;
    padding: 6px 10px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hgs-image-link:hover .hgs-title {
    opacity: 1;
}

/* Enhanced Pagination Styles */
.hgs-pagination {
    margin-top: 40px;
    text-align: center;
    clear: both;
}

.hgs-pagination a,
.hgs-pagination span {
    display: inline-block;
    margin: 0 3px;
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid;
    min-width: 1.5em;
    line-height: 1.5;
    text-align: center;
    transition: all 0.3s ease;
}

.hgs-pagination .current,
.hgs-pagination a:hover {
    color: #fff !important;
}

.hgs-load-more-button {
    display: inline-block;
    padding: 12px 24px;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hgs-loading {
    margin-top: 20px;
    font-style: italic;
}

.hgs-infinite-scroll-trigger {
    height: 50px;
    margin-top: 30px;
}

/* Responsive Columns */
@media (max-width: 1024px) {
    .hgs-masonry-wrapper {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .hgs-masonry-wrapper {
        column-count: 1;
    }
    
    .hgs-pagination a,
    .hgs-pagination span {
        padding: 6px 10px;
        margin: 0 2px;
    }
}

/* Rounded corners for grid images */
.hgs-image-link img {
    border-radius: var(--hgs-image-radius);
}

/* Ensure round corners are consistent across all layers */
.hgs-image-link img,
.hgs-overlay,
.hgs-color-layer {
    border-radius: var(--hgs-image-radius, 0px);
    overflow: hidden;
}

/* Explicitly remove any theme-level borders/shadows around the entire gallery area */
.hgs-gallery-container,
.hgs-outer-container,
.hgs-masonry-wrapper,
.hgs-justified-wrapper {
    border: none !important;
    box-shadow: none !important;
}

/* === Search Bar Layout === */
.hgs-search-bar-container {
    display: flex !important;
    justify-content: center !important;
    margin: 25px auto 35px auto !important;
    max-width: var(--hgs-search-width, 600px) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 15px !important;
}

.hgs-search-form {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    border: 2px solid var(--hgs-search-border, #e0e0e0) !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    transition: border-color 0.3s ease !important;
    height: 48px !important;
    box-sizing: border-box !important;
}

.hgs-search-form:focus-within {
    border-color: var(--hgs-search-border-focus, #2ecc71) !important;
}

.hgs-search-input {
    flex-grow: 1 !important;
    border: none !important;
    padding: 10px 16px !important;
    font-size: 15px !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: 44px !important;
    box-sizing: border-box !important;
    color: #333333 !important;
}

.hgs-search-cat-select {
    border: none !important;
    border-left: 1px solid #e0e0e0 !important;
    padding: 0 15px !important;
    font-size: 14px !important;
    outline: none !important;
    background: #fcfcfc !important;
    height: 44px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    max-width: 160px !important;
    color: #555555 !important;
    border-radius: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 14px !important;
    padding-right: 30px !important;
}

.hgs-search-submit {
    background: var(--hgs-search-btn-color, #2ecc71) !important;
    border: none !important;
    width: 46px !important;
    height: 44px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.3s ease !important;
    color: #ffffff !important;
    padding: 0 !important;
    outline: none !important;
}

.hgs-search-submit:hover {
    background: var(--hgs-search-btn-hover, #27ae60) !important;
}

.hgs-search-submit svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor !important;
}

@media (max-width: 580px) {
    .hgs-search-form {
        height: auto !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    
    .hgs-search-input {
        width: 100% !important;
        border-bottom: 1px solid #e0e0e0 !important;
    }
    
    .hgs-search-cat-select {
        flex-grow: 1 !important;
        border-left: none !important;
        max-width: 100% !important;
        height: 40px !important;
    }
    
    .hgs-search-submit {
        flex-grow: 0 !important;
        width: 50px !important;
        height: 40px !important;
    }
}

/* === Section Header Layout (pngtree style) === */
.hgs-header-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    margin-bottom: 25px !important;
    width: 100% !important;
    padding-bottom: 12px !important;
    box-sizing: border-box !important;
}

.hgs-header-left {
    flex-grow: 1 !important;
}

.hgs-section-title {
    margin: 0 0 6px 0 !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.hgs-section-subtitle {
    margin: 0 !important;
    font-weight: 400 !important;
}

.hgs-header-right {
    flex-shrink: 0 !important;
    margin-left: 20px !important;
}

.hgs-explore-link {
    display: inline-block !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}

/* Link Style */
.hgs-explore-link.hgs-style-link {
    color: var(--hgs-explore-color, #27ae60) !important;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

.hgs-explore-link.hgs-style-link:hover {
    color: var(--hgs-explore-hover-color, #1e7e34) !important;
    text-decoration: underline !important;
    background: transparent !important;
}

/* Button Style */
.hgs-explore-link.hgs-style-button {
    color: var(--hgs-explore-color, #27ae60) !important;
    border: 2px solid var(--hgs-explore-color, #27ae60) !important;
    padding: 6px 16px !important;
    border-radius: 4px !important;
    background: transparent !important;
}

.hgs-explore-link.hgs-style-button:hover {
    background-color: var(--hgs-explore-hover-color, #1e7e34) !important;
    border-color: var(--hgs-explore-hover-color, #1e7e34) !important;
    color: #ffffff !important;
}

@media (max-width: 580px) {
    .hgs-header-container {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .hgs-header-right {
        margin-left: 0 !important;
        margin-top: 15px !important;
        width: 100% !important;
    }
    
    .hgs-explore-link {
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }
}
