/* 
 * Image Overlay CSS for Abhijeet's Portfolio
 * Handles the popup overlay for logo and profile image
 */

.image-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000; /* Very high z-index to ensure it's on top */
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-overlay.active {
    opacity: 1;
    display: flex !important; /* Force flex display when active */
    justify-content: center;
    align-items: center;
}

.overlay-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: zoomIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.close-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.close-overlay:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

#overlay-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#overlay-image.loaded {
    transform: scale(1);
}

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

/* Improved clickable image styling */
.clickable-image {
    cursor: pointer !important;
    position: relative;
    overflow: hidden;
}

.clickable-image img {
    cursor: pointer !important; /* Ensure cursor is pointer */
}

.clickable-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.clickable-image:hover::after {
    transform: scale(1);
    opacity: 1;
}

/* Special handling for both desktop and mobile */
@media (min-width: 768px) {
    /* Desktop specific adjustments */
    .overlay-content {
        max-width: 80%;
        max-height: 85vh;
    }
    
    #overlay-image {
        max-height: 85vh;
    }
    
    .close-overlay {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    /* Additional visibility for desktop */
    .profile-pic-container, 
    .profile-image-container {
        cursor: pointer !important;
    }
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .overlay-content {
        max-width: 95%;
    }
    
    #overlay-image {
        max-height: 70vh;
    }
    
    .close-overlay {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* Animation to indicate images are clickable */
@keyframes subtle-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.profile-image-container:hover,
.profile-pic-container:hover {
    animation: subtle-pulse 1.5s infinite;
}
/* Add to image-overlay.css */
/* Ensure clickable elements have highest priority */
.profile-pic-container, 
.profile-image-container,
#sidebar-logo,
.profile-pic,
.profile-pic-small {
    z-index: 5 !important;
    position: relative !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Disable pointer events on pseudo-elements during transition */
.profile-pic-container::before,
.profile-pic-container::after,
.profile-image-container::before,
.profile-image-container::after {
    pointer-events: none !important;
}

/* Replace the &times; with a symmetric CSS-based X */
.close-icon {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.close-icon::before,
.close-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background-color: white;
    border-radius: 1px;
}

.close-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.close-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Improved hover effect for the close button */
.close-overlay:hover .close-icon::before,
.close-overlay:hover .close-icon::after {
    width: 22px; /* Slightly larger on hover */
    transition: width 0.3s ease, transform 0.3s ease;
}

/* Add to image-overlay.css */
/* Prevent layout shift during overlay open/close */
body {
    transition: padding-right 0.3s ease;
}

/* Ensure overlay position is fixed correctly */
.image-overlay {
    transition: opacity 0.3s ease;
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Improve animation performance */
.overlay-content {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Make close button animation smoother */
.close-overlay {
    transform-origin: center center;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}