.custom-avatar-container {
    text-align: center;
    position: relative;
    display: inline-block;
    width: 100%; /* Make sure container uses full width for responsiveness */
    max-width: 150px; /* Limit max width for larger screens */
}

.profile-picture-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

/* Hide the text when hovering */
.avatar-wrapper:hover .profile-picture-text {
    opacity: 0;
}



/* Profile Picture Wrapper */
.avatar-wrapper {
    position: relative;
    display: inline-block;
    width: 85px; /* Default size */
    height: 85px; /* Default size */
    cursor: pointer;
    overflow: visible; /* Ensure icons are visible */
    margin: 0 auto; /* Center the avatar on smaller screens */
}

/* Profile Image - Always Circular */
.avatar-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill; /* Changed from 'fill' to 'cover' to ensure proper image scaling */
    border-radius: 50% !important; /* Ensures uploaded image remains circular */
}

/* Hover Overlay - Prevents File Selection When Clicking Remove Icon */
.hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 5;
    border-radius: 50%;
    pointer-events: none; /* Prevents clicking overlay when clicking remove icon */
}

.avatar-wrapper:hover .hover-overlay {
    opacity: 1;
}

/* Default: Remove Icon Hidden */
#remove-icon {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    color: white;
    background: red;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease-in-out;
    font-weight: bold;
}

/* Show Remove Icon on Hover (Desktop Only) */
@media (hover: hover) {
    .avatar-wrapper.has-custom-image:hover #remove-icon {
        opacity: 1;
    }
}

/* Always Show Remove Icon on Mobile */
@media (max-width: 1024px) {
    #remove-icon {
        opacity: 1 !important;
    }
}

/* Save Button - Smaller & Closer to Profile Picture */
#save-avatar {
    position: absolute;
    bottom: -10px; /* Move closer to the profile picture */
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    font-size: 12px; /* Make it smaller */
    border-radius: 5px;
    background-color: #0073aa;
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    z-index: 10;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.modal-content p {
    margin-bottom: 15px;
    color: #220D4A;
}

.modal button {
    padding: 5px 15px;
    border: none;
    margin: 5px;
    cursor: pointer;
    border-radius: 5px;
}

#confirm-delete {
    background: red;
    color: white;
}

#cancel-delete {
    background: gray;
    color: white;
}



/* Responsive adjustments */
@media (max-width: 1024px) {
    .avatar-wrapper {
        width: 65px; /* Adjust size on tablets */
        height: 65px; /* Adjust size on tablets */
    }

    #remove-icon {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }

    #save-avatar {
        font-size: 10px; /* Smaller button on smaller screens */
    }
}

@media (max-width: 769px) {
    .hover-overlay, .profile-picture-text {
        font-size: 10px;
    }
}
    
@media (max-width: 769px) {
    .avatar-wrapper {
        width: 65px; /* Adjust size on mobile */
        height: 65px; /* Adjust size on mobile */
    }
    
    .hover-overlay, .profile-picture-text {
        font-size: 10px;
    }

    #remove-icon {
        width: 16px;
        height: 16px;
        font-size: 14px; /* Adjust remove icon size */
    }

    #save-avatar {
        font-size: 10px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .avatar-wrapper {
        width: 55px; /* Adjust size on very small screens */
        height: 55px; /* Adjust size on very small screens */
    }

    #remove-icon {
        width: 14px;
        height: 14px;
        font-size: 10px; /* Smaller remove icon */
    }

    #save-avatar {
        font-size: 6px;
        padding: 3px 6px;
    }
}
