/* ========================================
   СТИЛИ ДЛЯ КНОПОК И КАРУСЕЛИ
   ======================================== */


.top-5-users {
    margin-bottom: 1.25rem;
}

/* ========================================
   КНОПКИ "ПОКАЗАТЬ ВСЕ" И "СКРЫТЬ"
   ======================================== */
.show-all-section, 
.hide-all-section {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
}

.show-all-btn, 
.hide-all-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(1.5rem, 5vw, 2rem);
    border-radius: 1.5rem;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: clamp(150px, 40vw, 200px);
    display: inline-block;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.show-all-btn:active, 
.hide-all-btn:active {
    transform: scale(0.98);
}

.show-all-btn:hover, 
.hide-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.hide-all-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.hide-all-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* ========================================
   BACKDROP ДЛЯ МОДАЛЬНОГО ОКНА
   ======================================== */
.carousel-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    z-index: 99998 !important;
    display: none !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.carousel-backdrop.active {
    display: block !important;
    opacity: 1 !important;
}

/* ========================================
   ПОЛНОЭКРАННАЯ КАРУСЕЛЬ
   UPDATED: 2025-10-16 - Центрирование с учетом Safe Areas
   ======================================== */
.all-users-carousel {
    position: fixed !important;
    /* Центрирование с учетом Telegram Safe Areas */
    top: calc(50% + env(safe-area-inset-top) / 2 - env(safe-area-inset-bottom) / 2) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 330px !important;
    height: 445px !important;
    max-width: 330px !important;
    max-height: 445px !important;
    min-width: 330px !important;
    min-height: 445px !important;
    background: transparent !important;
    z-index: 99999 !important;
    display: none !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Дополнительное принудительное позиционирование */
#all-users-carousel.all-users-carousel,
.all-users-carousel.all-users-carousel,
div#all-users-carousel.all-users-carousel {
    position: fixed !important;
    top: calc(50% + env(safe-area-inset-top) / 2 - env(safe-area-inset-bottom) / 2) !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Display управляется JavaScript */
#all-users-carousel.all-users-carousel[style*="display: block"],
.all-users-carousel.all-users-carousel[style*="display: block"],
div#all-users-carousel.all-users-carousel[style*="display: block"] {
    display: block !important;
}

/* МОБИЛЬНЫЕ УСТРОЙСТВА */
@media (max-width: 480px) {
    .all-users-carousel {
        width: 330px !important;
        height: 515px !important;
        max-width: 330px !important;
        max-height: 515px !important;
        min-width: 330px !important;
        min-height: 515px !important;
        /* Центрирование уже задано в базовых стилях с учетом Safe Areas */
    }
}


/* МЕДИАЗАПРОСЫ УДАЛЕНЫ */

/* МАКСИМАЛЬНЫЙ ПРИОРИТЕТ УДАЛЕН - ИСПОЛЬЗУЕТСЯ БАЗОВЫЙ РАЗМЕР */

/* УДАЛЕНЫ ДУБЛИРУЮЩИЕСЯ МЕДИА-ЗАПРОСЫ - ЕСТЬ НИЖЕ */

/* СТАРЫЙ КОД УДАЛЕН - КОНФЛИКТОВАЛ С НОВЫМ */


/* Центрируем контент */
.all-users-carousel.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.all-users-carousel .swiper-container-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1; /* Растягиваем на всё доступное пространство */
    display: flex;
    flex-direction: column;
}



/* КОНФЛИКТУЮЩИЙ БЛОК ПОЛНОСТЬЮ УДАЛЕН */


/* Контейнер Swiper - на всю высоту родителя */
.all-users-carousel .swiper {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
}

.all-users-carousel .swiper-wrapper {
    height: 100% !important;
    flex: 1 !important; /* Растягиваем на всё доступное пространство */
}

.all-users-carousel .swiper-slide {
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important; /* Растягиваем контент */
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* ========================================
   КАРТОЧКА ПОЛЬЗОВАТЕЛЯ В КАРУСЕЛИ
   ======================================== */
.all-users-carousel .swiper-slide .user-item {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important; /* Занимаем всю высоту родителя */
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important; /* Контент внизу */
    background: #000 !important;
    cursor: pointer !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 12px !important;
    margin: 0 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

/* Эффект при наведении на карточку пользователя */
.all-users-carousel .swiper-slide .user-item:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4) !important;
}

/* Эффект при клике на карточку пользователя */
.all-users-carousel .swiper-slide .user-item:active {
    transform: scale(0.98) !important;
}

/* Аватарка пользователя - растянута на весь контейнер */
.all-users-carousel .swiper-slide .user-avatar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 12px !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important; /* Не блокирует клики по родителю */
    image-rendering: -webkit-optimize-contrast !important; /* Улучшение качества для WebKit */
    image-rendering: crisp-edges !important; /* Улучшение качества для других браузеров */
    image-rendering: high-quality !important; /* Приоритет качества */
    -webkit-backface-visibility: hidden !important; /* Улучшение производительности */
    backface-visibility: hidden !important;
    transform: translateZ(0) !important; /* Аппаратное ускорение */
}

