/**
 * header-avatar-stack.css
 * Avatar stack display for search page header
 * First avatar on top, cascading to the right
 */

.header-avatar-stack {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: auto;
    padding-right: 8px;
}

.avatar-stack-container {
    display: flex;
    align-items: center;
    height: 100%;
}

.avatar-stack-list {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-direction: row-reverse; /* Reverse order so first item appears on top */
}

.avatar-stack-item {
    position: relative;
    width: 32px;
    height: 32px;
    margin-left: -12px; /* Negative left margin creates overlap to the right */
    transition: transform 0.2s ease;
    border-radius: 50%;
    background: #f0f0f0;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* First avatar (now last in DOM due to row-reverse) has no left margin */
.avatar-stack-item:last-child {
    margin-left: 0;
    z-index: 10; /* First avatar on top */
}

/* Each previous item gets progressively lower z-index */
.avatar-stack-item:nth-last-child(2) { z-index: 9; }
.avatar-stack-item:nth-last-child(3) { z-index: 8; }
.avatar-stack-item:nth-last-child(4) { z-index: 7; }
.avatar-stack-item:nth-last-child(5) { z-index: 6; }
.avatar-stack-item:nth-last-child(6) { z-index: 5; }
.avatar-stack-item:nth-last-child(7) { z-index: 4; }

.avatar-stack-item:hover {
    transform: translateY(-2px);
    z-index: 20 !important; /* Bring hovered item to front */
}

.avatar-stack-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar-stack-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.avatar-stack-more {
    position: relative;
    width: 32px;
    height: 32px;
    margin-left: -12px;
    border-radius: 50%;
    background: #000000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 15; /* Above avatars but below hover */
}

/* Loading state */
.avatar-stack-loading {
    width: 32px;
    height: 32px;
    margin-left: -12px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loadingShimmer 1.5s infinite;
    border: 2px solid #ffffff;
}

.avatar-stack-loading:last-child {
    margin-left: 0;
}

@keyframes loadingShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty state */
.avatar-stack-empty {
    display: none;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .avatar-stack-item,
    .avatar-stack-more,
    .avatar-stack-loading {
        width: 28px;
        height: 28px;
        margin-left: -10px;
        font-size: 11px;
    }
    
    .avatar-stack-placeholder {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .avatar-stack-item,
    .avatar-stack-more,
    .avatar-stack-loading {
        width: 24px;
        height: 24px;
        margin-left: -8px;
    }
    
    .avatar-stack-placeholder {
        font-size: 10px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .avatar-stack-item:hover {
        transform: none;
    }
}