:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-start: #0f0c29;
    --bg-mid: #302b63;
    --bg-end: #24243e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-glow: rgba(99, 102, 241, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    padding: 3rem 0 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.header-content {
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    height: 4rem;
    width: auto;
    max-width: 4rem;
    object-fit: contain;
    filter: drop-shadow(0 0 20px var(--shadow-glow));
    display: block;
}

.tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.1em;
}

/* Main Content */
.main {
    padding: 2rem 0 4rem;
    position: relative;
    z-index: 1;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: fadeIn 1s ease-out;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.refresh-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Servers Grid */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (min-width: 1024px) {
    .servers-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.25rem;
    }
}

/* Server Card */
.server-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.server-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px var(--shadow), 0 0 40px var(--shadow-glow);
    border-color: rgba(255, 255, 255, 0.2);
}

.server-card:hover::before {
    opacity: 1;
}

.server-card.offline {
    opacity: 0.6;
}

.server-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.server-header-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.server-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.server-icon-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.25rem;
}

.server-icon-emoji {
    font-size: 2rem;
    line-height: 1;
    display: block;
}

.server-icon-fallback {
    font-size: 2rem;
    line-height: 1;
    display: inline-block;
}

.server-name-container {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

/* Initially show full text when not scrolling */
.server-name-container:not(.scrolling) {
    overflow: visible;
}

.server-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-left: 0.5rem;
    line-height: 1.3;
    white-space: nowrap;
    display: inline-block;
}

/* Marquee scroll animation for long names */
.server-name-container.scrolling {
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

/* When scrolling class is added but not animated yet, keep text visible at start */
.server-name-container.scrolling:not(.animate) .server-name {
    display: inline-block;
    min-width: max-content;
    transform: translateX(0) !important;
}

/* Only animate if the name is actually overflowing and animate class is added */
.server-name-container.scrolling.animate .server-name {
    display: inline-block;
    min-width: max-content;
    animation: marquee 15s linear infinite;
}

.server-name-container.scrolling.animate:hover .server-name {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--scroll-distance, 0px)));
    }
}

.server-header-status {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

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

.status-online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-online .status-indicator {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-offline .status-indicator {
    background: var(--error);
    animation: none;
}

.status-unknown {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.status-unknown .status-indicator {
    background: #9ca3af;
    animation: none;
}

.server-description {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.server-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.info-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-actions {
    display: flex;
    gap: 0.375rem;
}

.btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
}

.footer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hostname {
    font-weight: 500;
    color: var(--text-secondary);
}

.separator {
    color: var(--text-muted);
}

.tetris-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.tetris-link:hover {
    color: var(--secondary);
    text-shadow: 0 0 10px var(--primary);
}

.tetris-link::after {
    content: ' 🎮';
    opacity: 0;
    transition: opacity 0.2s;
}

.tetris-link:hover::after {
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .logo {
        font-size: 2rem;
    }

    .logo-icon {
        height: 3rem;
        max-width: 3rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .servers-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .server-card {
        padding: 1.5rem;
    }

    .server-info {
        grid-template-columns: 1fr;
    }
}

/* Loading States */
.loading-shimmer {
    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: shimmer 1.5s infinite;
}

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

