

#avatar-list-wrapper {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1006; /* Higher than district card */
    transform: translateY(100%);
    /* Добавлена задержка visibility */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.4s;
    visibility: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: none; /* Allows clicks to pass through when hidden */
}
#avatar-list-wrapper.visible {
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
    visibility: visible;
    pointer-events: auto; /* Enable clicks when visible */
}
/* Copied from district-card.html styles for consistency */
#avatar-list-card {
    position: relative;
    background: #ffffff;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    color: #1c1c1e;
    height: 75vh; /* Same height as district card */
    box-shadow: 0 -5px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    padding: 0;
}
.avatar-list-scroll-content {
    overflow-y: auto;
    padding: 10px 15px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.close-avatar-list-btn {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px;
    background: #f0f0f0; border: none; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s ease; padding: 0; z-index: 10;
}
.close-avatar-list-btn:hover { background: #e0e0e0; }
.close-avatar-list-btn img { width: 16px; height: 16px; }

/* MODIFIED: Header styles to match district card main title */
#avatar-list-card .card-header {
    text-align: left; /* Align title to the left */
    padding: 20px 20px 10px;
    margin-bottom: 0;
    flex-shrink: 0;
    border-bottom: none; /* Explicitly remove any bottom border */
}

/* MODIFIED: Title styles to match district card main title */
#avatar-list-card .card-header h4 {
    display: block; /* Make it a block element */
    font-size: 1.8rem; /* Large font size, similar to district card */
    font-weight: 700; /* Bold */
    color: #1c1c1e; /* Dark text color */
    background-color: transparent; /* Remove badge background */
    padding: 0; /* Remove badge padding */
    border-radius: 0; /* Remove badge radius */
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
}


/* --- FILTERS --- */
.avatar-list-filters {
    display: flex;
    justify-content: flex-start; /* Align filters to the left */
    gap: 10px;
    padding: 0 20px 15px;
    flex-shrink: 0;
    border-bottom: none; /* Explicitly remove horizontal line */
}

.filter-btn {
    background: #f2f2f7;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #8e8e93;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* Space between icon and text */
}

.filter-btn.icon-btn {
    padding: 8px; /* Square padding for icon only */
    width: 40px;
    height: 40px;
}

.filter-btn img {
    width: 24px;
    height: 24px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.filter-btn.active {
    color: #1c1c1e;
    border-color: rgba(0,0,0,0.05);
}
.filter-btn.active img {
    opacity: 1;
}

/* Specific active state for the main filter button */
#open-filters-btn.active {
    background-color: #f59e0b; /* Fallback */
    background: linear-gradient(45deg, #f97316, #f59e0b);
    color: white;
    border-color: transparent; /* Remove border for cleaner gradient */
}

/* Pastel Active States */
.filter-btn.active[data-filter="all"] {
    background: #e5e5ea;
}
.filter-btn.active[data-filter="man"] {
    background: #bfdbfe; /* Pastel Blue */
    color: #1e3a8a;
}
.filter-btn.active[data-filter="woman"] {
    background: #fbcfe8; /* Pastel Pink */
    color: #831843;
}

/* --- GRID --- */
#avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 Users per line */
    gap: 15px 8px;
    text-align: center;
}

.avatar-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

/* Wrapper to handle absolute positioning of the badge relative to the avatar only */
.avatar-wrapper {
    position: relative;
    margin-bottom: 8px; /* Space between avatar/badge and name */
    width: 60px;       /* Explicit size matching the avatar */
    height: 60px;
    display: flex;
    justify-content: center;
}

.avatar-grid-item-img {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background-color: #e0e0e0;
    background-size: cover;
    background-position: center;
}

/* Online Status Indicator on Avatar */
.avatar-grid-item.online .avatar-grid-item-img {
    border-color: #34c759; /* Green border for online */
}

/* NEW Badge on Avatar (Bottom Center) */
.badge-new {
    position: absolute;
    bottom: -4px; /* Push slightly below the circle to look like a sticker */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */

    background: #FF4D4D; /* Brand Coral */
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 6px;
    border: 2px solid white; /* White border to separate from image */
    z-index: 2;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.avatar-grid-item-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1c1c1e;
    word-break: break-word;
    line-height: 1.2;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.avatar-grid-item-mood {
    font-size: 0.7rem; /* Уменьшен шрифт */
    font-weight: 600;
    color: #aeaeb2;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
    min-height: calc(0.7rem * 1.2); /* Резервируем место */
}

/* Badges Container under name */
.item-badges {
    display: flex;
    flex-direction: row;
    gap: 4px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.info-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.2;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 16px;
}

.info-badge.vip {
    background: var(--vip-gradient, linear-gradient(135deg, #FF4D4D, #FFA1A1));
    color: white;
}

.info-badge.likes {
    background: #ffeff0;
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.2);
}
.info-badge.likes svg {
    width: 8px;
    height: 8px;
    fill: currentColor;
}