/* Стили для списка рефералов */
.referral-list-container {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
@media (min-width: 600px) {
    .referral-list-container {
        height: auto;
        max-height: 69vh;
    }
}

/* Блок управления (поиск + сортировка) - НЕ скроллится */
.referral-controls {
    flex-shrink: 0;
    padding: 20px 20px 12px 20px;
    background: #16181c;
}

/* Верхняя панель с поиском и сортировкой */
.referral-top-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

/* Строка поиска */
.referral-search {
    position: relative;
    flex: 1;
}

.referral-search input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #DCDDE0;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.referral-search input::placeholder {
    color: #8B8D92;
}

.referral-search input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.referral-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #8B8D92;
    font-size: 16px;
    pointer-events: none;
}

/* Выпадающее меню сортировки */
.referral-sort-dropdown {
    position: relative;
    flex-shrink: 0;
}

.referral-sort-trigger {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #DCDDE0;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.referral-sort-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.referral-sort-trigger:active {
    transform: scale(0.95);
}

/* Выпадающее меню */
.referral-sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: #1E2023;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.referral-sort-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.referral-sort-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #DCDDE0;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.referral-sort-option i {
    font-size: 16px;
    color: #8B8E94;
    transition: color 0.2s;
}

.referral-sort-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.referral-sort-option.active {
    background: rgba(64, 167, 227, 0.15);
}

.referral-sort-option.active i {
    color: #40a7e3;
}


/* Скроллируемая область со списком */
.referral-list-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.15s ease;
    padding: 12px 20px 20px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.referral-list-scrollable::-webkit-scrollbar {
    width: 6px;
}

.referral-list-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.referral-list-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.referral-list-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Заголовок таблицы - НЕ скроллится */
.referral-table-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 8px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: #16181c;
}

.referral-header-friend {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #6B6E74;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.referral-header-earnings {
    font-size: 13px;
    font-weight: 500;
    color: #6B6E74;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
}

/* Список рефералов */
.referral-list {
    display: flex;
    flex-direction: column;
}

/* Карточка реферала */
.referral-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 !important;
    margin-bottom: 12px;
    background: transparent !important;
    background-color: transparent !important;
    border-radius: 0 !important;
    transition: all 0.2s;
}

.referral-card:last-child {
    margin-bottom: 0;
}

.referral-card:hover {
    transform: translateX(2px);
}

/* Аватар реферала */
.referral-avatar {
    width: 42px;
    height: 42px;
    border-radius: 100%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.referral-avatar > div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.referral-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Инфо о реферале */
.referral-info {
    flex: 1;
    min-width: 0;
    margin-bottom: 0 !important;
}

.referral-name {
    font-size: 15px;
    font-weight: 500;
    color: #DCDDE0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-date {
    font-size: 13px;
    color: #6B6E74;
    margin: 0;
}

/* Заработок */
.referral-earnings {
    text-align: right;
    flex-shrink: 0;
    margin-left: auto;
}

.referral-amount {
    font-size: 15px;
    font-weight: 600;
    color: #5B9FD3;
    margin: 0;
}

.referral-amount-label {
    display: none;
}

/* Кнопка фильтра по коду */
.referral-code-filter {
    position: relative;
    flex-shrink: 0;
}

.referral-code-trigger {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #DCDDE0;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.referral-code-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.referral-code-trigger:active {
    transform: scale(0.95);
}

.referral-code-trigger.filtered {
    background: rgba(91, 159, 211, 0.15);
    border-color: rgba(91, 159, 211, 0.4);
    color: #5B9FD3;
}

/* Дропдаун кодов */
.referral-code-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    max-height: 320px;
    background: #1E2023;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 110;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.referral-code-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.referral-code-search-wrap {
    position: relative;
    padding: 8px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.referral-code-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B6E74;
    font-size: 13px;
    pointer-events: none;
}

.referral-code-search-wrap input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #DCDDE0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.referral-code-search-wrap input::placeholder {
    color: #6B6E74;
}

.referral-code-search-wrap input:focus {
    border-color: rgba(255, 255, 255, 0.2);
}

.referral-code-list {
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.referral-code-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.referral-code-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.referral-code-item.active {
    background: rgba(91, 159, 211, 0.15);
}

.rci-label {
    font-size: 13px;
    font-weight: 400;
    color: #DCDDE0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rci-label i {
    font-size: 13px;
    color: #6B6E74;
}

.referral-code-item.active .rci-label {
    font-weight: 500;
    color: #fff;
}

.rci-count {
    font-size: 12px;
    font-weight: 600;
    color: #8B8E94;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 1px 7px;
    flex-shrink: 0;
    margin-left: 8px;
}

.referral-code-item.active .rci-count {
    color: #5B9FD3;
    background: rgba(91, 159, 211, 0.15);
}

/* Пустое состояние */
.referral-empty {
    text-align: center;
    padding: 60px 20px;
}

.referral-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.referral-empty-title {
    font-size: 17px;
    font-weight: 600;
    color: #DCDDE0;
    margin: 0 0 8px 0;
}

.referral-empty-text {
    font-size: 14px;
    color: #6B6E74;
    margin: 0;
    line-height: 1.5;
}

/* Состояние загрузки */
.referral-loading {
    text-align: center;
    padding: 60px 20px;
}

.referral-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(91, 159, 211, 0.2);
    border-top-color: #5B9FD3;
    border-radius: 50%;
    animation: referralSpin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes referralSpin {
    to { transform: rotate(360deg); }
}

.referral-loading-text {
    font-size: 14px;
    color: #6B6E74;
}

/* Адаптивность */
@media (max-width: 375px) {
    .referral-card {
        padding: 10px;
        gap: 10px;
    }
    
    .referral-avatar {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    
    .referral-name {
        font-size: 14px;
    }
    
    .referral-amount {
        font-size: 14px;
    }
}

