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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
    display: flex;
    gap: 0.5rem;
}

.search-engine-select {
    background: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.search-engine-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

.search-wrapper {
    flex: 1;
    position: relative;
}

.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.search-box:focus {
    outline: none;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.search-box::placeholder {
    color: #999;
}

.group-section {
    margin-bottom: 2.5rem;
}

.group-title {
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    border-left: 4px solid rgba(255,255,255,0.5);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.host-box {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.host-box:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
}

.host-box.active {
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.popover {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 1000;
    min-width: 400px;
    max-width: 90vw;
    animation: popIn 0.3s ease;
}

.popover.show {
    display: block;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.popover-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

.popover-overlay.show {
    display: block;
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.popover-icon {
    font-size: 3rem;
}

.popover-title {
    flex: 1;
    margin-left: 1rem;
}

.popover-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.popover-type {
    color: #666;
    font-size: 1rem;
}

.close-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.close-btn:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.host-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.host-name {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    color: #333;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
}

.host-type {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.host-details {
    margin-top: 1rem;
}

.detail-row {
    margin-bottom: 0.75rem;
}

.detail-label {
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8f9fa;
    padding: 0.4rem;
    border-radius: 4px;
}

.links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.links a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.links a:hover {
    background: #764ba2;
}

.status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status.offline {
    background: #ef4444;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .host-box.expanded {
        grid-column: span 1;
    }
}
