:root {
    --ccgallery-color-primary: #000;
    --ccgallery-color-background: #fff;
    --ccgallery-color-text: #1a1a1a;
    --ccgallery-color-text-light: #666;
    --color-button-hover: #333;
    --ccgallery-spacing-sm: 0.5rem;
    --ccgallery-spacing-md: 1rem;
    --spacing-ccgallery: 1.5rem;
    --ccgallery-spacing-xl: 2rem;
    --ccgallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ccgallery-radius-md: 0.375rem;
}

.ccgallery * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.ccgallery {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background-color: var(--ccgallery-color-background);
    color: var(--ccgallery-color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Lightbox Overlay */
.ccgallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(3px);
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000000;
    opacity: 0;
    pointer-events: none;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.ccgallery-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

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

.ccgallery-content {
    position: absolute;
    top: 47px;
    left: 0;
    right: 0;
    bottom: 90px;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ccgallery-slider-track {
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    -webkit-transition: opacity 0s;
    -o-transition: opacity 0s;
    transition: opacity 0s;
    white-space: nowrap;
}
.ccgallery-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ccgallery-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.ccgallery-toolbar {
    z-index: 1082;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
}
.ccgallery-play {
    color: #fff;
    cursor: pointer;
    float: right;
    font-size: 24px;
    height: 47px;
    line-height: 27px;
    padding: 10px 0;
    text-align: center;
    width: 50px;
    text-decoration: none !important;
    outline: medium none;
    will-change: color;
    -webkit-transition: color 0.2s linear;
    -o-transition: color 0.2s linear;
    transition: color 0.2s linear;
    background: 0 0;
    border: none;
    box-shadow: none;
}
/* Close Button */
.ccgallery-close {
    color: #fff;
    cursor: pointer;
    float: right;
    font-size: 24px;
    height: 47px;
    line-height: 27px;
    padding: 10px 0;
    text-align: center;
    width: 50px;
    text-decoration: none !important;
    outline: medium none;
    will-change: color;
    -webkit-transition: color 0.2s linear;
    -o-transition: color 0.2s linear;
    transition: color 0.2s linear;
    background: 0 0;
    border: none;
    box-shadow: none;
}

.ccgallery-counter {
    color: #fff;
    display: inline-block;
    font-size: 16px;
    padding-left: 20px;
    padding-top: 12px;
    height: 47px;
    vertical-align: middle;
}
.ccgallery-zoom-in,
.ccgallery-zoom-out,
.ccgallery-reset-zoom,
.ccgallery-download {
    color: #fff;
    cursor: pointer;
    float: right;
    font-size: 24px;
    height: 47px;
    line-height: 27px;
    padding: 10px 0;
    text-align: center;
    width: 50px;
    text-decoration: none !important;
    outline: medium none;
    will-change: color;
    -webkit-transition: color 0.2s linear;
    -o-transition: color 0.2s linear;
    transition: color 0.2s linear;
    background: 0 0;
    border: none;
    box-shadow: none;
}
/* Navigation Buttons */
.ccgallery-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--ccgallery-radius-md);
    transition: var(--ccgallery-transition);
    user-select: none;
}

.ccgallery-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.ccgallery-next,
.ccgallery-prev {
    background-color: rgba(0, 0, 0, 0.45);
    border-radius: 2px;
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    margin-top: -10px;
    padding: 8px 10px 9px;
    position: absolute;
    top: 50%;
    z-index: 1084;
    outline: 0;
    border: none;
    transition: all 0.3s ease 0s;
}

.ccgallery-prev {
    left: 20px;
}

.ccgallery-next {
    right: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ccgallery-prev {
        left: var(--ccgallery-spacing-md);
    }

    .ccgallery-next {
        right: var(--ccgallery-spacing-md);
    }
}

@media (max-width: 768px) {
    .gallery-section h1 {
        font-size: 1.75rem;
    }

    .ccgallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--ccgallery-spacing-md);
    }

    .ccgallery-item {
        height: 150px;
    }

    .ccgallery-close {
        top: var(--ccgallery-spacing-md);
        right: var(--ccgallery-spacing-md);
    }

    .ccgallery-btn {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .ccgallery-prev {
        left: var(--ccgallery-spacing-md);
    }

    .ccgallery-next {
        right: var(--ccgallery-spacing-md);
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-ccgallery);
    }

    .gallery-section h1 {
        font-size: 1.5rem;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--ccgallery-spacing-sm);
    }

    .gallery-item {
        height: 120px;
    }

    .ccgallery-img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .ccgallery-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .ccgallery-close {
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }
}

.ccgallery-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    overflow-x: hidden;
    max-height: 120px;
}

.ccgallery-thumbnails-track {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    min-width: min-content;
}

.ccgallery-thumbnail {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.ccgallery-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.ccgallery-thumbnail.active {
    border-color: #fff;
    opacity: 1;
    transform: scale(1.1);
}

/* Hide thumbnails when zoomed */
.ccgallery-overlay.zoomed .ccgallery-thumbnails {
    display: none;
}

/* Adjust content height when thumbnails are visible */
.ccgallery-overlay:not(.zoomed) .ccgallery-content {
    padding-bottom: 120px;
}

/* Main image loader */
.ccgallery-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.ccgallery-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ccgallery-spin 1s ease-in-out infinite;
    margin: 0 auto 10px;
}

.ccgallery-loading-text {
    color: white;
    font-size: 14px;
}

.ccgallery-error {
    color: #ff6b6b;
    font-size: 14px;
}

/* Thumbnail loader */
.ccgallery-thumbnail-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.ccgallery-thumbnail-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ccgallery-spin 1s ease-in-out infinite;
}

/* Image loading states */
.ccgallery-img.loading {
    opacity: 0 !important;
}

.ccgallery-img:not(.loading) {
    opacity: 1 !important;
}

/* Thumbnail image container */
.ccgallery-thumbnail-img-container {
    position: relative;
}

/* Spinner animation */
@keyframes ccgallery-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Ensure proper stacking */
.ccgallery-img-container {
    position: relative;
}

.ccgallery-thumbnail {
    position: relative;
}
