:root {
    --clg-overlay-bg: rgba(0, 0, 0, 0.9);
    --clg-primary: #8b5cf6; /* Purple Canva-like */
    --clg-primary-hover: #7c3aed;
    --clg-text: #ffffff;
    --clg-button-bg: rgba(255, 255, 255, 0.1);
    --clg-button-hover: rgba(255, 255, 255, 0.2);
    --clg-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Lightbox Overlay */
#clg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--clg-overlay-bg);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

#clg-lightbox.active {
    display: flex;
    opacity: 1;
}

/* Content Container */
.clg-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: clg-zoom 0.4s ease;
}

@keyframes clg-zoom {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#clg-main-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.1);
}

/* Navigation Buttons */
.clg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--clg-button-bg);
    color: var(--clg-text);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--clg-transition);
    user-select: none;
    z-index: 10;
}

.clg-nav:hover {
    background: var(--clg-button-hover);
    transform: translateY(-50%) scale(1.1);
}

.clg-prev { left: -80px; }
.clg-next { right: -80px; }

/* Close Button */
.clg-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: var(--clg-text);
    font-size: 30px;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--clg-transition);
}

.clg-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Download Button Container */
.clg-footer {
    margin-top: 25px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.clg-download-btn {
    background: linear-gradient(135deg, var(--clg-primary), #a78bfa);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--clg-transition);
    box-shadow: 0 8px 15px rgba(139, 92, 246, 0.2);
}

.clg-download-btn.pdf-btn {
    background: linear-gradient(135deg, #ef4444, #f87171);
    box-shadow: 0 8px 15px rgba(239, 68, 68, 0.2);
}

.clg-download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(139, 92, 246, 0.3);
    color: white;
}

.clg-download-btn.pdf-btn:hover {
    box-shadow: 0 12px 25px rgba(239, 68, 68, 0.3);
}

.clg-download-btn svg {
    width: 20px;
    height: 20px;
}

/* Loader for PDF generation */
.clg-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: clg-spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes clg-spin {
    to { transform: rotate(360deg); }
}

/* Badge "NO EDITABLE" */
.clg-badge-container {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e60023;
    color: white;
    padding: 5px 10px;
    border-radius: 50px;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.3);
}

.clg-badge-container svg {
    width: 12px;
    height: 12px;
}

/* Gallery Card Style */
.gallery, .wp-block-gallery, .blocks-gallery-grid, .wp-block-gallery.has-nested-images {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: center !important;
    padding: 20px 0 !important;
}

.gallery-item, .wp-block-image, .blocks-gallery-item {
    position: relative !important;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 15px;
    margin: 0 !important; /* Reset margins to use gap */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex !important;
    flex-direction: column;
    width: calc(20% - 20px) !important; /* Default for 5 columns */
    min-width: 200px;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .gallery-item, .wp-block-image, .blocks-gallery-item { width: calc(25% - 20px) !important; }
}

@media (max-width: 900px) {
    .gallery-item, .wp-block-image, .blocks-gallery-item { width: calc(33.33% - 20px) !important; }
}

@media (max-width: 600px) {
    .gallery-item, .wp-block-image, .blocks-gallery-item { width: 100% !important; }
}

.gallery-item:hover, .wp-block-image:hover, .blocks-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.gallery-item img, .wp-block-image img, .blocks-gallery-item img {
    border-radius: 16px !important;
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
}

/* Front-end Button below image */
.clg-front-buttons {
    display: flex;
    justify-content: center;
    margin-top: auto; /* Push to bottom of flex container */
    padding-top: 15px;
}

.clg-front-btn {
    width: 100%;
    max-width: 250px;
    color: white !important;
    text-decoration: none !important;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    cursor: pointer;
    background: #22c55e; /* Premium Green */
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.clg-front-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
    filter: brightness(1.1);
}

.clg-front-btn svg {
    width: 20px;
    height: 20px;
}
@media (max-width: 1024px) {
    .clg-prev { left: 10px; background: rgba(0,0,0,0.5); }
    .clg-next { right: 10px; background: rgba(0,0,0,0.5); }
}

@media (max-width: 768px) {
    .clg-nav { width: 45px; height: 45px; font-size: 18px; }
    .clg-download-btn { padding: 12px 24px; font-size: 14px; }
}
