/* Profile Photo Fallback Styles - Stepped Sizes (NOT proportional) */

/* Default avatar styling - exclude comment avatars (review-comment and .comment list avatars) */
/* CRITICAL: Use direct px values to prevent FOUC (Flash of Unstyled Content) */
.profile-photo,
.current-photo,
img[src*="default-profile"]:not(.comment-avatar):not(.review-comment img):not(.comment img) {
    background-color: #f8f9fa;
    border: 2px solid #dee2e6; /* Fixed border */
    border-radius: 50% !important;
    object-fit: cover !important;
    transition: none !important; /* Disable transition during load to prevent flash */
    /* Use direct px values (NOT CSS variables) to prevent flash */
    width: 105px !important; /* Fixed: 105px for desktop - direct value */
    height: 105px !important; /* Fixed height - direct value */
    display: block !important;
    max-width: 105px !important; /* Direct value */
    max-height: 105px !important; /* Direct value */
    min-width: 105px !important; /* Direct value */
    min-height: 105px !important; /* Direct value */
    flex-shrink: 0 !important;
    /* Prevent size changes during load */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fallback placeholder styling */
.profile-photo[src*="data:image"],
.current-photo[src*="data:image"] {
    background-color: #e9ecef;
    border: 0.125rem solid #ced4da; /* Proportional: 2px / 16 = 0.125rem */
}

/* Loading state */
.profile-photo.loading,
.current-photo.loading {
    opacity: 0.6;
    filter: blur(1px);
}

/* Error state */
.profile-photo.error,
.current-photo.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Hover effects */
.profile-photo:hover,
.current-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Comment avatars - small and consistent (proportional); .comment = unified comments list */
.comment-avatar,
.review-comment img.rounded-circle,
.comment img.rounded-circle {
    width: 2rem !important; /* Proportional: 32px / 16 = 2rem */
    min-width: 2rem !important;
    max-width: 2rem !important;
    aspect-ratio: 1 / 1; /* Square */
    height: auto !important; /* Height from aspect-ratio */
    min-height: 2rem !important;
    max-height: 2rem !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    flex-shrink: 0 !important;
    background-color: #f8f9fa;
    border: 0.0625rem solid #dee2e6; /* Proportional: 1px / 16 = 0.0625rem */
}

/* Different sizes - Proportional Layout Contract */
.profile-photo.small,
.current-photo.small {
    width: 2rem !important; /* Proportional: 32px / 16 = 2rem */
    aspect-ratio: 1 / 1;
    height: auto !important;
    border-radius: 50% !important;
}

.profile-photo.medium,
.current-photo.medium {
    width: 4rem !important; /* Proportional: 64px / 16 = 4rem */
    aspect-ratio: 1 / 1;
    height: auto !important;
    border-radius: 50% !important;
}

.profile-photo.large,
.current-photo.large {
    width: 8rem !important; /* Proportional: 128px / 16 = 8rem */
    aspect-ratio: 1 / 1;
    height: auto !important;
    border-radius: 50% !important;
}

.profile-photo.xlarge,
.current-photo.xlarge {
    width: 12.5rem !important; /* Proportional: 200px / 16 = 12.5rem */
    aspect-ratio: 1 / 1;
    height: auto !important;
    border-radius: 50% !important;
}

/* Animation for photo updates */
@keyframes photoUpdate {
    0% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 0.8; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.profile-photo.updating,
.current-photo.updating {
    animation: photoUpdate 0.5s ease-in-out;
}

/* Tablet: Stepped size - Direct values to prevent flash */
@media (min-width: 768px) and (max-width: 991px) {
    .profile-photo,
    .current-photo,
    img[src*="default-profile"]:not(.comment-avatar):not(.review-comment img):not(.comment img) {
        width: 100px !important; /* Fixed: 100px for tablet - direct value */
        height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
    }
}

/* Mobile: Stepped size (NOT proportional) - Direct values to prevent flash */
@media (max-width: 767px) {
    .profile-photo,
    .current-photo,
    img[src*="default-profile"]:not(.comment-avatar):not(.review-comment img):not(.comment img) {
        width: 90px !important; /* Fixed: 90px for mobile - direct value */
        height: 90px !important;
        max-width: 90px !important;
        max-height: 90px !important;
        min-width: 90px !important;
        min-height: 90px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        display: block !important;
        flex-shrink: 0 !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .profile-photo,
    .current-photo,
    img[src*="default-profile"] {
        background-color: #343a40;
        border-color: #495057;
    }
    
    .profile-photo[src*="data:image"],
    .current-photo[src*="data:image"] {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .profile-photo.error,
    .current-photo.error {
        background-color: #721c24;
        border-color: #f5c6cb;
    }
}