/* Индикатор онлайн статуса */
.swiper-slide .online-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 16px;
    height: 16px;
    background: var(--active-color);
    border: 3px solid var(--base-bg);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--active-color);
    animation: pulse 2s infinite;
    z-index: 10;
    pointer-events: none !important; /* Не блокирует клики по родителю */
}

/* Текстовый индикатор онлайн статуса */
.swiper-slide .online-status-text {
    position: absolute;
    top: 15px;
    right: 40px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: var(--active-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 0, 0.3);
    text-shadow: 0 0 8px var(--active-color);
    z-index: 10;
    white-space: nowrap;
    pointer-events: none !important; /* Не блокирует клики по родителю */
}

/* Текст "был онлайн X назад" */
.swiper-slide .last-seen-text {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
    white-space: nowrap;
    pointer-events: none !important;
}


/* Информация пользователя */
.swiper-slide .user-info-container {
    position: relative;
    z-index: 2;
    padding: clamp(1rem, 4vw, 2rem);
    padding-top: clamp(0.5rem, 2vw, 1rem); /* Уменьшен верхний отступ */
    padding-bottom: clamp(0.5rem, 2vw, 1rem); /* Уменьшен нижний отступ */
    color: white;
}

/* Текстовые элементы не блокируют клики */
.swiper-slide .user-name,
.swiper-slide .user-username,
.swiper-slide .user-stats,
.swiper-slide .user-rating,
.swiper-slide .user-details,
.swiper-slide .gender-icon,
.swiper-slide .age-info,
.swiper-slide .grade-info {
    pointer-events: none !important;
}

.swiper-slide .user-name {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.swiper-slide .user-username {
    font-size: clamp(1rem, 3vw, 1.2rem);
    opacity: 0.9;
    margin-bottom: 1rem;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
}

/* Статистика пользователя */
.swiper-slide .user-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.swiper-slide .user-rating {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Детали пользователя */
.swiper-slide .user-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Матричные стили для элементов профиля - такие же как у рейтинга */
.swiper-slide .gender-icon {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    min-width: 80px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 32px;
    box-sizing: border-box;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.swiper-slide .gender-icon:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.swiper-slide .age-info {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    min-width: 80px;
    transition: all 0.3s ease;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.swiper-slide .age-info:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

.swiper-slide .grade-info {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    min-width: 80px;
    transition: all 0.3s ease;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.swiper-slide .grade-info:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Стили для грейдов с анимацией */
.swiper-slide .grade-junior {
    color: #00ff88 !important;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    animation: juniorGlow 2s ease-in-out infinite alternate;
}

.swiper-slide .grade-middle {
    color: #00aaff !important;
    text-shadow: 0 0 15px rgba(0, 170, 255, 0.6);
    animation: middleGlow 2s ease-in-out infinite alternate;
}

.swiper-slide .grade-senior {
    color: #ff6b35 !important;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.7);
    animation: seniorGlow 2s ease-in-out infinite alternate;
}

/* Анимации для грейдов */
@keyframes juniorGlow {
    0% {
        text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
        transform: scale(1);
    }
    100% {
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
        transform: scale(1.02);
    }
}

@keyframes middleGlow {
    0% {
        text-shadow: 0 0 15px rgba(0, 170, 255, 0.6);
        transform: scale(1);
    }
    100% {
        text-shadow: 0 0 25px rgba(0, 170, 255, 0.9);
        transform: scale(1.03);
    }
}

@keyframes seniorGlow {
    0% {
        text-shadow: 0 0 20px rgba(255, 107, 53, 0.7);
        transform: scale(1);
    }
    100% {
        text-shadow: 0 0 30px rgba(255, 107, 53, 1);
        transform: scale(1.05);
    }
}

/* ========================================
   НАВИГАЦИЯ SWIPER
   ======================================== */

/* Кнопки навигации */
.all-users-carousel .swiper-button-next,
.all-users-carousel .swiper-button-prev {
    width: clamp(40px, 10vw, 50px);
    height: clamp(40px, 10vw, 50px);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: all 0.3s ease;
}

.all-users-carousel .swiper-button-next:after,
.all-users-carousel .swiper-button-prev:after {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: bold;
}

.all-users-carousel .swiper-button-next:hover,
.all-users-carousel .swiper-button-prev:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ИНДИКАТОР СВАЙПА УДАЛЕН */

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */
/* Медиазапросы удалены - используются базовые стили */

/* ========================================
   iOS SAFE AREA
   ======================================== */
@supports (padding: max(0px)) {
    .swiper-slide .user-info-container {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}


/* ========================================
   ФИНАЛЬНОЕ ПЕРЕОПРЕДЕЛЕНИЕ - МАКСИМАЛЬНЫЙ ПРИОРИТЕТ
   VERSION 22.6 - ПРОВЕРКА КЭША
   ======================================== */
#all-users-carousel.all-users-carousel,
.all-users-carousel.all-users-carousel,
div#all-users-carousel {
    width: 330px !important;
    height: 445px !important;
    max-width: 330px !important;
    max-height: 445px !important;
    min-width: 330px !important;
    min-height: 445px !important;
}

/* Дополнительное переопределение на случай, если display: block */
#all-users-carousel[style*="display"],
.all-users-carousel[style*="display"] {
    width: 330px !important;
    height: 445px !important;
}


