/* Уменьшенные размеры карточек */
.node-card {
    background: linear-gradient(135deg, rgba(16, 23, 41, 0.95) 0%, rgba(8, 17, 33, 0.95) 100%);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 234, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 234, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    height: 100%;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00eaff, #008cff, #00eaff);
}

.node-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 234, 255, 0.2);
    border-color: rgba(0, 234, 255, 0.3);
}

/* Контейнер для основного контента карточки */
.card-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.node-name { 
    font-family: 'Orbitron', sans-serif;
    color: #00eaff; 
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.node-name::before {
    content: '🛰️';
    margin-right: 8px;
    font-size: 0.9rem;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-active {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-inactive {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* Уменьшаем блок identity key */
.identity-key-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(0, 234, 255, 0.08);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 234, 255, 0.1);
}

.identity-key {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.65rem;
    word-break: break-all;
    color: #94a3b8;
    flex: 1;
    line-height: 1.3;
    margin: 0;
}

.copy-identity-btn {
    background: rgba(0, 234, 255, 0.2);
    border: none;
    color: #00eaff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 0;
    font-size: 0.8rem;
}

/* Уменьшаем сетку статистики */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-value {
    font-weight: 600;
    font-size: 0.8rem;
    color: #00eaff;
}

/* Уменьшаем секции прогресса */
.progress-section {
    margin: 12px 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.progress-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.progress-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: #00eaff;
}

.progress-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #00eaff, #008cff);
    border-radius: 8px;
    transition: width 1s ease-in-out;
    box-shadow: 0 0 8px rgba(0, 234, 255, 0.3);
}

/* Уменьшаем секцию Profit */
.profit-section {
    margin: 12px 0;
    background: rgba(57, 255, 20, 0.05);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid rgba(57, 255, 20, 0.1);
}

.profit-header {
    margin-bottom: 6px;
}

.profit-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.profit-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.profit-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 6px;
    background: rgba(57, 255, 20, 0.08);
    border-radius: 5px;
    border: 1px solid rgba(57, 255, 20, 0.1);
}

.profit-period {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 600;
}

.profit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    padding: 1px 0;
}

.profit-type {
    font-size: 0.6rem;
    color: #94a3b8;
    text-align: left;
}

.profit-value {
    font-size: 0.65rem;
    font-weight: 600;
    text-align: right;
}

