/**
 * C2PA Gallery Styles
 * Basic styles for the Elementor gallery widget
 */

.c2pa-viewer-wrapper {
    display: block;
    width: 100%;
    position: relative;
}

.c2pa-gallery-wrapper {
    display: block;
    width: 100%;
    position: relative;
}

.c2pa-masonry-gallery {
    column-count: var(--columns, 3);
    column-gap: var(--gap, 15px);
    column-fill: balance;
    width: 100%;
}

.c2pa-gallery-item {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: var(--gap, 15px);
    page-break-inside: avoid;
}

.c2pa-image-container {
    position: relative;
    display: block;
    max-width: 100%;
    width: 100%;
    overflow: visible;
    break-inside: avoid;
}

.c2pa-image {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* C2PA Icon Overlay - Top Left */
.c2pa-icon-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    pointer-events: auto;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.c2pa-icon-overlay:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.c2pa-icon-overlay .c2pa-icon {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

/* Badge link styling */
.c2pa-icon-overlay .c2pa-badge-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.c2pa-icon-overlay .c2pa-badge-link:hover {
    opacity: 0.8;
}

.c2pa-icon-overlay .c2pa-badge-link .c2pa-icon {
    pointer-events: none; /* Prevent double-click issues */
}

/* Remove old badge styles */
.c2pa-credentials-badge {
    display: none;
}

/* Ensure proper display in Elementor editor */
.elementor-widget-c2pa-gallery .c2pa-viewer-wrapper,
.elementor-widget-c2pa-gallery .c2pa-gallery-wrapper {
    display: block;
}

/* Hide status display by default - shown after verification via JavaScript */
.c2pa-status-display {
    display: none;
}

/* JavaScript will set display: block when status is updated */

/* Hide badge control by default - will be shown via JavaScript when C2PA credentials are found */
.elementor-control-show_credentials_badge {
    display: none !important;
}

.elementor-control-show_credentials_badge:not(.elementor-control-hidden) {
    display: block !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .c2pa-viewer-wrapper,
    .c2pa-gallery-wrapper {
        width: 100%;
        position: relative;
        overflow: visible;
    }
    
    .c2pa-masonry-gallery {
        column-count: 2;
    }
    
    .c2pa-image-container {
        position: relative;
        overflow: visible;
    }
    
    .c2pa-icon-overlay {
        position: absolute !important;
        top: 5px;
        left: 5px;
        padding: 4px;
        z-index: 999 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .c2pa-icon-overlay .c2pa-icon {
        width: 24px;
        height: 24px;
        display: block !important;
    }
}

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

/* iPhone specific fixes */
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 812px) 
    and (-webkit-min-device-pixel-ratio: 2) {
    .c2pa-icon-overlay {
        position: absolute !important;
        z-index: 999 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Lightbox Styles */
.c2pa-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.c2pa-lightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    pointer-events: auto !important;
}

.c2pa-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.c2pa-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    pointer-events: none; /* Allow clicks to pass through to overlay */
}

.c2pa-lightbox-content > * {
    pointer-events: auto; /* Re-enable pointer events for interactive elements */
}

.c2pa-lightbox-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* C2PA Badge in Lightbox */
.c2pa-lightbox-badge-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10003;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none; /* Hidden by default, shown by JavaScript when image has C2PA */
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    pointer-events: auto;
}

.c2pa-lightbox-badge-overlay.show {
    display: flex !important;
}

.c2pa-lightbox-badge-overlay:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.c2pa-lightbox-badge-overlay .c2pa-lightbox-icon {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.c2pa-lightbox-badge-overlay .c2pa-lightbox-badge-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.c2pa-lightbox-badge-overlay .c2pa-lightbox-badge-link:hover {
    opacity: 0.8;
}

.c2pa-lightbox-badge-overlay .c2pa-lightbox-badge-link .c2pa-lightbox-icon {
    pointer-events: none;
}

.c2pa-lightbox-badge-overlay .c2pa-lightbox-icon-direct {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.c2pa-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.c2pa-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.3s ease, transform 0.2s ease;
}

.c2pa-lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.c2pa-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.3s ease, transform 0.2s ease;
    user-select: none;
}

.c2pa-lightbox-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.c2pa-lightbox-prev {
    left: 20px;
}

.c2pa-lightbox-next {
    right: 20px;
}

.c2pa-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .c2pa-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .c2pa-lightbox-prev {
        left: 10px;
    }
    
    .c2pa-lightbox-next {
        right: 10px;
    }
    
    .c2pa-lightbox-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    .c2pa-lightbox-image {
        max-height: 85vh;
    }
}

