/* ========================================
   SERVER MONITORING - FM-NEXUS 1:1 COPY
======================================== */

/* Section Header - ТОЧНО как в fm-nexus */
.monitoring-section {
    padding: 3rem 0;
}

@media (min-width: 1920px) {
    .monitoring-section {
        padding: 5rem 0;
    }
}

.monitoring-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .monitoring-header {
        flex-direction: row;
        align-items: center;
    }
}

.monitoring-header-content h2 {
    font-size: 1.875rem; /* 30px */
    font-weight: 700;
    color: var(--foreground, #0a0a0a);
    margin: 0 0 0.5rem 0;
}

.monitoring-header-content p {
    color: var(--muted-foreground, #737373);
    margin: 0;
    font-size: 1rem;
}

.monitoring-header-content .text-primary {
    color: var(--primary, #E201CD);
    font-weight: 600;
}

.monitoring-header-content .text-secondary {
    color: var(--secondary, #33F0F0);
    font-weight: 600;
}

/* "Все серверы" button */
.btn-all-servers {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    
    /* Glass effect - ИСПРАВЛЕНО для старого CSS */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--foreground, #0a0a0a);
}

.btn-all-servers:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(226, 1, 205, 0.3);
    color: var(--primary, #E201CD);
}

.btn-all-servers svg {
    width: 16px;
    height: 16px;
}

/* Dark theme */
[data-theme="dark"] .btn-all-servers {
    background: rgba(10, 10, 10, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fafafa;
}

[data-theme="dark"] .btn-all-servers:hover {
    background: rgba(10, 10, 10, 0.9);
    border-color: rgba(226, 1, 205, 0.3);
}

/* Server Grid - 4 колонки как в fm-nexus */
.monitoring-grid {
    display: flex;
    /* grid-template-columns: 1fr; */
    gap: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

@media (min-width: 640px) {
    .monitoring-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .monitoring-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1460px) {
    .monitoring-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Последний элемент если он один в ряду */
    /* .server-card:last-child:nth-child(4n+1) {
        grid-column: 2 / 4;
        max-width: 50%; 
        margin: 0 auto; 
    } */
}

/* ========================================
   SERVER CARD - ТОЧНАЯ КОПИЯ fm-nexus
======================================== */

.server-card {
    /* Glass effect */
    /* background: rgba(255, 255, 255, 0.05); */
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    border-radius: 0.75rem;
    padding: 1rem; /* p-4 = 16px */
    
    cursor: pointer;
    text-decoration: none;
    display: block;
    
    transition: all 0.3s ease;
    transform: translateY(0);
    width: 100%;
    max-width: 325px;
}

[data-theme="dark"] .server-card {
    background: var(--glass-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Hover effect */
.server-card:hover {
    border-color: rgba(226, 1, 205, 0.3);
    box-shadow: 0 0 20px rgba(226, 1, 205, 0.15);
    transform: translateY(-2px);
}

/* Card Content - flex горизонтально */
.server-card-content {
    display: flex;
    align-items: center;
    gap: 1rem; /* gap-4 = 16px */
}

/* Server Icon - 56x56px */
.server-icon {
    width: 56px; /* w-14 */
    height: 56px; /* h-14 */
    border-radius: 1rem; /* rounded-xl */
    background: linear-gradient(135deg, 
        rgba(226, 1, 205, 0.2), 
        rgba(51, 240, 240, 0.2));
    
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.server-icon svg {
    width: 28px;
    height: 28px;
    color: var(--primary, #E201CD);
}

/* Server Info */
.server-info {
    flex: 1;
    min-width: 0;
}

/* Name row - название + точка статуса */
.server-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.server-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground, #0a0a0a);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
    font-size: inherit;
}

.server-card:hover .server-name {
    color: var(--primary, #E201CD);
}

/* Точка статуса рядом с названием */
.status-dot-inline {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-inline.online {
    background: #22c55e; /* green-500 */
}

.status-dot-inline.offline {
    background: #ef4444; /* red-500 */
}

/* Stats row - игроки + версия */
.server-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground, #737373);
}

.server-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.server-stat svg {
    width: 14px;
    height: 14px;
}

.server-stat .players-count {
    font-weight: 500;
}

.server-stat .players-count.online {
    color: var(--foreground, #0a0a0a);
    font-weight: 600;
}

.server-version {
    display: none;
}

@media (min-width: 40px) {
    .server-version {
        display: inline;
    }
}

/* Status Badge - справа */
.server-status-badge {
    display: none;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

@media (min-width: 40px) {
    .server-status-badge {
        display: flex;
    }
}

.server-status-badge.online {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    /* border: 1px solid rgba(34, 197, 94, 0.2); */
}

.server-status-badge.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    /* border: 1px solid rgba(239, 68, 68, 0.2); */
}

.status-dot-badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.server-status-badge.online .status-dot-badge {
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* ========================================
   SKELETON LOADERS - FIX для задержки
======================================== */

.server-card-skeleton {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
}

[data-theme="dark"] .server-card-skeleton {
    background: var(--glass-bg);
}

.server-card-skeleton .server-card-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

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

.skeleton-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.875rem;
}

/* Animations */
.animate-slide-up {
    animation: slide-up 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger delay */
.animate-slide-up:nth-child(1) { animation-delay: 0.05s; }
.animate-slide-up:nth-child(2) { animation-delay: 0.1s; }
.animate-slide-up:nth-child(3) { animation-delay: 0.15s; }
.animate-slide-up:nth-child(4) { animation-delay: 0.2s; }
.animate-slide-up:nth-child(5) { animation-delay: 0.25s; }
.animate-slide-up:nth-child(6) { animation-delay: 0.3s; }
.animate-slide-up:nth-child(7) { animation-delay: 0.35s; }
.animate-slide-up:nth-child(8) { animation-delay: 0.4s; }

.monitoring-section,
[data-section="monitoring"] {
    scroll-margin-top: 40px;
}

/* ========================================
   GAME-SWITCH ANIMATIONS & STATES
======================================== */

/* Game switching transition */
.monitoring-grid.game-switching {
    opacity: 0.6;
    transform: scale(0.98);
    transition: all 0.3s ease;
}

.monitoring-grid.game-switching .server-card {
    pointer-events: none;
}

/* Game-specific styling */
.monitoring-grid[data-game="minecraft"] .server-card--minecraft {
    border-color: rgba(34, 197, 94, 0.2);
}

.monitoring-grid[data-game="minecraft"] .server-card--minecraft:hover {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.monitoring-grid[data-game="hytale"] .server-card--hytale {
    border-color: rgba(147, 51, 234, 0.2);
}

.monitoring-grid[data-game="hytale"] .server-card--hytale:hover {
    border-color: rgba(147, 51, 234, 0.4);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.15);
}

/* Error and empty states */
.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    grid-column: 1 / -1;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    min-height: 200px;
}

.error-state-icon,
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.error-state h3,
.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0 0 0.5rem 0;
}

.error-state p,
.empty-state p {
    color: var(--muted-foreground);
    margin: 0 0 1.5rem 0;
    max-width: 400px;
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    
    background: var(--primary);
    color: white;
}

.retry-btn:hover {
    background: var(--primary-hover, #d946ef);
    transform: translateY(-1px);
}

/* Game context indicators */
.monitoring-header-content .game-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.5rem;
}

.monitoring-header-content .game-indicator--minecraft {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.monitoring-header-content .game-indicator--hytale {
    background: rgba(147, 51, 234, 0.1);
    color: #9333ea;
    border: 1px solid rgba(147, 51, 234, 0.2);
}

/* Loading states for game switching */
@keyframes game-switch-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

.monitoring-grid.game-switching .server-card {
    animation: game-switch-pulse 1s ease-in-out infinite;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .server-version {
        display: none;
    }
}