/* Уменьшаем секцию Reliability */
.reliability-section {
    margin: 12px 0;
    background: rgba(0, 234, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid rgba(0, 234, 255, 0.1);
    flex-shrink: 0;
}

.reliability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.reliability-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.chart-toggle {
    display: flex;
    background: rgba(0, 234, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Exo 2', sans-serif;
    font-weight: 500;
}

.toggle-btn.active {
    background: rgba(0, 234, 255, 0.3);
    color: #00eaff;
    box-shadow: 0 0 5px rgba(0, 234, 255, 0.3);
}

.reliability-average {
    font-size: 0.7rem;
    font-weight: 600;
    color: #00eaff;
    white-space: nowrap;
}

.reliability-chart-container {
    height: 60px;
    position: relative;
    margin-top: 5px;
    flex-shrink: 0;
}

.reliability-chart {
    width: 100% !important;
    height: 100% !important;
}

/* Уменьшаем футер карточки */
.card-footer {
    margin-top: auto;
    padding-top: 10px;
}

.saturation-warning {
    background: rgba(255, 209, 102, 0.15);
    border: 1px solid rgba(255, 209, 102, 0.3);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 0.7rem;
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.warning-content i {
    color: #ffd166;
    font-size: 0.9rem;
    margin-top: 1px;
}

.warning-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.warning-text strong {
    color: #ffd166;
    font-size: 0.75rem;
    font-weight: 600;
}

.warning-text span {
    color: #94a3b8;
    font-size: 0.65rem;
}

/* Кнопки действий */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: stretch;
}

.delegate-btn, .explorer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    position: relative;
    min-height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delegate-btn {
    background: linear-gradient(135deg, #39ff14, #00eaff);
    color: #0a0e17;
    box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

.delegate-btn.disabled {
    background: linear-gradient(135deg, #ffd166, #ffb347);
    color: #0a0e17;
    box-shadow: 0 4px 15px rgba(255, 209, 102, 0.3);
    cursor: not-allowed;
    opacity: 0.9;
}

.delegate-btn.disabled:hover {
    transform: none;
    background: linear-gradient(135deg, #ffd166, #ffb347);
}

.delegate-btn i, .explorer-btn i {
    font-size: 0.7rem;
    flex-shrink: 0;
    line-height: 1;
}

.delegate-btn span, .explorer-btn span {
    line-height: 1;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorer-btn {
    background: rgba(16, 23, 41, 0.8);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
    min-height: 36px;
}

/* Тултип для кнопки High Saturation */
.delegate-btn.disabled[data-tooltip] {
    position: relative;
}

.delegate-btn.disabled[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 25, 40, 0.95);
    color: #ffd166;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.7rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    width: max-content;
    max-width: 250px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 209, 102, 0.3);
    backdrop-filter: blur(10px);
    white-space: pre-line;
    line-height: 1.4;
    word-wrap: break-word;
    font-family: 'Exo 2', sans-serif;
    font-weight: 400;
}

.delegate-btn.disabled[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(20, 25, 40, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
}

.delegate-btn.disabled[data-tooltip]:hover::before,
.delegate-btn.disabled[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Стили для фильтрации */
.node-card.filtered-out {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: -9999 !important;
}

/* Стили для названия страны */
.country-name {
    display: inline-block;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.flag {
    cursor: help;
    vertical-align: middle;
    margin-right: 5px;
}

/* Адаптивность */
@media (max-width: 1400px) {
    .node-card {
        min-height: 480px;
    }
}

@media (max-width: 1100px) {
    .node-card {
        min-height: 450px;
    }
    
    .profit-stats {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 768px) {
    .node-card {
        min-height: auto;
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr !important; /* Изменено с 1fr на 1fr 1fr */
        gap: 8px; /* Уменьшаем расстояние между элементами */
    }
    
    /* Уменьшаем шрифты для лучшего отображения в 2 колонки */
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.75rem;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .profit-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .delegate-btn, .explorer-btn {
        width: 100%;
        font-size: 0.7rem;
        padding: 8px 12px;
        min-height: 36px;
        justify-content: center;
    }
    
    .delegate-btn.disabled[data-tooltip] {
        left: 50%;
        transform: translateX(-50%);
        max-width: 200px;
        font-size: 0.65rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .country-name {
        max-width: 80px;
    }
}


/* Скрываем кнопку делегирования на мобильных устройствах */
@media (max-width: 1024px) {
    .delegate-btn {
        display: none !important;
    }
    
    .card-actions {
        justify-content: center;
    }
    
    .explorer-btn {
        width: 100%;
        justify-content: center;
    }
}




/* Обновляем контейнер для identity key */
.identity-key-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 234, 255, 0.08);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 234, 255, 0.1);
}

.identity-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Кнопка обновления */
.refresh-btn {
    background: rgba(57, 255, 20, 0.2);
    border: none;
    color: #39ff14;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 0.8rem;
    position: relative;
    overflow: hidden;
}

.refresh-btn:hover:not(:disabled):not(.loading) {
    background: rgba(57, 255, 20, 0.3);
    transform: rotate(90deg);
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}

.refresh-btn:active:not(:disabled):not(.loading) {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.refresh-btn:disabled,
.refresh-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.refresh-btn.loading {
    background: rgba(57, 255, 20, 0.3);
}

.refresh-btn.loading i.fa-spinner {
    animation: spin 0.8s linear infinite;
}

.refresh-btn i.fa-sync-alt {
    transition: transform 0.3s ease;
}

/* Плавная анимация для иконки синхронизации */
.refresh-btn:hover:not(:disabled):not(.loading) i.fa-sync-alt {
    transform: rotate(180deg);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(57, 255, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0); }
}

/* Эффект для всей карточки при обновлении */
.node-card.refreshing {
    position: relative;
    overflow: hidden;
}

.node-card.refreshing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #39ff14, transparent);
    animation: refreshingLine 1.5s ease-in-out;
    z-index: 2;
}

@keyframes refreshingLine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.node-card.refreshing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(57, 255, 20, 0.05),
        transparent
    );
    animation: refreshingShine 1.5s ease-in-out;
    z-index: 1;
}

@keyframes refreshingShine {
    0% { 
        transform: translateX(-100%) skewX(-15deg); 
        opacity: 0;
    }
    50% { 
        opacity: 0.3;
    }
    100% { 
        transform: translateX(100%) skewX(-15deg); 
        opacity: 0;
    }
}


/* Анимация для всех элементов карточки при обновлении */
.node-card.refreshing .stat-value,
.node-card.refreshing .progress-bar,
.node-card.refreshing .profit-value {
    transition: all 0.3s ease;
}

.node-card.refreshing .stat-value.updating {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Toast уведомления */


/* Адаптивность для toast */
@media (max-width: 768px) {
    .refresh-toast {
        left: 20px;
        right: 20px;
        bottom: 80px; /* Учитываем мобильную навигацию */
        min-width: auto;
        max-width: calc(100vw - 40px);
    }
}


/* Исправление для toggle кнопок в мобильной версии */
@media (max-width: 768px) {
    .reliability-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .chart-toggle {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 2px;
        gap: 1px;
        padding: 1px;
    }
    
    .toggle-btn {
        flex: 1;
        min-width: 0;
        padding: 3px 4px;
        font-size: 0.6rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .reliability-label {
        font-size: 0.65rem;
    }
    
    .reliability-average {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .chart-toggle {
        gap: 0;
    }
    
    .toggle-btn {
        font-size: 0.58rem;
        padding: 2px 3px;
    }
    
    .reliability-header {
        gap: 4px;
    }
}


/* Стили для отдельного контейнера chart-toggle */
.chart-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    width: 100%;
}

/* Перемещаем chart-toggle под reliability-label для всех версий */
.reliability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    width: 100%;
}

/* Для мобильной версии - адаптируем */
@media (max-width: 768px) {
    .reliability-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .reliability-label {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .chart-toggle-container {
        justify-content: flex-start;
        margin-top: 4px;
    }
}


.reliability-header {
    margin-bottom: 6px;
    width: 100%;
}

.reliability-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.reliability-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.reliability-icon {
    color: #00eaff;
    font-size: 0.8rem;
}

.chart-title {
    font-weight: 600;
}


/* Стили для тултипа копирования */
.copy-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 23, 41, 0.95);
    color: #00eaff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid rgba(0, 234, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.copy-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.copy-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 234, 255, 0.3);
}

.identity-key-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.identity-key {
    flex: 1;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    word-break: break-all;
    padding: 8px;
    background: rgba(16, 23, 41, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(0, 234, 255, 0.2);
    font-size: 14px;
    color: #94a3b8;
}

.identity-actions {
    flex-shrink: 0;
}

.copy-identity-btn {
    background: rgba(0, 234, 255, 0.1);
    border: 1px solid rgba(0, 234, 255, 0.3);
    color: #00eaff;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-identity-btn:hover {
    background: rgba(0, 234, 255, 0.2);
    transform: translateY(-1px);
}

.copy-identity-btn:active {
    transform: translateY(0);
}